Skip to content

Commit 239faf0

Browse files
kmclaughlin-armtstellar
authored andcommitted
[LLVM][AArch64] Remove aliases of LSUI instructions (llvm#126072)
Removes MnemonicAliases added for instructions available with the LSUI feature (e.g. CAS -> CAST) which are not equivalent. The aliases stt[add|clr|set]a & stt[add|clr|set]al are also removed. (cherry picked from commit d44d806)
1 parent 2b70b17 commit 239faf0

File tree

4 files changed

+22
-128
lines changed

4 files changed

+22
-128
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12529,26 +12529,19 @@ multiclass STOPregister<string asm, string instr> {
1252912529
!cast<Instruction>(instr # "X")>;
1253012530
}
1253112531

12532+
let Predicates = [HasLSUI] in
1253212533
class BaseSTOPregisterLSUI<string asm, RegisterClass OP, Register Reg,
1253312534
Instruction inst> :
12534-
InstAlias<asm # "\t$Rs, [$Rn]", (inst Reg, OP:$Rs, GPR64sp:$Rn)>;
12535+
InstAlias<asm # "\t$Rs, [$Rn]", (inst Reg, OP:$Rs, GPR64sp:$Rn), 0>;
1253512536

1253612537
multiclass STOPregisterLSUI<string asm, string instr> {
12537-
def : BaseSTOPregisterLSUI<asm # "a", GPR32, WZR,
12538-
!cast<Instruction>(instr # "W")>;
12539-
def : BaseSTOPregisterLSUI<asm # "a", GPR64, XZR,
12540-
!cast<Instruction>(instr # "X")>;
12541-
def : BaseSTOPregisterLSUI<asm # "l", GPR32, WZR,
12542-
!cast<Instruction>(instr # "W")>;
12543-
def : BaseSTOPregisterLSUI<asm # "l", GPR64, XZR,
12544-
!cast<Instruction>(instr # "X")>;
12545-
def : BaseSTOPregisterLSUI<asm # "al", GPR32, WZR,
12546-
!cast<Instruction>(instr # "W")>;
12547-
def : BaseSTOPregisterLSUI<asm # "al", GPR64, XZR,
12548-
!cast<Instruction>(instr # "X")>;
12549-
def : BaseSTOPregisterLSUI<asm, GPR32, WZR,
12538+
def : BaseSTOPregisterLSUI<asm # "l", GPR32, WZR,
12539+
!cast<Instruction>(instr # "LW")>;
12540+
def : BaseSTOPregisterLSUI<asm # "l", GPR64, XZR,
12541+
!cast<Instruction>(instr # "LX")>;
12542+
def : BaseSTOPregisterLSUI<asm, GPR32, WZR,
1255012543
!cast<Instruction>(instr # "W")>;
12551-
def : BaseSTOPregisterLSUI<asm, GPR64, XZR,
12544+
def : BaseSTOPregisterLSUI<asm, GPR64, XZR,
1255212545
!cast<Instruction>(instr # "X")>;
1255312546
}
1255412547

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,21 +2667,11 @@ defm CASLT : CompareAndSwapUnprivileged<0b11, 0, 1, "l">;
26672667
defm CASAT : CompareAndSwapUnprivileged<0b11, 1, 0, "a">;
26682668
defm CASALT : CompareAndSwapUnprivileged<0b11, 1, 1, "al">;
26692669

2670-
def : MnemonicAlias<"cas", "cast">;
2671-
def : MnemonicAlias<"casl", "caslt">;
2672-
def : MnemonicAlias<"casa", "casat">;
2673-
def : MnemonicAlias<"casal", "casalt">;
2674-
26752670
// v9.6-a atomic CASPT
26762671
defm CASPT : CompareAndSwapPairUnprivileged<0b01, 0, 0, "">;
26772672
defm CASPLT : CompareAndSwapPairUnprivileged<0b01, 0, 1, "l">;
26782673
defm CASPAT : CompareAndSwapPairUnprivileged<0b01, 1, 0, "a">;
26792674
defm CASPALT : CompareAndSwapPairUnprivileged<0b01, 1, 1, "al">;
2680-
2681-
def : MnemonicAlias<"casp", "caspt">;
2682-
def : MnemonicAlias<"caspl", "casplt">;
2683-
def : MnemonicAlias<"caspa", "caspat">;
2684-
def : MnemonicAlias<"caspal", "caspalt">;
26852675
}
26862676

26872677
// v8.1 atomic SWP
@@ -2696,11 +2686,6 @@ let Predicates = [HasLSUI] in {
26962686
defm SWPTA : SwapLSUI<1, 0, "a">;
26972687
defm SWPTL : SwapLSUI<0, 1, "l">;
26982688
defm SWPTAL : SwapLSUI<1, 1, "al">;
2699-
2700-
def : MnemonicAlias<"swp", "swpt">;
2701-
def : MnemonicAlias<"swpa", "swpta">;
2702-
def : MnemonicAlias<"swpl", "swptl">;
2703-
def : MnemonicAlias<"swpal", "swptal">;
27042689
}
27052690

27062691
// v9.6-a unprivileged atomic LD<OP> (FEAT_LSUI)
@@ -4865,22 +4850,14 @@ let Predicates = [HasLSUI] in {
48654850
defm LDTXRW : LoadUnprivilegedLSUI<0b10, GPR32, "ldtxr">;
48664851
defm LDTXRX : LoadUnprivilegedLSUI<0b11, GPR64, "ldtxr">;
48674852

4868-
def : MnemonicAlias<"ldxr", "ldtxr">;
4869-
48704853
def LDATXRW : LoadExclusiveLSUI <0b10, 1, 1, GPR32, "ldatxr">;
48714854
def LDATXRX : LoadExclusiveLSUI <0b11, 1, 1, GPR64, "ldatxr">;
48724855

4873-
def : MnemonicAlias<"ldaxr", "ldatxr">;
4874-
48754856
defm STTXRW : StoreUnprivilegedLSUI<0b10, GPR32, "sttxr">;
48764857
defm STTXRX : StoreUnprivilegedLSUI<0b11, GPR64, "sttxr">;
48774858

4878-
def : MnemonicAlias<"stxr", "sttxr">;
4879-
48804859
def STLTXRW : StoreExclusiveLSUI<0b10, 0, 1, GPR32, "stltxr">;
48814860
def STLTXRX : StoreExclusiveLSUI<0b11, 0, 1, GPR64, "stltxr">;
4882-
4883-
def : MnemonicAlias<"stlxr", "stltxr">;
48844861
}
48854862

48864863
//===----------------------------------------------------------------------===//

llvm/test/MC/AArch64/armv8.1a-lse.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mcpu=tsv110 -show-encoding < %s 2> %t | FileCheck %s
88
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
99
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8r -show-encoding < %s 2> %t | FileCheck %s
10+
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
11+
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.1a,+lse,+lsui -show-encoding < %s 2> %t | FileCheck %s
1012
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
1113
.text
1214

llvm/test/MC/AArch64/armv9.6a-lsui.s

Lines changed: 12 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -313,42 +313,16 @@ _func:
313313
// ERROR: instruction requires: lsui
314314

315315
sttaddl w0, [x2]
316-
// CHECK: ldtadd w0, wzr, [x2] // encoding: [0x5f,0x04,0x20,0x19]
316+
// CHECK: ldtaddl w0, wzr, [x2] // encoding: [0x5f,0x04,0x60,0x19]
317317
// ERROR: instruction requires: lsui
318318
sttaddl w2, [sp]
319-
// CHECK: ldtadd w2, wzr, [sp] // encoding: [0xff,0x07,0x22,0x19]
319+
// CHECK: ldtaddl w2, wzr, [sp] // encoding: [0xff,0x07,0x62,0x19]
320320
// ERROR: instruction requires: lsui
321321
sttaddl x0, [x2]
322-
// CHECK: ldtadd x0, xzr, [x2] // encoding: [0x5f,0x04,0x20,0x59]
322+
// CHECK: ldtaddl x0, xzr, [x2] // encoding: [0x5f,0x04,0x60,0x59]
323323
// ERROR: instruction requires: lsui
324324
sttaddl x2, [sp]
325-
// CHECK: ldtadd x2, xzr, [sp] // encoding: [0xff,0x07,0x22,0x59]
326-
// ERROR: instruction requires: lsui
327-
328-
sttadda w0, [x2]
329-
// CHECK: ldtadd w0, wzr, [x2] // encoding: [0x5f,0x04,0x20,0x19]
330-
// ERROR: instruction requires: lsui
331-
sttadda w2, [sp]
332-
// CHECK: ldtadd w2, wzr, [sp] // encoding: [0xff,0x07,0x22,0x19]
333-
// ERROR: instruction requires: lsui
334-
sttadda x0, [x2]
335-
// CHECK: ldtadd x0, xzr, [x2] // encoding: [0x5f,0x04,0x20,0x59]
336-
// ERROR: instruction requires: lsui
337-
sttadda x2, [sp]
338-
// CHECK: ldtadd x2, xzr, [sp] // encoding: [0xff,0x07,0x22,0x59]
339-
// ERROR: instruction requires: lsui
340-
341-
sttaddal w0, [x2]
342-
// CHECK: ldtadd w0, wzr, [x2] // encoding: [0x5f,0x04,0x20,0x19]
343-
// ERROR: instruction requires: lsui
344-
sttaddal w2, [sp]
345-
// CHECK: ldtadd w2, wzr, [sp] // encoding: [0xff,0x07,0x22,0x19]
346-
// ERROR: instruction requires: lsui
347-
sttaddal x0, [x2]
348-
// CHECK: ldtadd x0, xzr, [x2] // encoding: [0x5f,0x04,0x20,0x59]
349-
// ERROR: instruction requires: lsui
350-
sttaddal x2, [sp]
351-
// CHECK: ldtadd x2, xzr, [sp] // encoding: [0xff,0x07,0x22,0x59]
325+
// CHECK: ldtaddl x2, xzr, [sp] // encoding: [0xff,0x07,0x62,0x59]
352326
// ERROR: instruction requires: lsui
353327

354328
sttclr w0, [x2]
@@ -362,45 +336,19 @@ _func:
362336
// ERROR: instruction requires: lsui
363337
sttclr x2, [sp]
364338
// CHECK: ldtclr x2, xzr, [sp] // encoding: [0xff,0x17,0x22,0x59]
365-
// ERROR: instruction requires: lsui
366-
367-
sttclra w0, [x2]
368-
// CHECK: ldtclr w0, wzr, [x2] // encoding: [0x5f,0x14,0x20,0x19]
369-
// ERROR: instruction requires: lsui
370-
sttclra w2, [sp]
371-
// CHECK: ldtclr w2, wzr, [sp] // encoding: [0xff,0x17,0x22,0x19]
372-
// ERROR: instruction requires: lsui
373-
sttclra x0, [x2]
374-
// CHECK: ldtclr x0, xzr, [x2] // encoding: [0x5f,0x14,0x20,0x59]
375-
// ERROR: instruction requires: lsui
376-
sttclra x2, [sp]
377-
// CHECK: ldtclr x2, xzr, [sp] // encoding: [0xff,0x17,0x22,0x59]
378339
// ERROR: instruction requires: lsui
379340

380341
sttclrl w0, [x2]
381-
// CHECK: ldtclr w0, wzr, [x2] // encoding: [0x5f,0x14,0x20,0x19]
342+
// CHECK: ldtclrl w0, wzr, [x2] // encoding: [0x5f,0x14,0x60,0x19]
382343
// ERROR: instruction requires: lsui
383344
sttclrl w2, [sp]
384-
// CHECK: ldtclr w2, wzr, [sp] // encoding: [0xff,0x17,0x22,0x19]
345+
// CHECK: ldtclrl w2, wzr, [sp] // encoding: [0xff,0x17,0x62,0x19]
385346
// ERROR: instruction requires: lsui
386347
sttclrl x0, [x2]
387-
// CHECK: ldtclr x0, xzr, [x2] // encoding: [0x5f,0x14,0x20,0x59]
348+
// CHECK: ldtclrl x0, xzr, [x2] // encoding: [0x5f,0x14,0x60,0x59]
388349
// ERROR: instruction requires: lsui
389350
sttclrl x2, [sp]
390-
// CHECK: ldtclr x2, xzr, [sp] // encoding: [0xff,0x17,0x22,0x59]
391-
// ERROR: instruction requires: lsui
392-
393-
sttclral w0, [x2]
394-
// CHECK: ldtclr w0, wzr, [x2] // encoding: [0x5f,0x14,0x20,0x19]
395-
// ERROR: instruction requires: lsui
396-
sttclral x2, [sp]
397-
// CHECK: ldtclr x2, xzr, [sp] // encoding: [0xff,0x17,0x22,0x59]
398-
// ERROR: instruction requires: lsui
399-
sttclral x0, [x2]
400-
// CHECK: ldtclr x0, xzr, [x2] // encoding: [0x5f,0x14,0x20,0x59]
401-
// ERROR: instruction requires: lsui
402-
sttclral x2, [sp]
403-
// CHECK: ldtclr x2, xzr, [sp] // encoding: [0xff,0x17,0x22,0x59]
351+
// CHECK: ldtclrl x2, xzr, [sp] // encoding: [0xff,0x17,0x62,0x59]
404352
// ERROR: instruction requires: lsui
405353

406354
sttset w0, [x2]
@@ -414,45 +362,19 @@ _func:
414362
// ERROR: instruction requires: lsui
415363
sttset x2, [sp]
416364
// CHECK: ldtset x2, xzr, [sp] // encoding: [0xff,0x37,0x22,0x59]
417-
// ERROR: instruction requires: lsui
418-
419-
sttseta w0, [x2]
420-
// CHECK: ldtset w0, wzr, [x2] // encoding: [0x5f,0x34,0x20,0x19]
421-
// ERROR: instruction requires: lsui
422-
sttseta w2, [sp]
423-
// CHECK: ldtset w2, wzr, [sp] // encoding: [0xff,0x37,0x22,0x19]
424-
// ERROR: instruction requires: lsui
425-
sttseta x0, [x2]
426-
// CHECK: ldtset x0, xzr, [x2] // encoding: [0x5f,0x34,0x20,0x59]
427-
// ERROR: instruction requires: lsui
428-
sttseta x2, [sp]
429-
// CHECK: ldtset x2, xzr, [sp] // encoding: [0xff,0x37,0x22,0x59]
430365
// ERROR: instruction requires: lsui
431366

432367
sttsetl w0, [x2]
433-
// CHECK: ldtset w0, wzr, [x2] // encoding: [0x5f,0x34,0x20,0x19]
368+
// CHECK: ldtsetl w0, wzr, [x2] // encoding: [0x5f,0x34,0x60,0x19]
434369
// ERROR: instruction requires: lsui
435370
sttsetl w2, [sp]
436-
// CHECK: ldtset w2, wzr, [sp] // encoding: [0xff,0x37,0x22,0x19]
371+
// CHECK: ldtsetl w2, wzr, [sp] // encoding: [0xff,0x37,0x62,0x19]
437372
// ERROR: instruction requires: lsui
438373
sttsetl x0, [x2]
439-
// CHECK: ldtset x0, xzr, [x2] // encoding: [0x5f,0x34,0x20,0x59]
374+
// CHECK: ldtsetl x0, xzr, [x2] // encoding: [0x5f,0x34,0x60,0x59]
440375
// ERROR: instruction requires: lsui
441376
sttsetl x2, [sp]
442-
// CHECK: ldtset x2, xzr, [sp] // encoding: [0xff,0x37,0x22,0x59]
443-
// ERROR: instruction requires: lsui
444-
445-
sttsetal w0, [x2]
446-
// CHECK: ldtset w0, wzr, [x2] // encoding: [0x5f,0x34,0x20,0x19]
447-
// ERROR: instruction requires: lsui
448-
sttsetal x2, [sp]
449-
// CHECK: ldtset x2, xzr, [sp] // encoding: [0xff,0x37,0x22,0x59]
450-
// ERROR: instruction requires: lsui
451-
sttsetal x0, [x2]
452-
// CHECK: ldtset x0, xzr, [x2] // encoding: [0x5f,0x34,0x20,0x59]
453-
// ERROR: instruction requires: lsui
454-
sttsetal x2, [sp]
455-
// CHECK: ldtset x2, xzr, [sp] // encoding: [0xff,0x37,0x22,0x59]
377+
// CHECK: ldtsetl x2, xzr, [sp] // encoding: [0xff,0x37,0x62,0x59]
456378
// ERROR: instruction requires: lsui
457379

458380
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)