Skip to content

Commit 643ac6c

Browse files
committed
[AArch64][v8.3a] Add LDRA '[xN]!' alias.
The instruction definition has been retroactively expanded to allow for an alias for '[xN, 0]!' as '[xN]!'. That wouldn't make sense on LDR, but does for LDRA.
1 parent 142cbe7 commit 643ac6c

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,9 @@ multiclass AuthLoad<bit M, string asm, Operand opr> {
14631463

14641464
def : InstAlias<asm # "\t$Rt, [$Rn]",
14651465
(!cast<Instruction>(NAME # "indexed") GPR64:$Rt, GPR64sp:$Rn, 0)>;
1466+
1467+
def : InstAlias<asm # "\t$Rt, [$wback]!",
1468+
(!cast<Instruction>(NAME # "writeback") GPR64sp:$wback, GPR64:$Rt, 0)>;
14661469
}
14671470

14681471
//---

llvm/test/MC/AArch64/armv8.3a-signed-pointer.s

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,11 @@
306306
// CHECK-NEXT: ldrab x0, [x1] // encoding: [0x20,0x04,0xa0,0xf8]
307307
// CHECK-REQ: error: instruction requires: pa
308308
// CHECK-REQ-NEXT: ldrab x0, [x1]
309+
ldraa x0, [x1]!
310+
// CHECK-NEXT: ldraa x0, [x1]! // encoding: [0x20,0x0c,0x20,0xf8]
311+
// CHECK-REQ: error: instruction requires: pa
312+
// CHECK-REQ-NEXT: ldraa x0, [x1]!
313+
ldrab x0, [x1]!
314+
// CHECK-NEXT: ldrab x0, [x1]! // encoding: [0x20,0x0c,0xa0,0xf8]
315+
// CHECK-REQ: error: instruction requires: pa
316+
// CHECK-REQ-NEXT: ldrab x0, [x1]!

llvm/test/MC/Disassembler/AArch64/armv8.3a-signed-pointer.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@
8383
# CHECK: retab
8484
# CHECK: eretaa
8585
# CHECK: eretab
86-
# CHECK: ldraa x0, [x1, #4088]
87-
# CHECK: ldraa x0, [x1, #-4096]
88-
# CHECK: ldrab x0, [x1, #4088]
89-
# CHECK: ldrab x0, [x1, #-4096]
90-
# CHECK: ldraa x0, [x1, #4088]!
91-
# CHECK: ldraa x0, [x1, #-4096]!
92-
# CHECK: ldrab x0, [x1, #4088]!
93-
# CHECK: ldrab x0, [x1, #-4096]!
9486
[0x1f,0x08,0x1f,0xd6]
9587
[0x1f,0x0c,0x1f,0xd6]
9688
[0x1f,0x08,0x3f,0xd6]
@@ -99,6 +91,15 @@
9991
[0xff,0x0f,0x5f,0xd6]
10092
[0xff,0x0b,0x9f,0xd6]
10193
[0xff,0x0f,0x9f,0xd6]
94+
95+
# CHECK: ldraa x0, [x1, #4088]
96+
# CHECK: ldraa x0, [x1, #-4096]
97+
# CHECK: ldrab x0, [x1, #4088]
98+
# CHECK: ldrab x0, [x1, #-4096]
99+
# CHECK: ldraa x0, [x1, #4088]!
100+
# CHECK: ldraa x0, [x1, #-4096]!
101+
# CHECK: ldrab x0, [x1, #4088]!
102+
# CHECK: ldrab x0, [x1, #-4096]!
102103
[0x20,0xf4,0x3f,0xf8]
103104
[0x20,0x04,0x60,0xf8]
104105
[0x20,0xf4,0xbf,0xf8]
@@ -112,3 +113,8 @@
112113
# CHECK: ldrab x0, [x1]
113114
[0x20,0x04,0x20,0xf8]
114115
[0x20,0x04,0xa0,0xf8]
116+
117+
# CHECK: ldraa x0, [x1]!
118+
# CHECK: ldrab x0, [x1]!
119+
[0x20,0x0c,0x20,0xf8]
120+
[0x20,0x0c,0xa0,0xf8]

0 commit comments

Comments
 (0)