Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -2665,21 +2665,25 @@ defm CASLT : CompareAndSwapUnprivileged<0b11, 0, 1, "l">;
defm CASAT : CompareAndSwapUnprivileged<0b11, 1, 0, "a">;
defm CASALT : CompareAndSwapUnprivileged<0b11, 1, 1, "al">;

def : MnemonicAlias<"cas", "cast">;
def : MnemonicAlias<"casl", "caslt">;
def : MnemonicAlias<"casa", "casat">;
def : MnemonicAlias<"casal", "casalt">;
def : InstAlias<"cast $Rs, $Rt, [$Rn]", (CASX GPR64:$Rs, GPR64:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"caslt $Rs, $Rt, [$Rn]", (CASLX GPR64:$Rs, GPR64:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"casat $Rs, $Rt, [$Rn]", (CASAX GPR64:$Rs, GPR64:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"casalt $Rs, $Rt, [$Rn]", (CASALX GPR64:$Rs, GPR64:$Rt, GPR64sp0:$Rn)>;

// v9.6-a atomic CASPT
defm CASPT : CompareAndSwapPairUnprivileged<0b01, 0, 0, "">;
defm CASPLT : CompareAndSwapPairUnprivileged<0b01, 0, 1, "l">;
defm CASPAT : CompareAndSwapPairUnprivileged<0b01, 1, 0, "a">;
defm CASPALT : CompareAndSwapPairUnprivileged<0b01, 1, 1, "al">;

def : MnemonicAlias<"casp", "caspt">;
def : MnemonicAlias<"caspl", "casplt">;
def : MnemonicAlias<"caspa", "caspat">;
def : MnemonicAlias<"caspal", "caspalt">;
def : InstAlias<"caspt $Rs, $Rt, [$Rn]",
(CASPX XSeqPairClassOperand:$Rs, XSeqPairClassOperand:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"casplt $Rs, $Rt, [$Rn]",
(CASPLX XSeqPairClassOperand:$Rs, XSeqPairClassOperand:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"caspat $Rs, $Rt, [$Rn]",
(CASPAX XSeqPairClassOperand:$Rs, XSeqPairClassOperand:$Rt, GPR64sp0:$Rn)>;
def : InstAlias<"caspalt $Rs, $Rt, [$Rn]",
(CASPALX XSeqPairClassOperand:$Rs, XSeqPairClassOperand:$Rt, GPR64sp0:$Rn)>;
}

// v8.1 atomic SWP
Expand Down
47 changes: 47 additions & 0 deletions llvm/test/MC/AArch64/armv8.1a-lse.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mcpu=tsv110 -show-encoding < %s 2> %t | FileCheck %s
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8r -show-encoding < %s 2> %t | FileCheck %s
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.1a,+lse,+lsui -show-encoding < %s 2> %t | FileCheck %s -check-prefix=CHECK-FEAT-LSUI
// RUN: FileCheck -check-prefix=CHECK-ERROR < %t %s
.text

Expand Down Expand Up @@ -78,6 +80,15 @@
// CHECK: casal x0, x1, [x2] // encoding: [0x41,0xfc,0xe0,0xc8]
// CHECK: casal x2, x3, [sp] // encoding: [0xe3,0xff,0xe2,0xc8]

// CHECK-FEAT-LSUI: cast x0, x1, [x2] // encoding: [0x41,0x7c,0xa0,0xc8]
// CHECK-FEAT-LSUI: cast x2, x3, [sp] // encoding: [0xe3,0x7f,0xa2,0xc8]
// CHECK-FEAT-LSUI: casat x0, x1, [x2] // encoding: [0x41,0x7c,0xe0,0xc8]
// CHECK-FEAT-LSUI: casat x2, x3, [sp] // encoding: [0xe3,0x7f,0xe2,0xc8]
// CHECK-FEAT-LSUI: caslt x0, x1, [x2] // encoding: [0x41,0xfc,0xa0,0xc8]
// CHECK-FEAT-LSUI: caslt x2, x3, [sp] // encoding: [0xe3,0xff,0xa2,0xc8]
// CHECK-FEAT-LSUI: casalt x0, x1, [x2] // encoding: [0x41,0xfc,0xe0,0xc8]
// CHECK-FEAT-LSUI: casalt x2, x3, [sp] // encoding: [0xe3,0xff,0xe2,0xc8]

swp w0, w1, [x2]
swp w2, w3, [sp]
swpa w0, w1, [x2]
Expand All @@ -95,6 +106,15 @@
// CHECK: swpal w0, w1, [x2] // encoding: [0x41,0x80,0xe0,0xb8]
// CHECK: swpal w2, w3, [sp] // encoding: [0xe3,0x83,0xe2,0xb8]

// CHECK-FEAT-LSUI: swpt w0, w1, [x2] // encoding: [0x41,0x84,0x20,0x19]
// CHECK-FEAT-LSUI: swpt w2, w3, [sp] // encoding: [0xe3,0x87,0x22,0x19]
// CHECK-FEAT-LSUI: swpta w0, w1, [x2] // encoding: [0x41,0x84,0xa0,0x19]
// CHECK-FEAT-LSUI: swpta w2, w3, [sp] // encoding: [0xe3,0x87,0xa2,0x19]
// CHECK-FEAT-LSUI: swptl w0, w1, [x2] // encoding: [0x41,0x84,0x60,0x19]
// CHECK-FEAT-LSUI: swptl w2, w3, [sp] // encoding: [0xe3,0x87,0x62,0x19]
// CHECK-FEAT-LSUI: swptal w0, w1, [x2] // encoding: [0x41,0x84,0xe0,0x19]
// CHECK-FEAT-LSUI: swptal w2, w3, [sp] // encoding: [0xe3,0x87,0xe2,0x19]

swpb w0, w1, [x2]
swpb w2, w3, [sp]
swph w0, w1, [x2]
Expand All @@ -112,6 +132,15 @@
// CHECK: swplb w0, w1, [x2] // encoding: [0x41,0x80,0x60,0x38]
// CHECK: swplb w2, w3, [sp] // encoding: [0xe3,0x83,0x62,0x38]

// CHECK-FEAT-LSUI: swpt x0, x1, [x2] // encoding: [0x41,0x84,0x20,0x59]
// CHECK-FEAT-LSUI: swpt x2, x3, [sp] // encoding: [0xe3,0x87,0x22,0x59]
// CHECK-FEAT-LSUI: swpta x0, x1, [x2] // encoding: [0x41,0x84,0xa0,0x59]
// CHECK-FEAT-LSUI: swpta x2, x3, [sp] // encoding: [0xe3,0x87,0xa2,0x59]
// CHECK-FEAT-LSUI: swptl x0, x1, [x2] // encoding: [0x41,0x84,0x60,0x59]
// CHECK-FEAT-LSUI: swptl x2, x3, [sp] // encoding: [0xe3,0x87,0x62,0x59]
// CHECK-FEAT-LSUI: swptal x0, x1, [x2] // encoding: [0x41,0x84,0xe0,0x59]
// CHECK-FEAT-LSUI: swptal x2, x3, [sp] // encoding: [0xe3,0x87,0xe2,0x59]

swpalb w0, w1, [x2]
swpalb w2, w3, [sp]
swpah w0, w1, [x2]
Expand Down Expand Up @@ -163,6 +192,15 @@
// CHECK: caspa x0, x1, x2, x3, [x2] // encoding: [0x42,0x7c,0x60,0x48]
// CHECK: caspa x4, x5, x6, x7, [sp] // encoding: [0xe6,0x7f,0x64,0x48]

// CHECK-FEAT-LSUI: casp w0, w1, w2, w3, [x5] // encoding: [0xa2,0x7c,0x20,0x08]
// CHECK-FEAT-LSUI: casp w4, w5, w6, w7, [sp] // encoding: [0xe6,0x7f,0x24,0x08]
// CHECK-FEAT-LSUI: caspt x0, x1, x2, x3, [x2] // encoding: [0x42,0x7c,0x20,0x48]
// CHECK-FEAT-LSUI: caspt x4, x5, x6, x7, [sp] // encoding: [0xe6,0x7f,0x24,0x48]
// CHECK-FEAT-LSUI: caspa w0, w1, w2, w3, [x5] // encoding: [0xa2,0x7c,0x60,0x08]
// CHECK-FEAT-LSUI: caspa w4, w5, w6, w7, [sp] // encoding: [0xe6,0x7f,0x64,0x08]
// CHECK-FEAT-LSUI: caspat x0, x1, x2, x3, [x2] // encoding: [0x42,0x7c,0x60,0x48]
// CHECK-FEAT-LSUI: caspat x4, x5, x6, x7, [sp] // encoding: [0xe6,0x7f,0x64,0x48]

caspl w0, w1, w2, w3, [x5]
caspl w4, w5, w6, w7, [sp]
caspl x0, x1, x2, x3, [x2]
Expand All @@ -180,6 +218,15 @@
// CHECK: caspal x0, x1, x2, x3, [x2] // encoding: [0x42,0xfc,0x60,0x48]
// CHECK: caspal x4, x5, x6, x7, [sp] // encoding: [0xe6,0xff,0x64,0x48]

// CHECK-FEAT-LSUI: caspl w0, w1, w2, w3, [x5] // encoding: [0xa2,0xfc,0x20,0x08]
// CHECK-FEAT-LSUI: caspl w4, w5, w6, w7, [sp] // encoding: [0xe6,0xff,0x24,0x08]
// CHECK-FEAT-LSUI: casplt x0, x1, x2, x3, [x2] // encoding: [0x42,0xfc,0x20,0x48]
// CHECK-FEAT-LSUI: casplt x4, x5, x6, x7, [sp] // encoding: [0xe6,0xff,0x24,0x48]
// CHECK-FEAT-LSUI: caspal w0, w1, w2, w3, [x5] // encoding: [0xa2,0xfc,0x60,0x08]
// CHECK-FEAT-LSUI: caspal w4, w5, w6, w7, [sp] // encoding: [0xe6,0xff,0x64,0x08]
// CHECK-FEAT-LSUI: caspalt x0, x1, x2, x3, [x2] // encoding: [0x42,0xfc,0x60,0x48]
// CHECK-FEAT-LSUI: caspalt x4, x5, x6, x7, [sp] // encoding: [0xe6,0xff,0x64,0x48]

ldadd w0, w1, [x2]
ldadd w2, w3, [sp]
ldadda w0, w1, [x2]
Expand Down
40 changes: 40 additions & 0 deletions llvm/test/MC/AArch64/lse-lsui-diagnostics.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// RUN: llvm-mc -triple aarch64 -mattr=+lse -mattr=+lsui -show-encoding %s | FileCheck %s
// RUN: not llvm-mc -triple aarch64 -mattr=+lsui -show-encoding %s 2>&1 | FileCheck %s --check-prefix=ERROR

_func:
// CHECK: _func:

//------------------------------------------------------------------------------
// CAS(P)T instructions
//------------------------------------------------------------------------------
cas w26, w28, [x21]
// CHECK: cas w26, w28, [x21]
// ERROR: error: instruction requires: lse

casl w26, w28, [x21]
// CHECK: casl w26, w28, [x21]
// ERROR: error: instruction requires: lse

casa w26, w28, [x21]
// CHECK: casa w26, w28, [x21]
// ERROR: error: instruction requires: lse

casal w26, w28, [x21]
// CHECK: casal w26, w28, [x21]
// ERROR: error: instruction requires: lse

casp w26, w27, w28, w29, [x21]
// CHECK: casp w26, w27, w28, w29, [x21]
// ERROR: error: instruction requires: lse

caspl w26, w27, w28, w29, [x21]
// CHECK: caspl w26, w27, w28, w29, [x21]
// ERROR: error: instruction requires: lse

caspa w26, w27, w28, w29, [x21]
// CHECK: caspa w26, w27, w28, w29, [x21]
// ERROR: error: instruction requires: lse

caspal w26, w27, w28, w29, [x21]
// CHECK: caspal w26, w27, w28, w29, [x21]
// ERROR: error: instruction requires: lse