aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/mips/asm0.go
diff options
context:
space:
mode:
authorJunxian Zhu <zhujunxian@oss.cipunited.com>2023-08-03 14:44:01 +0800
committerJoel Sing <joel@sing.id.au>2023-08-08 12:17:12 +0000
commit24f83ed4e29495d5b8b6375aeaa2d34d14629c7d (patch)
tree932f6991ef81eecd665e8eadea98c4274c92463b /src/cmd/internal/obj/mips/asm0.go
parent87fe5faffca1bce0db513a3c1bb640ccf6a04bc7 (diff)
downloadgo-24f83ed4e29495d5b8b6375aeaa2d34d14629c7d.tar.xz
cmd/internal/obj/mips: add SEB/SEH instructions
Add support for SEB/SEH instructions, which are introduced in mips32r2. SEB/SEH can be used to sign-extend byte/halfword in registers directly without passing through memory. Ref: The MIPS32 Instruction Set, Revision 5.04: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-05.04.pdf Updates #60072 Change-Id: I33175ae9d943ead5983ac004bd2a158039046d65 Reviewed-on: https://go-review.googlesource.com/c/go/+/515475 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'src/cmd/internal/obj/mips/asm0.go')
-rw-r--r--src/cmd/internal/obj/mips/asm0.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/internal/obj/mips/asm0.go b/src/cmd/internal/obj/mips/asm0.go
index 3a4dc5d185..f158b6688d 100644
--- a/src/cmd/internal/obj/mips/asm0.go
+++ b/src/cmd/internal/obj/mips/asm0.go
@@ -1084,7 +1084,6 @@ func buildop(ctxt *obj.Link) {
ANEGW,
ANEGV,
AWORD,
- AWSBH,
obj.ANOP,
obj.ATEXT,
obj.AUNDEF,
@@ -1106,6 +1105,10 @@ func buildop(ctxt *obj.Link) {
case ATEQ:
opset(ATNE, r0)
+ case AWSBH:
+ opset(ASEB, r0)
+ opset(ASEH, r0)
+
case ADSBH:
opset(ADSHD, r0)
}
@@ -1899,6 +1902,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return SP(3, 7) | OP(20, 4)
case ADSHD:
return SP(3, 7) | OP(44, 4)
+ case ASEB:
+ return SP(3, 7) | OP(132, 0)
+ case ASEH:
+ return SP(3, 7) | OP(196, 0)
}
if a < 0 {