aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2018-01-25 11:46:06 -0500
committerCherry Zhang <cherryyz@google.com>2018-02-14 17:09:37 +0000
commit0938e4cf90101ed718aebf63b583970267c87701 (patch)
tree428a3c86423eb336e13fd578d9ec44aa616b9fca /src/cmd/asm
parent1fccbfe90e80f214db0abf3ff0db5a0dfe0efdf3 (diff)
downloadgo-0938e4cf90101ed718aebf63b583970267c87701.tar.xz
cmd/internal/obj/mips: support NEG, avoid crash with illegal instruction
Add support of NEG{V,W} pseudo-instructions, which are translated to a SUB instruction from R0 with proper width. Also turn illegal instruction to UNDEF, to avoid crashing in asmout when it tries to read the operands. Fixes #23548. Change-Id: I047b27559ccd9594c3dcf62ab039b636098f30a3 Reviewed-on: https://go-review.googlesource.com/89896 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/mips.s2
-rw-r--r--src/cmd/asm/internal/asm/testdata/mips64.s3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/mips.s b/src/cmd/asm/internal/asm/testdata/mips.s
index 0f0226de0c..6d62c43242 100644
--- a/src/cmd/asm/internal/asm/testdata/mips.s
+++ b/src/cmd/asm/internal/asm/testdata/mips.s
@@ -423,6 +423,8 @@ label4:
JMP foo(SB)
CALL foo(SB)
+ NEGW R1, R2 // 00011023
+
// END
//
// LEND comma // asm doesn't support the trailing comma.
diff --git a/src/cmd/asm/internal/asm/testdata/mips64.s b/src/cmd/asm/internal/asm/testdata/mips64.s
index 50a2694576..a945e590ab 100644
--- a/src/cmd/asm/internal/asm/testdata/mips64.s
+++ b/src/cmd/asm/internal/asm/testdata/mips64.s
@@ -403,6 +403,9 @@ label4:
JMP foo(SB)
CALL foo(SB)
+ NEGW R1, R2 // 00011023
+ NEGV R1, R2 // 0001102f
+
// END
//
// LEND comma // asm doesn't support the trailing comma.