diff options
| author | Junxian Zhu <zhujunxian@oss.cipunited.com> | 2023-05-09 19:11:20 +0800 |
|---|---|---|
| committer | Joel Sing <joel@sing.id.au> | 2023-08-03 05:31:56 +0000 |
| commit | 83c4e533bcf71d86437a5aa9ffc9b5373208628c (patch) | |
| tree | 0d0cbcda5cf6065f649c915b4e733e94fd6817ad /src/cmd/asm | |
| parent | 431612eacb1089ad2e264e2aea3b8c9370e9bc62 (diff) | |
| download | go-83c4e533bcf71d86437a5aa9ffc9b5373208628c.tar.xz | |
cmd/internal/obj/mips: add WSBH/DSBH/DSHD instructions
Add support for WSBH/DSBH/DSHD instructions, which are introduced in mips{32,64}r2.
WSBH reverse bytes within halfwords for 32-bit word, DSBH reverse bytes within halfwords for 64-bit doubleword, and DSHD reverse halfwords within doublewords. These instructions can be used to optimize byte swaps.
Ref: The MIPS64 Instruction Set, Revision 5.04: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00087-2B-MIPS64BIS-AFP-05.04.pdf
Updates #60072
Change-Id: I31c043150fe8ac03027f413ef4cb2f3e435775e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/493816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'src/cmd/asm')
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/mips.s | 1 | ||||
| -rw-r--r-- | src/cmd/asm/internal/asm/testdata/mips64.s | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/mips.s b/src/cmd/asm/internal/asm/testdata/mips.s index 7136d686d7..1ded0b072d 100644 --- a/src/cmd/asm/internal/asm/testdata/mips.s +++ b/src/cmd/asm/internal/asm/testdata/mips.s @@ -428,6 +428,7 @@ label4: NEGW R1, R2 // 00011023 CLZ R1, R2 // 70221020 CLO R1, R2 // 70221021 + WSBH R1, R2 // 7c0110a0 // to (Hi, Lo) MADD R2, R1 // 70220000 diff --git a/src/cmd/asm/internal/asm/testdata/mips64.s b/src/cmd/asm/internal/asm/testdata/mips64.s index 8f628e26c9..573e3d31a6 100644 --- a/src/cmd/asm/internal/asm/testdata/mips64.s +++ b/src/cmd/asm/internal/asm/testdata/mips64.s @@ -587,8 +587,13 @@ label4: CALL foo(SB) RET foo(SB) + // unary operation NEGW R1, R2 // 00011023 NEGV R1, R2 // 0001102f + WSBH R1, R2 // 7c0110a0 + DSBH R1, R2 // 7c0110a4 + DSHD R1, R2 // 7c011164 + RET // MSA VMOVI |
