xref: /aosp_15_r20/external/llvm/test/MC/AArch64/armv8.1a-atomic.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: not llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.1a -show-encoding < %s 2> %t | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker// RUN: FileCheck --check-prefix=CHECK-ERROR <%t %s
3*9880d681SAndroid Build Coastguard Worker  .text
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker  //8 bits
6*9880d681SAndroid Build Coastguard Worker  casb   w0, w1, [x2]
7*9880d681SAndroid Build Coastguard Worker  casab  w0, w1, [x2]
8*9880d681SAndroid Build Coastguard Worker  caslb  w0, w1, [x2]
9*9880d681SAndroid Build Coastguard Worker  casalb   w0, w1, [x2]
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker//CHECK:  casb   w0, w1, [x2]        //      encoding: [0x41,0x7c,0xa0,0x08]
12*9880d681SAndroid Build Coastguard Worker//CHECK:  casab  w0, w1, [x2]        //      encoding: [0x41,0x7c,0xe0,0x08]
13*9880d681SAndroid Build Coastguard Worker//CHECK:  caslb   w0, w1, [x2]       //      encoding: [0x41,0xfc,0xa0,0x08]
14*9880d681SAndroid Build Coastguard Worker//CHECK:  casalb   w0, w1, [x2]      //      encoding: [0x41,0xfc,0xe0,0x08]
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker  casb w0, w1, [w2]
17*9880d681SAndroid Build Coastguard Worker  casalb x0, x1, [x2]
18*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
19*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   casb w0, w1, [w2]
20*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                 ^
21*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
22*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   casalb x0, x1, [x2]
23*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:          ^
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker  //16 bits
26*9880d681SAndroid Build Coastguard Worker  cash   w0, w1, [x2]
27*9880d681SAndroid Build Coastguard Worker  casah  w0, w1, [x2]
28*9880d681SAndroid Build Coastguard Worker  caslh  w0, w1, [x2]
29*9880d681SAndroid Build Coastguard Worker  casalh   w0, w1, [x2]
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker//CHECK:  cash   w0, w1, [x2]        //      encoding: [0x41,0x7c,0xa0,0x48]
32*9880d681SAndroid Build Coastguard Worker//CHECK:  casah  w0, w1, [x2]        //      encoding: [0x41,0x7c,0xe0,0x48]
33*9880d681SAndroid Build Coastguard Worker//CHECK:  caslh   w0, w1, [x2]       //      encoding: [0x41,0xfc,0xa0,0x48]
34*9880d681SAndroid Build Coastguard Worker//CHECK:  casalh   w0, w1, [x2]      //      encoding: [0x41,0xfc,0xe0,0x48]
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker  //32 bits
37*9880d681SAndroid Build Coastguard Worker  cas   w0, w1, [x2]
38*9880d681SAndroid Build Coastguard Worker  casa  w0, w1, [x2]
39*9880d681SAndroid Build Coastguard Worker  casl  w0, w1, [x2]
40*9880d681SAndroid Build Coastguard Worker  casal   w0, w1, [x2]
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker//CHECK:  cas   w0, w1, [x2]        //      encoding: [0x41,0x7c,0xa0,0x88]
43*9880d681SAndroid Build Coastguard Worker//CHECK:  casa  w0, w1, [x2]        //      encoding: [0x41,0x7c,0xe0,0x88]
44*9880d681SAndroid Build Coastguard Worker//CHECK:  casl   w0, w1, [x2]       //      encoding: [0x41,0xfc,0xa0,0x88]
45*9880d681SAndroid Build Coastguard Worker//CHECK:  casal   w0, w1, [x2]      //      encoding: [0x41,0xfc,0xe0,0x88]
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker  cas   w0, w1, [w2]
48*9880d681SAndroid Build Coastguard Worker  casl  w0, x1, [x2]
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
51*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   cas   w0, w1, [w2]
52*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                  ^
53*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
54*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   casl  w0, x1, [x2]
55*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:             ^
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker  //64 bits
58*9880d681SAndroid Build Coastguard Worker  cas   x0, x1, [x2]
59*9880d681SAndroid Build Coastguard Worker  casa  x0, x1, [x2]
60*9880d681SAndroid Build Coastguard Worker  casl   x0, x1, [x2]
61*9880d681SAndroid Build Coastguard Worker  casal   x0, x1, [x2]
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker//CHECK:  cas   x0, x1, [x2]        //      encoding: [0x41,0x7c,0xa0,0xc8]
64*9880d681SAndroid Build Coastguard Worker//CHECK:  casa  x0, x1, [x2]        //      encoding: [0x41,0x7c,0xe0,0xc8]
65*9880d681SAndroid Build Coastguard Worker//CHECK:  casl   x0, x1, [x2]       //      encoding: [0x41,0xfc,0xa0,0xc8]
66*9880d681SAndroid Build Coastguard Worker//CHECK:  casal   x0, x1, [x2]      //      encoding: [0x41,0xfc,0xe0,0xc8]
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Worker  casa   x0, x1, [w2]
69*9880d681SAndroid Build Coastguard Worker  casal  x0, w1, [x2]
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
72*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   casa   x0, x1, [w2]
73*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                   ^
74*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
75*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   casal  x0, w1, [x2]
76*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:              ^
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Worker  // LD<OP> intructions
79*9880d681SAndroid Build Coastguard Worker  ldadda x0, x1, [x2]
80*9880d681SAndroid Build Coastguard Worker  ldclrl x0, x1, [x2]
81*9880d681SAndroid Build Coastguard Worker  ldeoral x0, x1, [x2]
82*9880d681SAndroid Build Coastguard Worker  ldset x0, x1, [x2]
83*9880d681SAndroid Build Coastguard Worker  ldsmaxa w0, w1, [x2]
84*9880d681SAndroid Build Coastguard Worker  ldsminlb w0, w1, [x2]
85*9880d681SAndroid Build Coastguard Worker  ldumaxalh w0, w1, [x2]
86*9880d681SAndroid Build Coastguard Worker  ldumin w0, w1, [x2]
87*9880d681SAndroid Build Coastguard Worker  ldsminb w2, w3, [x5]
88*9880d681SAndroid Build Coastguard Worker//CHECK: ldadda     x0, x1, [x2]  // encoding: [0x41,0x00,0xa0,0xf8]
89*9880d681SAndroid Build Coastguard Worker//CHECK: ldclrl     x0, x1, [x2]  // encoding: [0x41,0x10,0x60,0xf8]
90*9880d681SAndroid Build Coastguard Worker//CHECK: ldeoral    x0, x1, [x2]  // encoding: [0x41,0x20,0xe0,0xf8]
91*9880d681SAndroid Build Coastguard Worker//CHECK: ldset      x0, x1, [x2]  // encoding: [0x41,0x30,0x20,0xf8]
92*9880d681SAndroid Build Coastguard Worker//CHECK: ldsmaxa    w0, w1, [x2]  // encoding: [0x41,0x40,0xa0,0xb8]
93*9880d681SAndroid Build Coastguard Worker//CHECK: ldsminlb   w0, w1, [x2]  // encoding: [0x41,0x50,0x60,0x38]
94*9880d681SAndroid Build Coastguard Worker//CHECK: ldumaxalh  w0, w1, [x2]  // encoding: [0x41,0x60,0xe0,0x78]
95*9880d681SAndroid Build Coastguard Worker//CHECK: ldumin     w0, w1, [x2]  // encoding: [0x41,0x70,0x20,0xb8]
96*9880d681SAndroid Build Coastguard Worker//CHECK: ldsminb    w2, w3, [x5]  // encoding: [0xa3,0x50,0x22,0x38]
97*9880d681SAndroid Build Coastguard Worker
98*9880d681SAndroid Build Coastguard Worker  // ST<OP> intructions: aliases to LD<OP>
99*9880d681SAndroid Build Coastguard Worker  stADDlb w0, [x2]
100*9880d681SAndroid Build Coastguard Worker  stclrlh w0, [x2]
101*9880d681SAndroid Build Coastguard Worker  steorl  w0, [x2]
102*9880d681SAndroid Build Coastguard Worker  stsetl  x0, [x2]
103*9880d681SAndroid Build Coastguard Worker  stsmaxb  w0, [x2]
104*9880d681SAndroid Build Coastguard Worker  stsminh  w0, [x2]
105*9880d681SAndroid Build Coastguard Worker  stumax   w0, [x2]
106*9880d681SAndroid Build Coastguard Worker  stumin   x0, [x2]
107*9880d681SAndroid Build Coastguard Worker  stsminl x29, [sp]
108*9880d681SAndroid Build Coastguard Worker//CHECK: staddlb    w0, [x2]  // encoding: [0x5f,0x00,0x60,0x38]
109*9880d681SAndroid Build Coastguard Worker//CHECK: stclrlh    w0, [x2]  // encoding: [0x5f,0x10,0x60,0x78]
110*9880d681SAndroid Build Coastguard Worker//CHECK: steorl     w0, [x2]  // encoding: [0x5f,0x20,0x60,0xb8]
111*9880d681SAndroid Build Coastguard Worker//CHECK: stsetl     x0, [x2]  // encoding: [0x5f,0x30,0x60,0xf8]
112*9880d681SAndroid Build Coastguard Worker//CHECK: stsmaxb     w0, [x2]  // encoding: [0x5f,0x40,0x20,0x38]
113*9880d681SAndroid Build Coastguard Worker//CHECK: stsminh     w0, [x2]  // encoding: [0x5f,0x50,0x20,0x78]
114*9880d681SAndroid Build Coastguard Worker//CHECK: stumax      w0, [x2]  // encoding: [0x5f,0x60,0x20,0xb8]
115*9880d681SAndroid Build Coastguard Worker//CHECK: stumin      x0, [x2]  // encoding: [0x5f,0x70,0x20,0xf8]
116*9880d681SAndroid Build Coastguard Worker//CHECK: stsminl     x29, [sp] // encoding: [0xff,0x53,0x7d,0xf8]
117*9880d681SAndroid Build Coastguard Worker
118*9880d681SAndroid Build Coastguard Worker
119*9880d681SAndroid Build Coastguard Worker  ldsmax x0, x1, [w2]
120*9880d681SAndroid Build Coastguard Worker  ldeorl w0, w1, [w2]
121*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
122*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   ldsmax x0, x1, [w2]
123*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                   ^
124*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
125*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   ldeorl w0, w1, [w2]
126*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                   ^
127*9880d681SAndroid Build Coastguard Worker
128*9880d681SAndroid Build Coastguard Worker  //SWP instruction
129*9880d681SAndroid Build Coastguard Worker  swp   x0, x1, [x2]
130*9880d681SAndroid Build Coastguard Worker  swpb  w0, w1, [x2]
131*9880d681SAndroid Build Coastguard Worker  swplh w0, w1, [x2]
132*9880d681SAndroid Build Coastguard Worker  swpal x0, x1, [sp]
133*9880d681SAndroid Build Coastguard Worker//CHECK: swp   x0, x1, [x2]       // encoding: [0x41,0x80,0x20,0xf8]
134*9880d681SAndroid Build Coastguard Worker//CHECK: swpb  w0, w1, [x2]       // encoding: [0x41,0x80,0x20,0x38]
135*9880d681SAndroid Build Coastguard Worker//CHECK: swplh w0, w1, [x2]       // encoding: [0x41,0x80,0x60,0x78]
136*9880d681SAndroid Build Coastguard Worker//CHECK: swpal x0, x1, [sp]       // encoding: [0xe1,0x83,0xe0,0xf8]
137*9880d681SAndroid Build Coastguard Worker
138*9880d681SAndroid Build Coastguard Worker  swp   x0, x1, [w2]
139*9880d681SAndroid Build Coastguard Worker  swp   x0, x1, [xzr]
140*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
141*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   swp   x0, x1, [w2]
142*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                  ^
143*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
144*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:   swp   x0, x1, [xzr]
145*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                  ^
146*9880d681SAndroid Build Coastguard Worker
147*9880d681SAndroid Build Coastguard Worker  //CASP instruction
148*9880d681SAndroid Build Coastguard Worker  casp x0, x1, x2, x3, [x4]
149*9880d681SAndroid Build Coastguard Worker  casp w0, w1, w2, w3, [x4]
150*9880d681SAndroid Build Coastguard Worker//CHECK: casp x0, x1, x2, x3, [x4]      // encoding: [0x82,0x7c,0x20,0x48]
151*9880d681SAndroid Build Coastguard Worker//CHECK: casp w0, w1, w2, w3, [x4]      // encoding: [0x82,0x7c,0x20,0x08]
152*9880d681SAndroid Build Coastguard Worker
153*9880d681SAndroid Build Coastguard Worker  casp x1, x2, x4, x5, [x6]
154*9880d681SAndroid Build Coastguard Worker  casp x0, x1, x3, x4, [x5]
155*9880d681SAndroid Build Coastguard Worker  casp x0, x2, x4, x5, [x6]
156*9880d681SAndroid Build Coastguard Worker  casp x0, x1, x2, x4, [x5]
157*9880d681SAndroid Build Coastguard Worker  casp x0, w1, x2, x3, [x5]
158*9880d681SAndroid Build Coastguard Worker  casp w0, x1, x2, x3, [x5]
159*9880d681SAndroid Build Coastguard Worker  casp w0, x1, w2, w3, [x5]
160*9880d681SAndroid Build Coastguard Worker  casp x0, x1, w2, w3, [x5]
161*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected first even register of a consecutive same-size even/odd register pair
162*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x1, x2, x4, x5, [x6]
163*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:       ^
164*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected first even register of a consecutive same-size even/odd register pair
165*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x0, x1, x3, x4, [x5]
166*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:               ^
167*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error:  expected second odd register of a consecutive same-size even/odd register pair
168*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x0, x2, x4, x5, [x6]
169*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:           ^
170*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected second odd register of a consecutive same-size even/odd register pair
171*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x0, x1, x2, x4, [x5]
172*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:                   ^
173*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected second odd register of a consecutive same-size even/odd register pair
174*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x0, w1, x2, x3, [x5]
175*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:           ^
176*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected second odd register of a consecutive same-size even/odd register pair
177*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp w0, x1, x2, x3, [x5]
178*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:           ^
179*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: expected second odd register of a consecutive same-size even/odd register pair
180*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp w0, x1, w2, w3, [x5]
181*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:           ^
182*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR: error: invalid operand for instruction
183*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:  casp x0, x1, w2, w3, [x5]
184*9880d681SAndroid Build Coastguard Worker//CHECK-ERROR:               ^
185