aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2021-01-20 17:58:21 +0800
committerfannie zhang <Fannie.Zhang@arm.com>2021-03-12 01:47:01 +0000
commita607408403df7515f831fef64991222673a50a68 (patch)
treea59b734fd705d12bf9e1d12c580783788eb62537 /src/cmd/asm
parent71a6c13164f2151c14ebaeccdfcb3633fc8b618e (diff)
downloadgo-a607408403df7515f831fef64991222673a50a68.tar.xz
cmd/internal/obj/arm64: add support for op(extended register) with RSP arguments
Refer to ARM reference manual, like add(extended register) instructions, the extension is encoded in the "option" field. If "Rd" or "Rn" is RSP and "option" is "010" then LSL is preferred. Therefore, the instrution "add Rm<<imm, RSP, RSP" or "add Rm<<imm RSP" is valid and can be encoded as add(extended register) instruction. But the current assembler can not handle like "op R1<<1, RSP, RSP" instructions, this patch adds the support. Because MVN(extended register) does not exist, remove it. Add test cases. Change-Id: I968749d75c6b93a4f297b39c73cc292e6b1035ad Reviewed-on: https://go-review.googlesource.com/c/go/+/284900 Trust: fannie zhang <Fannie.Zhang@arm.com> Run-TryBot: fannie zhang <Fannie.Zhang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm64.s10
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm64error.s3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s
index 8635708320..d859171103 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64.s
@@ -64,6 +64,16 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
CMN R1.SXTX<<2, R10 // 5fe921ab
CMPW R2.UXTH<<3, R11 // 7f2d226b
CMNW R1.SXTB, R9 // 3f81212b
+ ADD R1<<1, RSP, R3 // e367218b
+ ADDW R1<<2, R3, RSP // 7f48210b
+ SUB R1<<3, RSP // ff6f21cb
+ SUBS R1<<4, RSP, R3 // e37321eb
+ ADDS R1<<1, RSP, R4 // e46721ab
+ CMP R1<<2, RSP // ff6b21eb
+ CMN R1<<3, RSP // ff6f21ab
+ ADDS R1<<1, ZR, R4 // e40701ab
+ ADD R3<<50, ZR, ZR // ffcb038b
+ CMP R4<<24, ZR // ff6304eb
CMPW $0x60060, R2 // CMPW $393312, R2 // 1b0c8052db00a0725f001b6b
CMPW $40960, R0 // 1f284071
CMPW $27745, R2 // 3b8c8d525f001b6b
diff --git a/src/cmd/asm/internal/asm/testdata/arm64error.s b/src/cmd/asm/internal/asm/testdata/arm64error.s
index 1c8eaa1752..64bade2051 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64error.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64error.s
@@ -368,4 +368,7 @@ TEXT errors(SB),$0
CASPD (R2, R3), (R2), (R9, R10) // ERROR "destination register pair must start from even register"
CASPD (R2, R4), (R2), (R8, R9) // ERROR "source register pair must be contiguous"
CASPD (R2, R3), (R2), (R8, R10) // ERROR "destination register pair must be contiguous"
+ ADD R1>>2, RSP, R3 // ERROR "illegal combination"
+ ADDS R2<<3, R3, RSP // ERROR "unexpected SP reference"
+ CMP R1<<5, RSP // ERROR "the left shift amount out of range 0 to 4"
RET