1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -global-isel -global-isel-abort=1 -stop-after=aarch64-expand-pseudo -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,CHECK-NOLSE
3 ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -global-isel -global-isel-abort=1 -stop-after=aarch64-expand-pseudo -mattr=+rcpc -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,CHECK-LDAPR
5 define i32 @val_compare_and_swap(ptr %p, i32 %cmp, i32 %new) {
6 ; CHECK-LABEL: name: val_compare_and_swap
7 ; CHECK: bb.0 (%ir-block.0):
8 ; CHECK-NEXT: successors: %bb.1(0x80000000)
9 ; CHECK-NEXT: liveins: $w1, $w2, $x0
12 ; CHECK-NEXT: bb.1.cmpxchg.start:
13 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
14 ; CHECK-NEXT: liveins: $w1, $w2, $x0
16 ; CHECK-NEXT: renamable $w8 = LDAXRW renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s32) from %ir.p)
17 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w8, renamable $w1, 0, implicit-def $nzcv, pcsections !0
18 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
20 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
21 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
22 ; CHECK-NEXT: liveins: $w1, $w2, $x0, $x8
24 ; CHECK-NEXT: early-clobber renamable $w9 = STXRW renamable $w2, renamable $x0, pcsections !0 :: (volatile store (s32) into %ir.p)
25 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
28 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
29 ; CHECK-NEXT: successors: %bb.4(0x80000000)
30 ; CHECK-NEXT: liveins: $x8
32 ; CHECK-NEXT: CLREX 15, pcsections !0
34 ; CHECK-NEXT: bb.4.cmpxchg.end:
35 ; CHECK-NEXT: liveins: $x8
37 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
38 ; CHECK-NEXT: RET undef $lr, implicit $w0
39 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acquire acquire, !pcsections !0
40 %val = extractvalue { i32, i1 } %pair, 0
44 define i32 @val_compare_and_swap_from_load(ptr %p, i32 %cmp, ptr %pnew) {
45 ; CHECK-LABEL: name: val_compare_and_swap_from_load
46 ; CHECK: bb.0 (%ir-block.0):
47 ; CHECK-NEXT: successors: %bb.1(0x80000000)
48 ; CHECK-NEXT: liveins: $w1, $x0, $x2
50 ; CHECK-NEXT: renamable $w9 = LDRWui killed renamable $x2, 0, implicit-def $x9, pcsections !0 :: (load (s32) from %ir.pnew)
52 ; CHECK-NEXT: bb.1.cmpxchg.start:
53 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
54 ; CHECK-NEXT: liveins: $w1, $x0, $x9
56 ; CHECK-NEXT: renamable $w8 = LDAXRW renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s32) from %ir.p)
57 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w8, renamable $w1, 0, implicit-def $nzcv, pcsections !0
58 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
60 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
61 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
62 ; CHECK-NEXT: liveins: $w1, $x0, $x8, $x9
64 ; CHECK-NEXT: early-clobber renamable $w10 = STXRW renamable $w9, renamable $x0, pcsections !0 :: (volatile store (s32) into %ir.p)
65 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1
68 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
69 ; CHECK-NEXT: successors: %bb.4(0x80000000)
70 ; CHECK-NEXT: liveins: $x8
72 ; CHECK-NEXT: CLREX 15, pcsections !0
74 ; CHECK-NEXT: bb.4.cmpxchg.end:
75 ; CHECK-NEXT: liveins: $x8
77 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
78 ; CHECK-NEXT: RET undef $lr, implicit $w0
79 %new = load i32, ptr %pnew, !pcsections !0
80 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acquire acquire, !pcsections !0
81 %val = extractvalue { i32, i1 } %pair, 0
85 define i32 @val_compare_and_swap_rel(ptr %p, i32 %cmp, i32 %new) {
86 ; CHECK-LABEL: name: val_compare_and_swap_rel
87 ; CHECK: bb.0 (%ir-block.0):
88 ; CHECK-NEXT: successors: %bb.1(0x80000000)
89 ; CHECK-NEXT: liveins: $w1, $w2, $x0
92 ; CHECK-NEXT: bb.1.cmpxchg.start:
93 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
94 ; CHECK-NEXT: liveins: $w1, $w2, $x0
96 ; CHECK-NEXT: renamable $w8 = LDAXRW renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s32) from %ir.p)
97 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w8, renamable $w1, 0, implicit-def $nzcv, pcsections !0
98 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
100 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
101 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
102 ; CHECK-NEXT: liveins: $w1, $w2, $x0, $x8
104 ; CHECK-NEXT: early-clobber renamable $w9 = STLXRW renamable $w2, renamable $x0, pcsections !0 :: (volatile store (s32) into %ir.p)
105 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
106 ; CHECK-NEXT: B %bb.4
108 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
109 ; CHECK-NEXT: successors: %bb.4(0x80000000)
110 ; CHECK-NEXT: liveins: $x8
112 ; CHECK-NEXT: CLREX 15, pcsections !0
114 ; CHECK-NEXT: bb.4.cmpxchg.end:
115 ; CHECK-NEXT: liveins: $x8
117 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
118 ; CHECK-NEXT: RET undef $lr, implicit $w0
119 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acq_rel monotonic, !pcsections !0
120 %val = extractvalue { i32, i1 } %pair, 0
124 define i64 @val_compare_and_swap_64(ptr %p, i64 %cmp, i64 %new) {
125 ; CHECK-LABEL: name: val_compare_and_swap_64
126 ; CHECK: bb.0 (%ir-block.0):
127 ; CHECK-NEXT: successors: %bb.1(0x80000000)
128 ; CHECK-NEXT: liveins: $x0, $x1, $x2
131 ; CHECK-NEXT: bb.1.cmpxchg.start:
132 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
133 ; CHECK-NEXT: liveins: $x0, $x1, $x2
135 ; CHECK-NEXT: renamable $x8 = LDXRX renamable $x0, pcsections !0 :: (volatile load (s64) from %ir.p)
136 ; CHECK-NEXT: $xzr = SUBSXrs renamable $x8, renamable $x1, 0, implicit-def $nzcv, pcsections !0
137 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
139 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
140 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
141 ; CHECK-NEXT: liveins: $x0, $x1, $x2, $x8
143 ; CHECK-NEXT: early-clobber renamable $w9 = STXRX renamable $x2, renamable $x0, pcsections !0 :: (volatile store (s64) into %ir.p)
144 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
145 ; CHECK-NEXT: B %bb.4
147 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
148 ; CHECK-NEXT: successors: %bb.4(0x80000000)
149 ; CHECK-NEXT: liveins: $x8
151 ; CHECK-NEXT: CLREX 15, pcsections !0
153 ; CHECK-NEXT: bb.4.cmpxchg.end:
154 ; CHECK-NEXT: liveins: $x8
156 ; CHECK-NEXT: $x0 = ORRXrs $xzr, killed $x8, 0
157 ; CHECK-NEXT: RET undef $lr, implicit $x0
158 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new monotonic monotonic, !pcsections !0
159 %val = extractvalue { i64, i1 } %pair, 0
163 define i64 @val_compare_and_swap_64_monotonic_seqcst(ptr %p, i64 %cmp, i64 %new) {
164 ; CHECK-LABEL: name: val_compare_and_swap_64_monotonic_seqcst
165 ; CHECK: bb.0 (%ir-block.0):
166 ; CHECK-NEXT: successors: %bb.1(0x80000000)
167 ; CHECK-NEXT: liveins: $x0, $x1, $x2
170 ; CHECK-NEXT: bb.1.cmpxchg.start:
171 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
172 ; CHECK-NEXT: liveins: $x0, $x1, $x2
174 ; CHECK-NEXT: renamable $x8 = LDAXRX renamable $x0, pcsections !0 :: (volatile load (s64) from %ir.p)
175 ; CHECK-NEXT: $xzr = SUBSXrs renamable $x8, renamable $x1, 0, implicit-def $nzcv, pcsections !0
176 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
178 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
179 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
180 ; CHECK-NEXT: liveins: $x0, $x1, $x2, $x8
182 ; CHECK-NEXT: early-clobber renamable $w9 = STLXRX renamable $x2, renamable $x0, pcsections !0 :: (volatile store (s64) into %ir.p)
183 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
184 ; CHECK-NEXT: B %bb.4
186 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
187 ; CHECK-NEXT: successors: %bb.4(0x80000000)
188 ; CHECK-NEXT: liveins: $x8
190 ; CHECK-NEXT: CLREX 15, pcsections !0
192 ; CHECK-NEXT: bb.4.cmpxchg.end:
193 ; CHECK-NEXT: liveins: $x8
195 ; CHECK-NEXT: $x0 = ORRXrs $xzr, killed $x8, 0
196 ; CHECK-NEXT: RET undef $lr, implicit $x0
197 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new monotonic seq_cst, !pcsections !0
198 %val = extractvalue { i64, i1 } %pair, 0
202 define i64 @val_compare_and_swap_64_release_acquire(ptr %p, i64 %cmp, i64 %new) {
203 ; CHECK-LABEL: name: val_compare_and_swap_64_release_acquire
204 ; CHECK: bb.0 (%ir-block.0):
205 ; CHECK-NEXT: successors: %bb.1(0x80000000)
206 ; CHECK-NEXT: liveins: $x0, $x1, $x2
209 ; CHECK-NEXT: bb.1.cmpxchg.start:
210 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
211 ; CHECK-NEXT: liveins: $x0, $x1, $x2
213 ; CHECK-NEXT: renamable $x8 = LDAXRX renamable $x0, pcsections !0 :: (volatile load (s64) from %ir.p)
214 ; CHECK-NEXT: $xzr = SUBSXrs renamable $x8, renamable $x1, 0, implicit-def $nzcv, pcsections !0
215 ; CHECK-NEXT: Bcc 1, %bb.3, implicit killed $nzcv, pcsections !0
217 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
218 ; CHECK-NEXT: successors: %bb.4(0x04000000), %bb.1(0x7c000000)
219 ; CHECK-NEXT: liveins: $x0, $x1, $x2, $x8
221 ; CHECK-NEXT: early-clobber renamable $w9 = STLXRX renamable $x2, renamable $x0, pcsections !0 :: (volatile store (s64) into %ir.p)
222 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
223 ; CHECK-NEXT: B %bb.4
225 ; CHECK-NEXT: bb.3.cmpxchg.nostore:
226 ; CHECK-NEXT: successors: %bb.4(0x80000000)
227 ; CHECK-NEXT: liveins: $x8
229 ; CHECK-NEXT: CLREX 15, pcsections !0
231 ; CHECK-NEXT: bb.4.cmpxchg.end:
232 ; CHECK-NEXT: liveins: $x8
234 ; CHECK-NEXT: $x0 = ORRXrs $xzr, killed $x8, 0
235 ; CHECK-NEXT: RET undef $lr, implicit $x0
236 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new release acquire, !pcsections !0
237 %val = extractvalue { i64, i1 } %pair, 0
241 define i32 @fetch_and_nand(ptr %p) {
242 ; CHECK-LABEL: name: fetch_and_nand
243 ; CHECK: bb.0 (%ir-block.0):
244 ; CHECK-NEXT: successors: %bb.1(0x80000000)
245 ; CHECK-NEXT: liveins: $x0
248 ; CHECK-NEXT: bb.1.atomicrmw.start:
249 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
250 ; CHECK-NEXT: liveins: $x0
252 ; CHECK-NEXT: renamable $w8 = LDXRW renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s32) from %ir.p)
253 ; CHECK-NEXT: renamable $w9 = ANDWri renamable $w8, 2, pcsections !0
254 ; CHECK-NEXT: $w9 = ORNWrs $wzr, killed renamable $w9, 0, pcsections !0
255 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRW killed renamable $w9, renamable $x0, pcsections !0 :: (volatile store (s32) into %ir.p)
256 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
258 ; CHECK-NEXT: bb.2.atomicrmw.end:
259 ; CHECK-NEXT: liveins: $x8
261 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
262 ; CHECK-NEXT: RET undef $lr, implicit $w0
263 %val = atomicrmw nand ptr %p, i32 7 release, !pcsections !0
267 define i64 @fetch_and_nand_64(ptr %p) {
268 ; CHECK-LABEL: name: fetch_and_nand_64
269 ; CHECK: bb.0 (%ir-block.0):
270 ; CHECK-NEXT: successors: %bb.1(0x80000000)
271 ; CHECK-NEXT: liveins: $x0
274 ; CHECK-NEXT: bb.1.atomicrmw.start:
275 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
276 ; CHECK-NEXT: liveins: $x0
278 ; CHECK-NEXT: renamable $x8 = LDAXRX renamable $x0, pcsections !0 :: (volatile load (s64) from %ir.p)
279 ; CHECK-NEXT: renamable $x9 = ANDXri renamable $x8, 4098, pcsections !0
280 ; CHECK-NEXT: $x9 = ORNXrs $xzr, killed renamable $x9, 0, pcsections !0
281 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRX killed renamable $x9, renamable $x0, pcsections !0 :: (volatile store (s64) into %ir.p)
282 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
284 ; CHECK-NEXT: bb.2.atomicrmw.end:
285 ; CHECK-NEXT: liveins: $x8
287 ; CHECK-NEXT: $x0 = ORRXrs $xzr, killed $x8, 0
288 ; CHECK-NEXT: RET undef $lr, implicit $x0
289 %val = atomicrmw nand ptr %p, i64 7 acq_rel, !pcsections !0
293 define i32 @fetch_and_or(ptr %p) {
294 ; CHECK-LABEL: name: fetch_and_or
295 ; CHECK: bb.0 (%ir-block.0):
296 ; CHECK-NEXT: successors: %bb.1(0x80000000)
297 ; CHECK-NEXT: liveins: $x0
299 ; CHECK-NEXT: renamable $w9 = MOVZWi 5, 0
301 ; CHECK-NEXT: bb.1.atomicrmw.start:
302 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
303 ; CHECK-NEXT: liveins: $w9, $x0
305 ; CHECK-NEXT: renamable $w8 = LDAXRW renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s32) from %ir.p)
306 ; CHECK-NEXT: $w10 = ORRWrs renamable $w8, renamable $w9, 0, pcsections !0
307 ; CHECK-NEXT: early-clobber renamable $w11 = STLXRW killed renamable $w10, renamable $x0, pcsections !0 :: (volatile store (s32) into %ir.p)
308 ; CHECK-NEXT: CBNZW killed renamable $w11, %bb.1, pcsections !0
310 ; CHECK-NEXT: bb.2.atomicrmw.end:
311 ; CHECK-NEXT: liveins: $x8
313 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
314 ; CHECK-NEXT: RET undef $lr, implicit $w0
315 %val = atomicrmw or ptr %p, i32 5 seq_cst, !pcsections !0
319 define i64 @fetch_and_or_64(ptr %p) {
320 ; CHECK-LABEL: name: fetch_and_or_64
321 ; CHECK: bb.0 (%ir-block.0):
322 ; CHECK-NEXT: successors: %bb.1(0x80000000)
323 ; CHECK-NEXT: liveins: $x0
326 ; CHECK-NEXT: bb.1.atomicrmw.start:
327 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
328 ; CHECK-NEXT: liveins: $x0
330 ; CHECK-NEXT: renamable $x8 = LDXRX renamable $x0, pcsections !0 :: (volatile load (s64) from %ir.p)
331 ; CHECK-NEXT: renamable $x9 = ORRXri renamable $x8, 4098, pcsections !0
332 ; CHECK-NEXT: early-clobber renamable $w10 = STXRX killed renamable $x9, renamable $x0, pcsections !0 :: (volatile store (s64) into %ir.p)
333 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
335 ; CHECK-NEXT: bb.2.atomicrmw.end:
336 ; CHECK-NEXT: liveins: $x8
338 ; CHECK-NEXT: $x0 = ORRXrs $xzr, killed $x8, 0
339 ; CHECK-NEXT: RET undef $lr, implicit $x0
340 %val = atomicrmw or ptr %p, i64 7 monotonic, !pcsections !0
344 define void @acquire_fence() {
345 ; CHECK-LABEL: name: acquire_fence
346 ; CHECK: bb.0 (%ir-block.0):
347 ; CHECK-NEXT: DMB 9, pcsections !0
348 ; CHECK-NEXT: RET undef $lr
349 fence acquire, !pcsections !0
353 define void @release_fence() {
354 ; CHECK-LABEL: name: release_fence
355 ; CHECK: bb.0 (%ir-block.0):
356 ; CHECK-NEXT: DMB 11, pcsections !0
357 ; CHECK-NEXT: RET undef $lr
358 fence release, !pcsections !0
362 define void @seq_cst_fence() {
363 ; CHECK-LABEL: name: seq_cst_fence
364 ; CHECK: bb.0 (%ir-block.0):
365 ; CHECK-NEXT: DMB 11, pcsections !0
366 ; CHECK-NEXT: RET undef $lr
367 fence seq_cst, !pcsections !0
371 define i32 @atomic_load(ptr %p) {
372 ; CHECK-LABEL: name: atomic_load
373 ; CHECK: bb.0 (%ir-block.0):
374 ; CHECK-NEXT: liveins: $x0
376 ; CHECK-NEXT: renamable $w0 = LDARW killed renamable $x0, pcsections !0 :: (load seq_cst (s32) from %ir.p)
377 ; CHECK-NEXT: RET undef $lr, implicit $w0
378 %r = load atomic i32, ptr %p seq_cst, align 4, !pcsections !0
382 define i8 @atomic_load_relaxed_8(ptr %p, i32 %off32) {
383 ; CHECK-LABEL: name: atomic_load_relaxed_8
384 ; CHECK: bb.0 (%ir-block.0):
385 ; CHECK-NEXT: liveins: $w1, $x0
387 ; CHECK-NEXT: renamable $w8 = LDRBBui renamable $x0, 4095, pcsections !0 :: (load monotonic (s8) from %ir.ptr_unsigned)
388 ; CHECK-NEXT: renamable $w9 = LDRBBroW renamable $x0, killed renamable $w1, 1, 0, pcsections !0 :: (load unordered (s8) from %ir.ptr_regoff)
389 ; CHECK-NEXT: renamable $w10 = LDURBBi renamable $x0, -256, pcsections !0 :: (load monotonic (s8) from %ir.ptr_unscaled)
390 ; CHECK-NEXT: renamable $x11 = ADDXri killed renamable $x0, 291, 12
391 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
392 ; CHECK-NEXT: renamable $w9 = LDRBBui killed renamable $x11, 0, pcsections !0 :: (load unordered (s8) from %ir.ptr_random)
393 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w10, 0, pcsections !0
394 ; CHECK-NEXT: $w0 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
395 ; CHECK-NEXT: RET undef $lr, implicit $w0
396 %ptr_unsigned = getelementptr i8, ptr %p, i32 4095
397 %val_unsigned = load atomic i8, ptr %ptr_unsigned monotonic, align 1, !pcsections !0
399 %ptr_regoff = getelementptr i8, ptr %p, i32 %off32
400 %val_regoff = load atomic i8, ptr %ptr_regoff unordered, align 1, !pcsections !0
401 %tot1 = add i8 %val_unsigned, %val_regoff, !pcsections !0
403 %ptr_unscaled = getelementptr i8, ptr %p, i32 -256
404 %val_unscaled = load atomic i8, ptr %ptr_unscaled monotonic, align 1, !pcsections !0
405 %tot2 = add i8 %tot1, %val_unscaled, !pcsections !0
407 %ptr_random = getelementptr i8, ptr %p, i32 1191936 ; 0x123000 (i.e. ADD imm)
408 %val_random = load atomic i8, ptr %ptr_random unordered, align 1, !pcsections !0
409 %tot3 = add i8 %tot2, %val_random, !pcsections !0
414 define i16 @atomic_load_relaxed_16(ptr %p, i32 %off32) {
415 ; CHECK-LABEL: name: atomic_load_relaxed_16
416 ; CHECK: bb.0 (%ir-block.0):
417 ; CHECK-NEXT: liveins: $w1, $x0
419 ; CHECK-NEXT: renamable $w8 = LDRHHui renamable $x0, 4095, pcsections !0 :: (load monotonic (s16) from %ir.ptr_unsigned)
420 ; CHECK-NEXT: renamable $w9 = LDRHHroW renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (load unordered (s16) from %ir.ptr_regoff)
421 ; CHECK-NEXT: renamable $w10 = LDURHHi renamable $x0, -256, pcsections !0 :: (load monotonic (s16) from %ir.ptr_unscaled)
422 ; CHECK-NEXT: renamable $x11 = ADDXri killed renamable $x0, 291, 12
423 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
424 ; CHECK-NEXT: renamable $w9 = LDRHHui killed renamable $x11, 0, pcsections !0 :: (load unordered (s16) from %ir.ptr_random)
425 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w10, 0, pcsections !0
426 ; CHECK-NEXT: $w0 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
427 ; CHECK-NEXT: RET undef $lr, implicit $w0
428 %ptr_unsigned = getelementptr i16, ptr %p, i32 4095
429 %val_unsigned = load atomic i16, ptr %ptr_unsigned monotonic, align 2, !pcsections !0
431 %ptr_regoff = getelementptr i16, ptr %p, i32 %off32
432 %val_regoff = load atomic i16, ptr %ptr_regoff unordered, align 2, !pcsections !0
433 %tot1 = add i16 %val_unsigned, %val_regoff, !pcsections !0
435 %ptr_unscaled = getelementptr i16, ptr %p, i32 -128
436 %val_unscaled = load atomic i16, ptr %ptr_unscaled monotonic, align 2, !pcsections !0
437 %tot2 = add i16 %tot1, %val_unscaled, !pcsections !0
439 %ptr_random = getelementptr i16, ptr %p, i32 595968 ; 0x123000/2 (i.e. ADD imm)
440 %val_random = load atomic i16, ptr %ptr_random unordered, align 2, !pcsections !0
441 %tot3 = add i16 %tot2, %val_random, !pcsections !0
446 define i32 @atomic_load_relaxed_32(ptr %p, i32 %off32) {
447 ; CHECK-LABEL: name: atomic_load_relaxed_32
448 ; CHECK: bb.0 (%ir-block.0):
449 ; CHECK-NEXT: liveins: $w1, $x0
451 ; CHECK-NEXT: renamable $w8 = LDRWui renamable $x0, 4095, pcsections !0 :: (load monotonic (s32) from %ir.ptr_unsigned)
452 ; CHECK-NEXT: renamable $w9 = LDRWroW renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (load unordered (s32) from %ir.ptr_regoff)
453 ; CHECK-NEXT: renamable $w10 = LDURWi renamable $x0, -256, pcsections !0 :: (load monotonic (s32) from %ir.ptr_unscaled)
454 ; CHECK-NEXT: renamable $x11 = ADDXri killed renamable $x0, 291, 12
455 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
456 ; CHECK-NEXT: renamable $w9 = LDRWui killed renamable $x11, 0, pcsections !0 :: (load unordered (s32) from %ir.ptr_random)
457 ; CHECK-NEXT: $w8 = ADDWrs killed renamable $w8, killed renamable $w10, 0, pcsections !0
458 ; CHECK-NEXT: $w0 = ADDWrs killed renamable $w8, killed renamable $w9, 0, pcsections !0
459 ; CHECK-NEXT: RET undef $lr, implicit $w0
460 %ptr_unsigned = getelementptr i32, ptr %p, i32 4095
461 %val_unsigned = load atomic i32, ptr %ptr_unsigned monotonic, align 4, !pcsections !0
463 %ptr_regoff = getelementptr i32, ptr %p, i32 %off32
464 %val_regoff = load atomic i32, ptr %ptr_regoff unordered, align 4, !pcsections !0
465 %tot1 = add i32 %val_unsigned, %val_regoff, !pcsections !0
467 %ptr_unscaled = getelementptr i32, ptr %p, i32 -64
468 %val_unscaled = load atomic i32, ptr %ptr_unscaled monotonic, align 4, !pcsections !0
469 %tot2 = add i32 %tot1, %val_unscaled, !pcsections !0
471 %ptr_random = getelementptr i32, ptr %p, i32 297984 ; 0x123000/4 (i.e. ADD imm)
472 %val_random = load atomic i32, ptr %ptr_random unordered, align 4, !pcsections !0
473 %tot3 = add i32 %tot2, %val_random, !pcsections !0
478 define i64 @atomic_load_relaxed_64(ptr %p, i32 %off32) {
479 ; CHECK-LABEL: name: atomic_load_relaxed_64
480 ; CHECK: bb.0 (%ir-block.0):
481 ; CHECK-NEXT: liveins: $w1, $x0
483 ; CHECK-NEXT: renamable $x8 = LDRXui renamable $x0, 4095, pcsections !0 :: (load monotonic (s64) from %ir.ptr_unsigned)
484 ; CHECK-NEXT: renamable $x9 = LDRXroW renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (load unordered (s64) from %ir.ptr_regoff)
485 ; CHECK-NEXT: renamable $x10 = LDURXi renamable $x0, -256, pcsections !0 :: (load monotonic (s64) from %ir.ptr_unscaled)
486 ; CHECK-NEXT: renamable $x11 = ADDXri killed renamable $x0, 291, 12
487 ; CHECK-NEXT: $x8 = ADDXrs killed renamable $x8, killed renamable $x9, 0, pcsections !0
488 ; CHECK-NEXT: renamable $x9 = LDRXui killed renamable $x11, 0, pcsections !0 :: (load unordered (s64) from %ir.ptr_random)
489 ; CHECK-NEXT: $x8 = ADDXrs killed renamable $x8, killed renamable $x10, 0, pcsections !0
490 ; CHECK-NEXT: $x0 = ADDXrs killed renamable $x8, killed renamable $x9, 0, pcsections !0
491 ; CHECK-NEXT: RET undef $lr, implicit $x0
492 %ptr_unsigned = getelementptr i64, ptr %p, i32 4095
493 %val_unsigned = load atomic i64, ptr %ptr_unsigned monotonic, align 8, !pcsections !0
495 %ptr_regoff = getelementptr i64, ptr %p, i32 %off32
496 %val_regoff = load atomic i64, ptr %ptr_regoff unordered, align 8, !pcsections !0
497 %tot1 = add i64 %val_unsigned, %val_regoff, !pcsections !0
499 %ptr_unscaled = getelementptr i64, ptr %p, i32 -32
500 %val_unscaled = load atomic i64, ptr %ptr_unscaled monotonic, align 8, !pcsections !0
501 %tot2 = add i64 %tot1, %val_unscaled, !pcsections !0
503 %ptr_random = getelementptr i64, ptr %p, i32 148992 ; 0x123000/8 (i.e. ADD imm)
504 %val_random = load atomic i64, ptr %ptr_random unordered, align 8, !pcsections !0
505 %tot3 = add i64 %tot2, %val_random, !pcsections !0
511 define void @atomc_store(ptr %p) {
512 ; CHECK-LABEL: name: atomc_store
513 ; CHECK: bb.0 (%ir-block.0):
514 ; CHECK-NEXT: liveins: $x0
516 ; CHECK-NEXT: renamable $w8 = MOVZWi 4, 0
517 ; CHECK-NEXT: STLRW killed renamable $w8, killed renamable $x0, pcsections !0 :: (store seq_cst (s32) into %ir.p)
518 ; CHECK-NEXT: RET undef $lr
519 store atomic i32 4, ptr %p seq_cst, align 4, !pcsections !0
523 define void @atomic_store_relaxed_8(ptr %p, i32 %off32, i8 %val) {
524 ; CHECK-LABEL: name: atomic_store_relaxed_8
525 ; CHECK: bb.0 (%ir-block.0):
526 ; CHECK-NEXT: liveins: $w1, $w2, $x0
528 ; CHECK-NEXT: STRBBui renamable $w2, renamable $x0, 4095, pcsections !0 :: (store monotonic (s8) into %ir.ptr_unsigned)
529 ; CHECK-NEXT: STRBBroW renamable $w2, renamable $x0, killed renamable $w1, 1, 0, pcsections !0 :: (store unordered (s8) into %ir.ptr_regoff)
530 ; CHECK-NEXT: STURBBi renamable $w2, renamable $x0, -256, pcsections !0 :: (store monotonic (s8) into %ir.ptr_unscaled)
531 ; CHECK-NEXT: renamable $x8 = ADDXri killed renamable $x0, 291, 12
532 ; CHECK-NEXT: STRBBui killed renamable $w2, killed renamable $x8, 0, pcsections !0 :: (store unordered (s8) into %ir.ptr_random)
533 ; CHECK-NEXT: RET undef $lr
534 %ptr_unsigned = getelementptr i8, ptr %p, i32 4095
535 store atomic i8 %val, ptr %ptr_unsigned monotonic, align 1, !pcsections !0
537 %ptr_regoff = getelementptr i8, ptr %p, i32 %off32
538 store atomic i8 %val, ptr %ptr_regoff unordered, align 1, !pcsections !0
540 %ptr_unscaled = getelementptr i8, ptr %p, i32 -256
541 store atomic i8 %val, ptr %ptr_unscaled monotonic, align 1, !pcsections !0
543 %ptr_random = getelementptr i8, ptr %p, i32 1191936 ; 0x123000 (i.e. ADD imm)
544 store atomic i8 %val, ptr %ptr_random unordered, align 1, !pcsections !0
549 define void @atomic_store_relaxed_16(ptr %p, i32 %off32, i16 %val) {
550 ; CHECK-LABEL: name: atomic_store_relaxed_16
551 ; CHECK: bb.0 (%ir-block.0):
552 ; CHECK-NEXT: liveins: $w1, $w2, $x0
554 ; CHECK-NEXT: STRHHui renamable $w2, renamable $x0, 4095, pcsections !0 :: (store monotonic (s16) into %ir.ptr_unsigned)
555 ; CHECK-NEXT: STRHHroW renamable $w2, renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (store unordered (s16) into %ir.ptr_regoff)
556 ; CHECK-NEXT: STURHHi renamable $w2, renamable $x0, -256, pcsections !0 :: (store monotonic (s16) into %ir.ptr_unscaled)
557 ; CHECK-NEXT: renamable $x8 = ADDXri killed renamable $x0, 291, 12
558 ; CHECK-NEXT: STRHHui killed renamable $w2, killed renamable $x8, 0, pcsections !0 :: (store unordered (s16) into %ir.ptr_random)
559 ; CHECK-NEXT: RET undef $lr
560 %ptr_unsigned = getelementptr i16, ptr %p, i32 4095
561 store atomic i16 %val, ptr %ptr_unsigned monotonic, align 2, !pcsections !0
563 %ptr_regoff = getelementptr i16, ptr %p, i32 %off32
564 store atomic i16 %val, ptr %ptr_regoff unordered, align 2, !pcsections !0
566 %ptr_unscaled = getelementptr i16, ptr %p, i32 -128
567 store atomic i16 %val, ptr %ptr_unscaled monotonic, align 2, !pcsections !0
569 %ptr_random = getelementptr i16, ptr %p, i32 595968 ; 0x123000/2 (i.e. ADD imm)
570 store atomic i16 %val, ptr %ptr_random unordered, align 2, !pcsections !0
575 define void @atomic_store_relaxed_32(ptr %p, i32 %off32, i32 %val) {
576 ; CHECK-LABEL: name: atomic_store_relaxed_32
577 ; CHECK: bb.0 (%ir-block.0):
578 ; CHECK-NEXT: liveins: $w1, $w2, $x0
580 ; CHECK-NEXT: STRWui renamable $w2, renamable $x0, 4095, pcsections !0 :: (store monotonic (s32) into %ir.ptr_unsigned)
581 ; CHECK-NEXT: STRWroW renamable $w2, renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (store unordered (s32) into %ir.ptr_regoff)
582 ; CHECK-NEXT: STURWi renamable $w2, renamable $x0, -256, pcsections !0 :: (store monotonic (s32) into %ir.ptr_unscaled)
583 ; CHECK-NEXT: renamable $x8 = ADDXri killed renamable $x0, 291, 12
584 ; CHECK-NEXT: STRWui killed renamable $w2, killed renamable $x8, 0, pcsections !0 :: (store unordered (s32) into %ir.ptr_random)
585 ; CHECK-NEXT: RET undef $lr
586 %ptr_unsigned = getelementptr i32, ptr %p, i32 4095
587 store atomic i32 %val, ptr %ptr_unsigned monotonic, align 4, !pcsections !0
589 %ptr_regoff = getelementptr i32, ptr %p, i32 %off32
590 store atomic i32 %val, ptr %ptr_regoff unordered, align 4, !pcsections !0
592 %ptr_unscaled = getelementptr i32, ptr %p, i32 -64
593 store atomic i32 %val, ptr %ptr_unscaled monotonic, align 4, !pcsections !0
595 %ptr_random = getelementptr i32, ptr %p, i32 297984 ; 0x123000/4 (i.e. ADD imm)
596 store atomic i32 %val, ptr %ptr_random unordered, align 4, !pcsections !0
601 define void @atomic_store_relaxed_64(ptr %p, i32 %off32, i64 %val) {
602 ; CHECK-LABEL: name: atomic_store_relaxed_64
603 ; CHECK: bb.0 (%ir-block.0):
604 ; CHECK-NEXT: liveins: $w1, $x0, $x2
606 ; CHECK-NEXT: STRXui renamable $x2, renamable $x0, 4095, pcsections !0 :: (store monotonic (s64) into %ir.ptr_unsigned)
607 ; CHECK-NEXT: STRXroW renamable $x2, renamable $x0, killed renamable $w1, 1, 1, pcsections !0 :: (store unordered (s64) into %ir.ptr_regoff)
608 ; CHECK-NEXT: STURXi renamable $x2, renamable $x0, -256, pcsections !0 :: (store monotonic (s64) into %ir.ptr_unscaled)
609 ; CHECK-NEXT: renamable $x8 = ADDXri killed renamable $x0, 291, 12
610 ; CHECK-NEXT: STRXui killed renamable $x2, killed renamable $x8, 0, pcsections !0 :: (store unordered (s64) into %ir.ptr_random)
611 ; CHECK-NEXT: RET undef $lr
612 %ptr_unsigned = getelementptr i64, ptr %p, i32 4095
613 store atomic i64 %val, ptr %ptr_unsigned monotonic, align 8, !pcsections !0
615 %ptr_regoff = getelementptr i64, ptr %p, i32 %off32
616 store atomic i64 %val, ptr %ptr_regoff unordered, align 8, !pcsections !0
618 %ptr_unscaled = getelementptr i64, ptr %p, i32 -32
619 store atomic i64 %val, ptr %ptr_unscaled monotonic, align 8, !pcsections !0
621 %ptr_random = getelementptr i64, ptr %p, i32 148992 ; 0x123000/8 (i.e. ADD imm)
622 store atomic i64 %val, ptr %ptr_random unordered, align 8, !pcsections !0
627 define i32 @load_zext(ptr %p8, ptr %p16) {
628 ; CHECK-NOLSE-LABEL: name: load_zext
629 ; CHECK-NOLSE: bb.0 (%ir-block.0):
630 ; CHECK-NOLSE-NEXT: liveins: $x0, $x1
631 ; CHECK-NOLSE-NEXT: {{ $}}
632 ; CHECK-NOLSE-NEXT: renamable $w8 = LDARB killed renamable $x0, pcsections !0 :: (load acquire (s8) from %ir.p8)
633 ; CHECK-NOLSE-NEXT: renamable $w9 = LDRHHui killed renamable $x1, 0, pcsections !0 :: (load unordered (s16) from %ir.p16)
634 ; CHECK-NOLSE-NEXT: renamable $w0 = ADDWrx killed renamable $w9, killed renamable $w8, 0, pcsections !0
635 ; CHECK-NOLSE-NEXT: RET undef $lr, implicit $w0
637 ; CHECK-LDAPR-LABEL: name: load_zext
638 ; CHECK-LDAPR: bb.0 (%ir-block.0):
639 ; CHECK-LDAPR-NEXT: liveins: $x0, $x1
640 ; CHECK-LDAPR-NEXT: {{ $}}
641 ; CHECK-LDAPR-NEXT: renamable $w8 = LDAPRB killed renamable $x0, pcsections !0 :: (load acquire (s8) from %ir.p8)
642 ; CHECK-LDAPR-NEXT: renamable $w9 = LDRHHui killed renamable $x1, 0, pcsections !0 :: (load unordered (s16) from %ir.p16)
643 ; CHECK-LDAPR-NEXT: renamable $w0 = ADDWrx killed renamable $w9, killed renamable $w8, 0, pcsections !0
644 ; CHECK-LDAPR-NEXT: RET undef $lr, implicit $w0
645 %val1.8 = load atomic i8, ptr %p8 acquire, align 1, !pcsections !0
646 %val1 = zext i8 %val1.8 to i32
648 %val2.16 = load atomic i16, ptr %p16 unordered, align 2, !pcsections !0
649 %val2 = zext i16 %val2.16 to i32
651 %res = add i32 %val1, %val2, !pcsections !0
655 define { i32, i64 } @load_acq(ptr %p32, ptr %p64) {
656 ; CHECK-NOLSE-LABEL: name: load_acq
657 ; CHECK-NOLSE: bb.0 (%ir-block.0):
658 ; CHECK-NOLSE-NEXT: liveins: $x0, $x1
659 ; CHECK-NOLSE-NEXT: {{ $}}
660 ; CHECK-NOLSE-NEXT: renamable $w0 = LDARW killed renamable $x0, pcsections !0 :: (load seq_cst (s32) from %ir.p32)
661 ; CHECK-NOLSE-NEXT: renamable $x1 = LDARX killed renamable $x1, pcsections !0 :: (load acquire (s64) from %ir.p64)
662 ; CHECK-NOLSE-NEXT: RET undef $lr, implicit $w0, implicit $x1
664 ; CHECK-LDAPR-LABEL: name: load_acq
665 ; CHECK-LDAPR: bb.0 (%ir-block.0):
666 ; CHECK-LDAPR-NEXT: liveins: $x0, $x1
667 ; CHECK-LDAPR-NEXT: {{ $}}
668 ; CHECK-LDAPR-NEXT: renamable $w0 = LDARW killed renamable $x0, pcsections !0 :: (load seq_cst (s32) from %ir.p32)
669 ; CHECK-LDAPR-NEXT: renamable $x1 = LDAPRX killed renamable $x1, pcsections !0 :: (load acquire (s64) from %ir.p64)
670 ; CHECK-LDAPR-NEXT: RET undef $lr, implicit $w0, implicit $x1
671 %val32 = load atomic i32, ptr %p32 seq_cst, align 4, !pcsections !0
672 %tmp = insertvalue { i32, i64 } undef, i32 %val32, 0
674 %val64 = load atomic i64, ptr %p64 acquire, align 8, !pcsections !0
675 %res = insertvalue { i32, i64 } %tmp, i64 %val64, 1
677 ret { i32, i64 } %res
680 define i32 @load_sext(ptr %p8, ptr %p16) {
681 ; CHECK-NOLSE-LABEL: name: load_sext
682 ; CHECK-NOLSE: bb.0 (%ir-block.0):
683 ; CHECK-NOLSE-NEXT: liveins: $x0, $x1
684 ; CHECK-NOLSE-NEXT: {{ $}}
685 ; CHECK-NOLSE-NEXT: renamable $w8 = LDARB killed renamable $x0, pcsections !0 :: (load acquire (s8) from %ir.p8)
686 ; CHECK-NOLSE-NEXT: renamable $w9 = LDRHHui killed renamable $x1, 0, pcsections !0 :: (load unordered (s16) from %ir.p16)
687 ; CHECK-NOLSE-NEXT: renamable $w9 = SBFMWri killed renamable $w9, 0, 15
688 ; CHECK-NOLSE-NEXT: renamable $w0 = ADDWrx killed renamable $w9, killed renamable $w8, 32, pcsections !0
689 ; CHECK-NOLSE-NEXT: RET undef $lr, implicit $w0
691 ; CHECK-LDAPR-LABEL: name: load_sext
692 ; CHECK-LDAPR: bb.0 (%ir-block.0):
693 ; CHECK-LDAPR-NEXT: liveins: $x0, $x1
694 ; CHECK-LDAPR-NEXT: {{ $}}
695 ; CHECK-LDAPR-NEXT: renamable $w8 = LDAPRB killed renamable $x0, pcsections !0 :: (load acquire (s8) from %ir.p8)
696 ; CHECK-LDAPR-NEXT: renamable $w9 = LDRHHui killed renamable $x1, 0, pcsections !0 :: (load unordered (s16) from %ir.p16)
697 ; CHECK-LDAPR-NEXT: renamable $w9 = SBFMWri killed renamable $w9, 0, 15
698 ; CHECK-LDAPR-NEXT: renamable $w0 = ADDWrx killed renamable $w9, killed renamable $w8, 32, pcsections !0
699 ; CHECK-LDAPR-NEXT: RET undef $lr, implicit $w0
700 %val1.8 = load atomic i8, ptr %p8 acquire, align 1, !pcsections !0
701 %val1 = sext i8 %val1.8 to i32
703 %val2.16 = load atomic i16, ptr %p16 unordered, align 2, !pcsections !0
704 %val2 = sext i16 %val2.16 to i32
706 %res = add i32 %val1, %val2, !pcsections !0
710 define void @store_trunc(i32 %val, ptr %p8, ptr %p16) {
711 ; CHECK-LABEL: name: store_trunc
712 ; CHECK: bb.0 (%ir-block.0):
713 ; CHECK-NEXT: liveins: $w0, $x1, $x2
715 ; CHECK-NEXT: STLRB renamable $w0, killed renamable $x1, pcsections !0 :: (store seq_cst (s8) into %ir.p8)
716 ; CHECK-NEXT: STRHHui killed renamable $w0, killed renamable $x2, 0, pcsections !0 :: (store monotonic (s16) into %ir.p16)
717 ; CHECK-NEXT: RET undef $lr
718 %val8 = trunc i32 %val to i8
719 store atomic i8 %val8, ptr %p8 seq_cst, align 1, !pcsections !0
721 %val16 = trunc i32 %val to i16
722 store atomic i16 %val16, ptr %p16 monotonic, align 2, !pcsections !0
727 define i8 @atomicrmw_add_i8(ptr %ptr, i8 %rhs) {
728 ; CHECK-LABEL: name: atomicrmw_add_i8
729 ; CHECK: bb.0 (%ir-block.0):
730 ; CHECK-NEXT: successors: %bb.1(0x80000000)
731 ; CHECK-NEXT: liveins: $w1, $x0
734 ; CHECK-NEXT: bb.1.atomicrmw.start:
735 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
736 ; CHECK-NEXT: liveins: $w1, $x0
738 ; CHECK-NEXT: renamable $w8 = LDAXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
739 ; CHECK-NEXT: $w9 = ADDWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
740 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
741 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
743 ; CHECK-NEXT: bb.2.atomicrmw.end:
744 ; CHECK-NEXT: liveins: $x8
746 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
747 ; CHECK-NEXT: RET undef $lr, implicit $w0
748 %res = atomicrmw add ptr %ptr, i8 %rhs seq_cst, !pcsections !0
752 define i8 @atomicrmw_xchg_i8(ptr %ptr, i8 %rhs) {
753 ; CHECK-LABEL: name: atomicrmw_xchg_i8
754 ; CHECK: bb.0 (%ir-block.0):
755 ; CHECK-NEXT: successors: %bb.1(0x80000000)
756 ; CHECK-NEXT: liveins: $w1, $x0
758 ; CHECK-NEXT: renamable $w1 = KILL $w1, implicit-def $x1
760 ; CHECK-NEXT: bb.1.atomicrmw.start:
761 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
762 ; CHECK-NEXT: liveins: $x0, $x1
764 ; CHECK-NEXT: renamable $w8 = LDXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
765 ; CHECK-NEXT: early-clobber renamable $w9 = STXRB renamable $w1, renamable $x0, pcsections !0 :: (volatile store (s8) into %ir.ptr)
766 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1, pcsections !0
768 ; CHECK-NEXT: bb.2.atomicrmw.end:
769 ; CHECK-NEXT: liveins: $x8
771 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
772 ; CHECK-NEXT: RET undef $lr, implicit $w0
773 %res = atomicrmw xchg ptr %ptr, i8 %rhs monotonic, !pcsections !0
777 define i8 @atomicrmw_sub_i8(ptr %ptr, i8 %rhs) {
778 ; CHECK-LABEL: name: atomicrmw_sub_i8
779 ; CHECK: bb.0 (%ir-block.0):
780 ; CHECK-NEXT: successors: %bb.1(0x80000000)
781 ; CHECK-NEXT: liveins: $w1, $x0
784 ; CHECK-NEXT: bb.1.atomicrmw.start:
785 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
786 ; CHECK-NEXT: liveins: $w1, $x0
788 ; CHECK-NEXT: renamable $w8 = LDAXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
789 ; CHECK-NEXT: $w9 = SUBWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
790 ; CHECK-NEXT: early-clobber renamable $w10 = STXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
791 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
793 ; CHECK-NEXT: bb.2.atomicrmw.end:
794 ; CHECK-NEXT: liveins: $x8
796 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
797 ; CHECK-NEXT: RET undef $lr, implicit $w0
798 %res = atomicrmw sub ptr %ptr, i8 %rhs acquire, !pcsections !0
802 define i8 @atomicrmw_and_i8(ptr %ptr, i8 %rhs) {
803 ; CHECK-LABEL: name: atomicrmw_and_i8
804 ; CHECK: bb.0 (%ir-block.0):
805 ; CHECK-NEXT: successors: %bb.1(0x80000000)
806 ; CHECK-NEXT: liveins: $w1, $x0
809 ; CHECK-NEXT: bb.1.atomicrmw.start:
810 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
811 ; CHECK-NEXT: liveins: $w1, $x0
813 ; CHECK-NEXT: renamable $w8 = LDXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
814 ; CHECK-NEXT: $w9 = ANDWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
815 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
816 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
818 ; CHECK-NEXT: bb.2.atomicrmw.end:
819 ; CHECK-NEXT: liveins: $x8
821 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
822 ; CHECK-NEXT: RET undef $lr, implicit $w0
823 %res = atomicrmw and ptr %ptr, i8 %rhs release, !pcsections !0
827 define i8 @atomicrmw_or_i8(ptr %ptr, i8 %rhs) {
828 ; CHECK-LABEL: name: atomicrmw_or_i8
829 ; CHECK: bb.0 (%ir-block.0):
830 ; CHECK-NEXT: successors: %bb.1(0x80000000)
831 ; CHECK-NEXT: liveins: $w1, $x0
834 ; CHECK-NEXT: bb.1.atomicrmw.start:
835 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
836 ; CHECK-NEXT: liveins: $w1, $x0
838 ; CHECK-NEXT: renamable $w8 = LDAXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
839 ; CHECK-NEXT: $w9 = ORRWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
840 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
841 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
843 ; CHECK-NEXT: bb.2.atomicrmw.end:
844 ; CHECK-NEXT: liveins: $x8
846 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
847 ; CHECK-NEXT: RET undef $lr, implicit $w0
848 %res = atomicrmw or ptr %ptr, i8 %rhs seq_cst, !pcsections !0
852 define i8 @atomicrmw_xor_i8(ptr %ptr, i8 %rhs) {
853 ; CHECK-LABEL: name: atomicrmw_xor_i8
854 ; CHECK: bb.0 (%ir-block.0):
855 ; CHECK-NEXT: successors: %bb.1(0x80000000)
856 ; CHECK-NEXT: liveins: $w1, $x0
859 ; CHECK-NEXT: bb.1.atomicrmw.start:
860 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
861 ; CHECK-NEXT: liveins: $w1, $x0
863 ; CHECK-NEXT: renamable $w8 = LDXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
864 ; CHECK-NEXT: $w9 = EORWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
865 ; CHECK-NEXT: early-clobber renamable $w10 = STXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
866 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
868 ; CHECK-NEXT: bb.2.atomicrmw.end:
869 ; CHECK-NEXT: liveins: $x8
871 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
872 ; CHECK-NEXT: RET undef $lr, implicit $w0
873 %res = atomicrmw xor ptr %ptr, i8 %rhs monotonic, !pcsections !0
877 define i8 @atomicrmw_min_i8(ptr %ptr, i8 %rhs) {
878 ; CHECK-LABEL: name: atomicrmw_min_i8
879 ; CHECK: bb.0 (%ir-block.0):
880 ; CHECK-NEXT: successors: %bb.1(0x80000000)
881 ; CHECK-NEXT: liveins: $w1, $x0
884 ; CHECK-NEXT: bb.1.atomicrmw.start:
885 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
886 ; CHECK-NEXT: liveins: $w1, $x0
888 ; CHECK-NEXT: renamable $w8 = LDAXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
889 ; CHECK-NEXT: renamable $w9 = SBFMWri renamable $w8, 0, 7, pcsections !0
890 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 32, implicit-def $nzcv, pcsections !0
891 ; CHECK-NEXT: renamable $w9 = CSELWr renamable $w8, renamable $w1, 13, implicit killed $nzcv, implicit-def $x9, pcsections !0
892 ; CHECK-NEXT: early-clobber renamable $w10 = STXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
893 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
895 ; CHECK-NEXT: bb.2.atomicrmw.end:
896 ; CHECK-NEXT: liveins: $x8
898 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
899 ; CHECK-NEXT: RET undef $lr, implicit $w0
900 %res = atomicrmw min ptr %ptr, i8 %rhs acquire, !pcsections !0
904 define i8 @atomicrmw_max_i8(ptr %ptr, i8 %rhs) {
905 ; CHECK-LABEL: name: atomicrmw_max_i8
906 ; CHECK: bb.0 (%ir-block.0):
907 ; CHECK-NEXT: successors: %bb.1(0x80000000)
908 ; CHECK-NEXT: liveins: $w1, $x0
911 ; CHECK-NEXT: bb.1.atomicrmw.start:
912 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
913 ; CHECK-NEXT: liveins: $w1, $x0
915 ; CHECK-NEXT: renamable $w8 = LDXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
916 ; CHECK-NEXT: renamable $w9 = SBFMWri renamable $w8, 0, 7, pcsections !0
917 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 32, implicit-def $nzcv, pcsections !0
918 ; CHECK-NEXT: renamable $w9 = CSELWr renamable $w8, renamable $w1, 12, implicit killed $nzcv, implicit-def $x9, pcsections !0
919 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRB renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s8) into %ir.ptr)
920 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
922 ; CHECK-NEXT: bb.2.atomicrmw.end:
923 ; CHECK-NEXT: liveins: $x8
925 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
926 ; CHECK-NEXT: RET undef $lr, implicit $w0
927 %res = atomicrmw max ptr %ptr, i8 %rhs release, !pcsections !0
931 define i8 @atomicrmw_umin_i8(ptr %ptr, i8 %rhs) {
932 ; CHECK-LABEL: name: atomicrmw_umin_i8
933 ; CHECK: bb.0 (%ir-block.0):
934 ; CHECK-NEXT: successors: %bb.1(0x80000000)
935 ; CHECK-NEXT: liveins: $w1, $x0
937 ; CHECK-NEXT: renamable $w9 = ANDWri killed renamable $w1, 7
939 ; CHECK-NEXT: bb.1.atomicrmw.start:
940 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
941 ; CHECK-NEXT: liveins: $w9, $x0
943 ; CHECK-NEXT: renamable $w8 = LDAXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
944 ; CHECK-NEXT: renamable $w10 = ANDWri renamable $w8, 7
945 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w10, renamable $w9, 0, implicit-def $nzcv, pcsections !0
946 ; CHECK-NEXT: renamable $w10 = CSELWr killed renamable $w10, renamable $w9, 9, implicit killed $nzcv, implicit-def $x10, pcsections !0
947 ; CHECK-NEXT: early-clobber renamable $w11 = STLXRB renamable $w10, renamable $x0, implicit killed $x10, pcsections !0 :: (volatile store (s8) into %ir.ptr)
948 ; CHECK-NEXT: CBNZW killed renamable $w11, %bb.1, pcsections !0
950 ; CHECK-NEXT: bb.2.atomicrmw.end:
951 ; CHECK-NEXT: liveins: $x8
953 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
954 ; CHECK-NEXT: RET undef $lr, implicit $w0
955 %res = atomicrmw umin ptr %ptr, i8 %rhs seq_cst, !pcsections !0
959 define i8 @atomicrmw_umax_i8(ptr %ptr, i8 %rhs) {
960 ; CHECK-LABEL: name: atomicrmw_umax_i8
961 ; CHECK: bb.0 (%ir-block.0):
962 ; CHECK-NEXT: successors: %bb.1(0x80000000)
963 ; CHECK-NEXT: liveins: $w1, $x0
965 ; CHECK-NEXT: renamable $w9 = ANDWri killed renamable $w1, 7
967 ; CHECK-NEXT: bb.1.atomicrmw.start:
968 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
969 ; CHECK-NEXT: liveins: $w9, $x0
971 ; CHECK-NEXT: renamable $w8 = LDXRB renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s8) from %ir.ptr)
972 ; CHECK-NEXT: renamable $w10 = ANDWri renamable $w8, 7
973 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w10, renamable $w9, 0, implicit-def $nzcv, pcsections !0
974 ; CHECK-NEXT: renamable $w10 = CSELWr killed renamable $w10, renamable $w9, 8, implicit killed $nzcv, implicit-def $x10, pcsections !0
975 ; CHECK-NEXT: early-clobber renamable $w11 = STXRB renamable $w10, renamable $x0, implicit killed $x10, pcsections !0 :: (volatile store (s8) into %ir.ptr)
976 ; CHECK-NEXT: CBNZW killed renamable $w11, %bb.1, pcsections !0
978 ; CHECK-NEXT: bb.2.atomicrmw.end:
979 ; CHECK-NEXT: liveins: $x8
981 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
982 ; CHECK-NEXT: RET undef $lr, implicit $w0
983 %res = atomicrmw umax ptr %ptr, i8 %rhs monotonic, !pcsections !0
987 define i16 @atomicrmw_add_i16(ptr %ptr, i16 %rhs) {
988 ; CHECK-LABEL: name: atomicrmw_add_i16
989 ; CHECK: bb.0 (%ir-block.0):
990 ; CHECK-NEXT: successors: %bb.1(0x80000000)
991 ; CHECK-NEXT: liveins: $w1, $x0
994 ; CHECK-NEXT: bb.1.atomicrmw.start:
995 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
996 ; CHECK-NEXT: liveins: $w1, $x0
998 ; CHECK-NEXT: renamable $w8 = LDAXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
999 ; CHECK-NEXT: $w9 = ADDWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
1000 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1001 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1002 ; CHECK-NEXT: {{ $}}
1003 ; CHECK-NEXT: bb.2.atomicrmw.end:
1004 ; CHECK-NEXT: liveins: $x8
1005 ; CHECK-NEXT: {{ $}}
1006 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1007 ; CHECK-NEXT: RET undef $lr, implicit $w0
1008 %res = atomicrmw add ptr %ptr, i16 %rhs seq_cst, !pcsections !0
1012 define i16 @atomicrmw_xchg_i16(ptr %ptr, i16 %rhs) {
1013 ; CHECK-LABEL: name: atomicrmw_xchg_i16
1014 ; CHECK: bb.0 (%ir-block.0):
1015 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1016 ; CHECK-NEXT: liveins: $w1, $x0
1017 ; CHECK-NEXT: {{ $}}
1018 ; CHECK-NEXT: renamable $w1 = KILL $w1, implicit-def $x1
1019 ; CHECK-NEXT: {{ $}}
1020 ; CHECK-NEXT: bb.1.atomicrmw.start:
1021 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1022 ; CHECK-NEXT: liveins: $x0, $x1
1023 ; CHECK-NEXT: {{ $}}
1024 ; CHECK-NEXT: renamable $w8 = LDXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1025 ; CHECK-NEXT: early-clobber renamable $w9 = STXRH renamable $w1, renamable $x0, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1026 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1, pcsections !0
1027 ; CHECK-NEXT: {{ $}}
1028 ; CHECK-NEXT: bb.2.atomicrmw.end:
1029 ; CHECK-NEXT: liveins: $x8
1030 ; CHECK-NEXT: {{ $}}
1031 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1032 ; CHECK-NEXT: RET undef $lr, implicit $w0
1033 %res = atomicrmw xchg ptr %ptr, i16 %rhs monotonic, !pcsections !0
1037 define i16 @atomicrmw_sub_i16(ptr %ptr, i16 %rhs) {
1038 ; CHECK-LABEL: name: atomicrmw_sub_i16
1039 ; CHECK: bb.0 (%ir-block.0):
1040 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1041 ; CHECK-NEXT: liveins: $w1, $x0
1042 ; CHECK-NEXT: {{ $}}
1043 ; CHECK-NEXT: {{ $}}
1044 ; CHECK-NEXT: bb.1.atomicrmw.start:
1045 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1046 ; CHECK-NEXT: liveins: $w1, $x0
1047 ; CHECK-NEXT: {{ $}}
1048 ; CHECK-NEXT: renamable $w8 = LDAXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1049 ; CHECK-NEXT: $w9 = SUBWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
1050 ; CHECK-NEXT: early-clobber renamable $w10 = STXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1051 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1052 ; CHECK-NEXT: {{ $}}
1053 ; CHECK-NEXT: bb.2.atomicrmw.end:
1054 ; CHECK-NEXT: liveins: $x8
1055 ; CHECK-NEXT: {{ $}}
1056 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1057 ; CHECK-NEXT: RET undef $lr, implicit $w0
1058 %res = atomicrmw sub ptr %ptr, i16 %rhs acquire, !pcsections !0
1062 define i16 @atomicrmw_and_i16(ptr %ptr, i16 %rhs) {
1063 ; CHECK-LABEL: name: atomicrmw_and_i16
1064 ; CHECK: bb.0 (%ir-block.0):
1065 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1066 ; CHECK-NEXT: liveins: $w1, $x0
1067 ; CHECK-NEXT: {{ $}}
1068 ; CHECK-NEXT: {{ $}}
1069 ; CHECK-NEXT: bb.1.atomicrmw.start:
1070 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1071 ; CHECK-NEXT: liveins: $w1, $x0
1072 ; CHECK-NEXT: {{ $}}
1073 ; CHECK-NEXT: renamable $w8 = LDXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1074 ; CHECK-NEXT: $w9 = ANDWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
1075 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1076 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1077 ; CHECK-NEXT: {{ $}}
1078 ; CHECK-NEXT: bb.2.atomicrmw.end:
1079 ; CHECK-NEXT: liveins: $x8
1080 ; CHECK-NEXT: {{ $}}
1081 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1082 ; CHECK-NEXT: RET undef $lr, implicit $w0
1083 %res = atomicrmw and ptr %ptr, i16 %rhs release, !pcsections !0
1087 define i16 @atomicrmw_or_i16(ptr %ptr, i16 %rhs) {
1088 ; CHECK-LABEL: name: atomicrmw_or_i16
1089 ; CHECK: bb.0 (%ir-block.0):
1090 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1091 ; CHECK-NEXT: liveins: $w1, $x0
1092 ; CHECK-NEXT: {{ $}}
1093 ; CHECK-NEXT: {{ $}}
1094 ; CHECK-NEXT: bb.1.atomicrmw.start:
1095 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1096 ; CHECK-NEXT: liveins: $w1, $x0
1097 ; CHECK-NEXT: {{ $}}
1098 ; CHECK-NEXT: renamable $w8 = LDAXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1099 ; CHECK-NEXT: $w9 = ORRWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
1100 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1101 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1102 ; CHECK-NEXT: {{ $}}
1103 ; CHECK-NEXT: bb.2.atomicrmw.end:
1104 ; CHECK-NEXT: liveins: $x8
1105 ; CHECK-NEXT: {{ $}}
1106 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1107 ; CHECK-NEXT: RET undef $lr, implicit $w0
1108 %res = atomicrmw or ptr %ptr, i16 %rhs seq_cst, !pcsections !0
1112 define i16 @atomicrmw_xor_i16(ptr %ptr, i16 %rhs) {
1113 ; CHECK-LABEL: name: atomicrmw_xor_i16
1114 ; CHECK: bb.0 (%ir-block.0):
1115 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1116 ; CHECK-NEXT: liveins: $w1, $x0
1117 ; CHECK-NEXT: {{ $}}
1118 ; CHECK-NEXT: {{ $}}
1119 ; CHECK-NEXT: bb.1.atomicrmw.start:
1120 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1121 ; CHECK-NEXT: liveins: $w1, $x0
1122 ; CHECK-NEXT: {{ $}}
1123 ; CHECK-NEXT: renamable $w8 = LDXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1124 ; CHECK-NEXT: $w9 = EORWrs renamable $w8, renamable $w1, 0, implicit-def $x9, pcsections !0
1125 ; CHECK-NEXT: early-clobber renamable $w10 = STXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1126 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1127 ; CHECK-NEXT: {{ $}}
1128 ; CHECK-NEXT: bb.2.atomicrmw.end:
1129 ; CHECK-NEXT: liveins: $x8
1130 ; CHECK-NEXT: {{ $}}
1131 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1132 ; CHECK-NEXT: RET undef $lr, implicit $w0
1133 %res = atomicrmw xor ptr %ptr, i16 %rhs monotonic, !pcsections !0
1137 define i16 @atomicrmw_min_i16(ptr %ptr, i16 %rhs) {
1138 ; CHECK-LABEL: name: atomicrmw_min_i16
1139 ; CHECK: bb.0 (%ir-block.0):
1140 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1141 ; CHECK-NEXT: liveins: $w1, $x0
1142 ; CHECK-NEXT: {{ $}}
1143 ; CHECK-NEXT: {{ $}}
1144 ; CHECK-NEXT: bb.1.atomicrmw.start:
1145 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1146 ; CHECK-NEXT: liveins: $w1, $x0
1147 ; CHECK-NEXT: {{ $}}
1148 ; CHECK-NEXT: renamable $w8 = LDAXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1149 ; CHECK-NEXT: renamable $w9 = SBFMWri renamable $w8, 0, 15, pcsections !0
1150 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 40, implicit-def $nzcv, pcsections !0
1151 ; CHECK-NEXT: renamable $w9 = CSELWr renamable $w8, renamable $w1, 13, implicit killed $nzcv, implicit-def $x9, pcsections !0
1152 ; CHECK-NEXT: early-clobber renamable $w10 = STXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1153 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1154 ; CHECK-NEXT: {{ $}}
1155 ; CHECK-NEXT: bb.2.atomicrmw.end:
1156 ; CHECK-NEXT: liveins: $x8
1157 ; CHECK-NEXT: {{ $}}
1158 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1159 ; CHECK-NEXT: RET undef $lr, implicit $w0
1160 %res = atomicrmw min ptr %ptr, i16 %rhs acquire, !pcsections !0
1164 define i16 @atomicrmw_max_i16(ptr %ptr, i16 %rhs) {
1165 ; CHECK-LABEL: name: atomicrmw_max_i16
1166 ; CHECK: bb.0 (%ir-block.0):
1167 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1168 ; CHECK-NEXT: liveins: $w1, $x0
1169 ; CHECK-NEXT: {{ $}}
1170 ; CHECK-NEXT: {{ $}}
1171 ; CHECK-NEXT: bb.1.atomicrmw.start:
1172 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1173 ; CHECK-NEXT: liveins: $w1, $x0
1174 ; CHECK-NEXT: {{ $}}
1175 ; CHECK-NEXT: renamable $w8 = LDXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1176 ; CHECK-NEXT: renamable $w9 = SBFMWri renamable $w8, 0, 15, pcsections !0
1177 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 40, implicit-def $nzcv, pcsections !0
1178 ; CHECK-NEXT: renamable $w9 = CSELWr renamable $w8, renamable $w1, 12, implicit killed $nzcv, implicit-def $x9, pcsections !0
1179 ; CHECK-NEXT: early-clobber renamable $w10 = STLXRH renamable $w9, renamable $x0, implicit killed $x9, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1180 ; CHECK-NEXT: CBNZW killed renamable $w10, %bb.1, pcsections !0
1181 ; CHECK-NEXT: {{ $}}
1182 ; CHECK-NEXT: bb.2.atomicrmw.end:
1183 ; CHECK-NEXT: liveins: $x8
1184 ; CHECK-NEXT: {{ $}}
1185 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1186 ; CHECK-NEXT: RET undef $lr, implicit $w0
1187 %res = atomicrmw max ptr %ptr, i16 %rhs release, !pcsections !0
1191 define i16 @atomicrmw_umin_i16(ptr %ptr, i16 %rhs) {
1192 ; CHECK-LABEL: name: atomicrmw_umin_i16
1193 ; CHECK: bb.0 (%ir-block.0):
1194 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1195 ; CHECK-NEXT: liveins: $w1, $x0
1196 ; CHECK-NEXT: {{ $}}
1197 ; CHECK-NEXT: renamable $w9 = ANDWri killed renamable $w1, 15
1198 ; CHECK-NEXT: {{ $}}
1199 ; CHECK-NEXT: bb.1.atomicrmw.start:
1200 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1201 ; CHECK-NEXT: liveins: $w9, $x0
1202 ; CHECK-NEXT: {{ $}}
1203 ; CHECK-NEXT: renamable $w8 = LDAXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1204 ; CHECK-NEXT: renamable $w10 = ANDWri renamable $w8, 15
1205 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w10, renamable $w9, 0, implicit-def $nzcv, pcsections !0
1206 ; CHECK-NEXT: renamable $w10 = CSELWr killed renamable $w10, renamable $w9, 9, implicit killed $nzcv, implicit-def $x10, pcsections !0
1207 ; CHECK-NEXT: early-clobber renamable $w11 = STLXRH renamable $w10, renamable $x0, implicit killed $x10, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1208 ; CHECK-NEXT: CBNZW killed renamable $w11, %bb.1, pcsections !0
1209 ; CHECK-NEXT: {{ $}}
1210 ; CHECK-NEXT: bb.2.atomicrmw.end:
1211 ; CHECK-NEXT: liveins: $x8
1212 ; CHECK-NEXT: {{ $}}
1213 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1214 ; CHECK-NEXT: RET undef $lr, implicit $w0
1215 %res = atomicrmw umin ptr %ptr, i16 %rhs seq_cst, !pcsections !0
1219 define i16 @atomicrmw_umax_i16(ptr %ptr, i16 %rhs) {
1220 ; CHECK-LABEL: name: atomicrmw_umax_i16
1221 ; CHECK: bb.0 (%ir-block.0):
1222 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1223 ; CHECK-NEXT: liveins: $w1, $x0
1224 ; CHECK-NEXT: {{ $}}
1225 ; CHECK-NEXT: renamable $w9 = ANDWri killed renamable $w1, 15
1226 ; CHECK-NEXT: {{ $}}
1227 ; CHECK-NEXT: bb.1.atomicrmw.start:
1228 ; CHECK-NEXT: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
1229 ; CHECK-NEXT: liveins: $w9, $x0
1230 ; CHECK-NEXT: {{ $}}
1231 ; CHECK-NEXT: renamable $w8 = LDXRH renamable $x0, implicit-def $x8, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1232 ; CHECK-NEXT: renamable $w10 = ANDWri renamable $w8, 15
1233 ; CHECK-NEXT: $wzr = SUBSWrs renamable $w10, renamable $w9, 0, implicit-def $nzcv, pcsections !0
1234 ; CHECK-NEXT: renamable $w10 = CSELWr killed renamable $w10, renamable $w9, 8, implicit killed $nzcv, implicit-def $x10, pcsections !0
1235 ; CHECK-NEXT: early-clobber renamable $w11 = STXRH renamable $w10, renamable $x0, implicit killed $x10, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1236 ; CHECK-NEXT: CBNZW killed renamable $w11, %bb.1, pcsections !0
1237 ; CHECK-NEXT: {{ $}}
1238 ; CHECK-NEXT: bb.2.atomicrmw.end:
1239 ; CHECK-NEXT: liveins: $x8
1240 ; CHECK-NEXT: {{ $}}
1241 ; CHECK-NEXT: $w0 = ORRWrs $wzr, $w8, 0, implicit killed $x8
1242 ; CHECK-NEXT: RET undef $lr, implicit $w0
1243 %res = atomicrmw umax ptr %ptr, i16 %rhs monotonic, !pcsections !0
1247 define { i8, i1 } @cmpxchg_i8(ptr %ptr, i8 %desired, i8 %new) {
1248 ; CHECK-LABEL: name: cmpxchg_i8
1249 ; CHECK: bb.0 (%ir-block.0):
1250 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1251 ; CHECK-NEXT: liveins: $w1, $w2, $x0
1252 ; CHECK-NEXT: {{ $}}
1253 ; CHECK-NEXT: $x8 = ORRXrs $xzr, $x0, 0
1254 ; CHECK-NEXT: renamable $w2 = KILL $w2, implicit-def $x2
1255 ; CHECK-NEXT: {{ $}}
1256 ; CHECK-NEXT: bb.1.cmpxchg.start:
1257 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.4(0x04000000)
1258 ; CHECK-NEXT: liveins: $w1, $x2, $x8
1259 ; CHECK-NEXT: {{ $}}
1260 ; CHECK-NEXT: renamable $w0 = LDXRB renamable $x8, implicit-def $x0, pcsections !0 :: (volatile load (s8) from %ir.ptr)
1261 ; CHECK-NEXT: renamable $w9 = ANDWri renamable $w0, 7, pcsections !0
1262 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 0, implicit-def $nzcv, pcsections !0
1263 ; CHECK-NEXT: Bcc 1, %bb.4, implicit killed $nzcv, pcsections !0
1264 ; CHECK-NEXT: {{ $}}
1265 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
1266 ; CHECK-NEXT: successors: %bb.3(0x04000000), %bb.1(0x7c000000)
1267 ; CHECK-NEXT: liveins: $w1, $x0, $x2, $x8
1268 ; CHECK-NEXT: {{ $}}
1269 ; CHECK-NEXT: early-clobber renamable $w9 = STXRB renamable $w2, renamable $x8, pcsections !0 :: (volatile store (s8) into %ir.ptr)
1270 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
1271 ; CHECK-NEXT: {{ $}}
1273 ; CHECK-NEXT: liveins: $x0
1274 ; CHECK-NEXT: {{ $}}
1275 ; CHECK-NEXT: renamable $w1 = MOVZWi 1, 0
1276 ; CHECK-NEXT: $w0 = KILL renamable $w0, implicit killed $x0
1277 ; CHECK-NEXT: RET undef $lr, implicit $w0, implicit $w1
1278 ; CHECK-NEXT: {{ $}}
1279 ; CHECK-NEXT: bb.4.cmpxchg.nostore:
1280 ; CHECK-NEXT: liveins: $x0
1281 ; CHECK-NEXT: {{ $}}
1282 ; CHECK-NEXT: $w1 = ORRWrs $wzr, $wzr, 0
1283 ; CHECK-NEXT: CLREX 15, pcsections !0
1284 ; CHECK-NEXT: $w0 = KILL renamable $w0, implicit killed $x0
1285 ; CHECK-NEXT: RET undef $lr, implicit $w0, implicit $w1
1286 %res = cmpxchg ptr %ptr, i8 %desired, i8 %new monotonic monotonic, !pcsections !0
1290 define { i16, i1 } @cmpxchg_i16(ptr %ptr, i16 %desired, i16 %new) {
1291 ; CHECK-LABEL: name: cmpxchg_i16
1292 ; CHECK: bb.0 (%ir-block.0):
1293 ; CHECK-NEXT: successors: %bb.1(0x80000000)
1294 ; CHECK-NEXT: liveins: $w1, $w2, $x0
1295 ; CHECK-NEXT: {{ $}}
1296 ; CHECK-NEXT: $x8 = ORRXrs $xzr, $x0, 0
1297 ; CHECK-NEXT: renamable $w2 = KILL $w2, implicit-def $x2
1298 ; CHECK-NEXT: {{ $}}
1299 ; CHECK-NEXT: bb.1.cmpxchg.start:
1300 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.4(0x04000000)
1301 ; CHECK-NEXT: liveins: $w1, $x2, $x8
1302 ; CHECK-NEXT: {{ $}}
1303 ; CHECK-NEXT: renamable $w0 = LDXRH renamable $x8, implicit-def $x0, pcsections !0 :: (volatile load (s16) from %ir.ptr)
1304 ; CHECK-NEXT: renamable $w9 = ANDWri renamable $w0, 15, pcsections !0
1305 ; CHECK-NEXT: dead $wzr = SUBSWrx killed renamable $w9, renamable $w1, 8, implicit-def $nzcv, pcsections !0
1306 ; CHECK-NEXT: Bcc 1, %bb.4, implicit killed $nzcv, pcsections !0
1307 ; CHECK-NEXT: {{ $}}
1308 ; CHECK-NEXT: bb.2.cmpxchg.trystore:
1309 ; CHECK-NEXT: successors: %bb.3(0x04000000), %bb.1(0x7c000000)
1310 ; CHECK-NEXT: liveins: $w1, $x0, $x2, $x8
1311 ; CHECK-NEXT: {{ $}}
1312 ; CHECK-NEXT: early-clobber renamable $w9 = STXRH renamable $w2, renamable $x8, pcsections !0 :: (volatile store (s16) into %ir.ptr)
1313 ; CHECK-NEXT: CBNZW killed renamable $w9, %bb.1
1314 ; CHECK-NEXT: {{ $}}
1316 ; CHECK-NEXT: liveins: $x0
1317 ; CHECK-NEXT: {{ $}}
1318 ; CHECK-NEXT: renamable $w1 = MOVZWi 1, 0
1319 ; CHECK-NEXT: $w0 = KILL renamable $w0, implicit killed $x0
1320 ; CHECK-NEXT: RET undef $lr, implicit $w0, implicit $w1
1321 ; CHECK-NEXT: {{ $}}
1322 ; CHECK-NEXT: bb.4.cmpxchg.nostore:
1323 ; CHECK-NEXT: liveins: $x0
1324 ; CHECK-NEXT: {{ $}}
1325 ; CHECK-NEXT: $w1 = ORRWrs $wzr, $wzr, 0
1326 ; CHECK-NEXT: CLREX 15, pcsections !0
1327 ; CHECK-NEXT: $w0 = KILL renamable $w0, implicit killed $x0
1328 ; CHECK-NEXT: RET undef $lr, implicit $w0, implicit $w1
1329 %res = cmpxchg ptr %ptr, i16 %desired, i16 %new monotonic monotonic, !pcsections !0
1330 ret { i16, i1 } %res