aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm/internal
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2019-03-15 08:26:53 +0000
committerBen Shi <powerman1st@163.com>2019-03-23 01:39:16 +0000
commita189467cdae5421c863cf940778d681ecb1d3d2f (patch)
tree3252da64049d297e3c90117669f8f74ae94da2ee /src/cmd/asm/internal
parent1257d05088c3842efa2aa23f8d6abe000e494f1a (diff)
downloadgo-a189467cdae5421c863cf940778d681ecb1d3d2f.tar.xz
cmd/internal/obj/mips: add MADD/MSUB
This CL implements MADD&MSUB, which are mips32r2 instructions. Change-Id: I06fe51573569baf3b71536336b34b95ccd24750b Reviewed-on: https://go-review.googlesource.com/c/go/+/167680 Run-TryBot: Ben Shi <powerman1st@163.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/asm/internal')
-rw-r--r--src/cmd/asm/internal/arch/mips.go3
-rw-r--r--src/cmd/asm/internal/asm/testdata/mips.s8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/arch/mips.go b/src/cmd/asm/internal/arch/mips.go
index 14b29331e5..22c9ebd2da 100644
--- a/src/cmd/asm/internal/arch/mips.go
+++ b/src/cmd/asm/internal/arch/mips.go
@@ -38,7 +38,8 @@ func IsMIPSMUL(op obj.As) bool {
switch op {
case mips.AMUL, mips.AMULU, mips.AMULV, mips.AMULVU,
mips.ADIV, mips.ADIVU, mips.ADIVV, mips.ADIVVU,
- mips.AREM, mips.AREMU, mips.AREMV, mips.AREMVU:
+ mips.AREM, mips.AREMU, mips.AREMV, mips.AREMVU,
+ mips.AMADD, mips.AMSUB:
return true
}
return false
diff --git a/src/cmd/asm/internal/asm/testdata/mips.s b/src/cmd/asm/internal/asm/testdata/mips.s
index 0c6f7fd552..7136d686d7 100644
--- a/src/cmd/asm/internal/asm/testdata/mips.s
+++ b/src/cmd/asm/internal/asm/testdata/mips.s
@@ -424,7 +424,15 @@ label4:
CALL foo(SB)
RET foo(SB)
+ // unary operation
NEGW R1, R2 // 00011023
+ CLZ R1, R2 // 70221020
+ CLO R1, R2 // 70221021
+
+ // to (Hi, Lo)
+ MADD R2, R1 // 70220000
+ MSUB R2, R1 // 70220004
+ MUL R2, R1 // 00220018
// END
//