1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-apple-ios -global-isel -global-isel-abort=1 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-NOLSE,CHECK-NOLSE-O1
3 ; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+outline-atomics -global-isel -global-isel-abort=1 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-OUTLINE,CHECK-OUTLINE-O1
4 ; RUN: llc < %s -mtriple=arm64-apple-ios -global-isel -global-isel-abort=1 -O0 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-NOLSE,CHECK-NOLSE-O0
5 ; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+outline-atomics -global-isel -global-isel-abort=1 -O0 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-OUTLINE,CHECK-OUTLINE-O0
6 ; RUN: llc < %s -mtriple=arm64-apple-ios -global-isel -global-isel-abort=1 -mcpu=apple-a13 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-LSE-O1
7 ; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+outline-atomics -global-isel -global-isel-abort=1 -mcpu=apple-a13 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-LSE-O1
8 ; RUN: llc < %s -mtriple=arm64-apple-ios -global-isel -global-isel-abort=1 -mcpu=apple-a13 -O0 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-LSE-O0
9 ; RUN: llc < %s -mtriple=arm64-apple-ios -mattr=+outline-atomics -global-isel -global-isel-abort=1 -mcpu=apple-a13 -O0 -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK-LSE-O0
11 define i32 @val_compare_and_swap(ptr %p, i32 %cmp, i32 %new) #0 {
12 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap:
13 ; CHECK-NOLSE-O1: ; %bb.0:
14 ; CHECK-NOLSE-O1-NEXT: LBB0_1: ; %cmpxchg.start
15 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
16 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
17 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
18 ; CHECK-NOLSE-O1-NEXT: b.ne LBB0_4
19 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
20 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB0_1 Depth=1
21 ; CHECK-NOLSE-O1-NEXT: stxr w9, w2, [x0]
22 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB0_1
23 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
24 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
25 ; CHECK-NOLSE-O1-NEXT: ret
26 ; CHECK-NOLSE-O1-NEXT: LBB0_4: ; %cmpxchg.nostore
27 ; CHECK-NOLSE-O1-NEXT: clrex
28 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
29 ; CHECK-NOLSE-O1-NEXT: ret
31 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap:
32 ; CHECK-OUTLINE-O1: ; %bb.0:
33 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
34 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
35 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
36 ; CHECK-OUTLINE-O1-NEXT: mov w1, w2
37 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
38 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas4_acq
39 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
40 ; CHECK-OUTLINE-O1-NEXT: ret
42 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap:
43 ; CHECK-NOLSE-O0: ; %bb.0:
44 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
45 ; CHECK-NOLSE-O0-NEXT: LBB0_1: ; =>This Inner Loop Header: Depth=1
46 ; CHECK-NOLSE-O0-NEXT: ldaxr w0, [x9]
47 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1
48 ; CHECK-NOLSE-O0-NEXT: b.ne LBB0_3
49 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB0_1 Depth=1
50 ; CHECK-NOLSE-O0-NEXT: stlxr w8, w2, [x9]
51 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB0_1
52 ; CHECK-NOLSE-O0-NEXT: LBB0_3:
53 ; CHECK-NOLSE-O0-NEXT: ret
55 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap:
56 ; CHECK-OUTLINE-O0: ; %bb.0:
57 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
58 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
59 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
60 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
61 ; CHECK-OUTLINE-O0-NEXT: mov w1, w2
62 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
63 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_acq
64 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
65 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
66 ; CHECK-OUTLINE-O0-NEXT: ret
68 ; CHECK-LSE-O1-LABEL: val_compare_and_swap:
69 ; CHECK-LSE-O1: ; %bb.0:
70 ; CHECK-LSE-O1-NEXT: casa w1, w2, [x0]
71 ; CHECK-LSE-O1-NEXT: mov x0, x1
72 ; CHECK-LSE-O1-NEXT: ret
74 ; CHECK-LSE-O0-LABEL: val_compare_and_swap:
75 ; CHECK-LSE-O0: ; %bb.0:
76 ; CHECK-LSE-O0-NEXT: mov x8, x0
77 ; CHECK-LSE-O0-NEXT: mov x0, x1
78 ; CHECK-LSE-O0-NEXT: casa w0, w2, [x8]
79 ; CHECK-LSE-O0-NEXT: ret
80 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acquire acquire
81 %val = extractvalue { i32, i1 } %pair, 0
85 define i32 @val_compare_and_swap_from_load(ptr %p, i32 %cmp, ptr %pnew) #0 {
86 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap_from_load:
87 ; CHECK-NOLSE-O1: ; %bb.0:
88 ; CHECK-NOLSE-O1-NEXT: ldr w9, [x2]
89 ; CHECK-NOLSE-O1-NEXT: LBB1_1: ; %cmpxchg.start
90 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
91 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
92 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
93 ; CHECK-NOLSE-O1-NEXT: b.ne LBB1_4
94 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
95 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB1_1 Depth=1
96 ; CHECK-NOLSE-O1-NEXT: stxr w10, w9, [x0]
97 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB1_1
98 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
99 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
100 ; CHECK-NOLSE-O1-NEXT: ret
101 ; CHECK-NOLSE-O1-NEXT: LBB1_4: ; %cmpxchg.nostore
102 ; CHECK-NOLSE-O1-NEXT: clrex
103 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
104 ; CHECK-NOLSE-O1-NEXT: ret
106 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap_from_load:
107 ; CHECK-OUTLINE-O1: ; %bb.0:
108 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
109 ; CHECK-OUTLINE-O1-NEXT: ldr w8, [x2]
110 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
111 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
112 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
113 ; CHECK-OUTLINE-O1-NEXT: mov w1, w8
114 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas4_acq
115 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
116 ; CHECK-OUTLINE-O1-NEXT: ret
118 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap_from_load:
119 ; CHECK-NOLSE-O0: ; %bb.0:
120 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
121 ; CHECK-NOLSE-O0-NEXT: ldr w10, [x2]
122 ; CHECK-NOLSE-O0-NEXT: LBB1_1: ; =>This Inner Loop Header: Depth=1
123 ; CHECK-NOLSE-O0-NEXT: ldaxr w0, [x9]
124 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1
125 ; CHECK-NOLSE-O0-NEXT: b.ne LBB1_3
126 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB1_1 Depth=1
127 ; CHECK-NOLSE-O0-NEXT: stlxr w8, w10, [x9]
128 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB1_1
129 ; CHECK-NOLSE-O0-NEXT: LBB1_3:
130 ; CHECK-NOLSE-O0-NEXT: ret
132 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap_from_load:
133 ; CHECK-OUTLINE-O0: ; %bb.0:
134 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
135 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
136 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
137 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
138 ; CHECK-OUTLINE-O0-NEXT: mov x8, x2
139 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
140 ; CHECK-OUTLINE-O0-NEXT: ldr w1, [x8]
141 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_acq
142 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
143 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
144 ; CHECK-OUTLINE-O0-NEXT: ret
146 ; CHECK-LSE-O1-LABEL: val_compare_and_swap_from_load:
147 ; CHECK-LSE-O1: ; %bb.0:
148 ; CHECK-LSE-O1-NEXT: ldr w8, [x2]
149 ; CHECK-LSE-O1-NEXT: casa w1, w8, [x0]
150 ; CHECK-LSE-O1-NEXT: mov x0, x1
151 ; CHECK-LSE-O1-NEXT: ret
153 ; CHECK-LSE-O0-LABEL: val_compare_and_swap_from_load:
154 ; CHECK-LSE-O0: ; %bb.0:
155 ; CHECK-LSE-O0-NEXT: mov x9, x0
156 ; CHECK-LSE-O0-NEXT: mov x0, x1
157 ; CHECK-LSE-O0-NEXT: ldr w8, [x2]
158 ; CHECK-LSE-O0-NEXT: casa w0, w8, [x9]
159 ; CHECK-LSE-O0-NEXT: ret
160 %new = load i32, ptr %pnew
161 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acquire acquire
162 %val = extractvalue { i32, i1 } %pair, 0
166 define i32 @val_compare_and_swap_rel(ptr %p, i32 %cmp, i32 %new) #0 {
167 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap_rel:
168 ; CHECK-NOLSE-O1: ; %bb.0:
169 ; CHECK-NOLSE-O1-NEXT: LBB2_1: ; %cmpxchg.start
170 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
171 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
172 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
173 ; CHECK-NOLSE-O1-NEXT: b.ne LBB2_4
174 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
175 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB2_1 Depth=1
176 ; CHECK-NOLSE-O1-NEXT: stlxr w9, w2, [x0]
177 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB2_1
178 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
179 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
180 ; CHECK-NOLSE-O1-NEXT: ret
181 ; CHECK-NOLSE-O1-NEXT: LBB2_4: ; %cmpxchg.nostore
182 ; CHECK-NOLSE-O1-NEXT: clrex
183 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
184 ; CHECK-NOLSE-O1-NEXT: ret
186 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap_rel:
187 ; CHECK-OUTLINE-O1: ; %bb.0:
188 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
189 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
190 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
191 ; CHECK-OUTLINE-O1-NEXT: mov w1, w2
192 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
193 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas4_acq_rel
194 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
195 ; CHECK-OUTLINE-O1-NEXT: ret
197 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap_rel:
198 ; CHECK-NOLSE-O0: ; %bb.0:
199 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
200 ; CHECK-NOLSE-O0-NEXT: LBB2_1: ; =>This Inner Loop Header: Depth=1
201 ; CHECK-NOLSE-O0-NEXT: ldaxr w0, [x9]
202 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1
203 ; CHECK-NOLSE-O0-NEXT: b.ne LBB2_3
204 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB2_1 Depth=1
205 ; CHECK-NOLSE-O0-NEXT: stlxr w8, w2, [x9]
206 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB2_1
207 ; CHECK-NOLSE-O0-NEXT: LBB2_3:
208 ; CHECK-NOLSE-O0-NEXT: ret
210 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap_rel:
211 ; CHECK-OUTLINE-O0: ; %bb.0:
212 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
213 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
214 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
215 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
216 ; CHECK-OUTLINE-O0-NEXT: mov w1, w2
217 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
218 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_acq_rel
219 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
220 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
221 ; CHECK-OUTLINE-O0-NEXT: ret
223 ; CHECK-LSE-O1-LABEL: val_compare_and_swap_rel:
224 ; CHECK-LSE-O1: ; %bb.0:
225 ; CHECK-LSE-O1-NEXT: casal w1, w2, [x0]
226 ; CHECK-LSE-O1-NEXT: mov x0, x1
227 ; CHECK-LSE-O1-NEXT: ret
229 ; CHECK-LSE-O0-LABEL: val_compare_and_swap_rel:
230 ; CHECK-LSE-O0: ; %bb.0:
231 ; CHECK-LSE-O0-NEXT: mov x8, x0
232 ; CHECK-LSE-O0-NEXT: mov x0, x1
233 ; CHECK-LSE-O0-NEXT: casal w0, w2, [x8]
234 ; CHECK-LSE-O0-NEXT: ret
235 %pair = cmpxchg ptr %p, i32 %cmp, i32 %new acq_rel monotonic
236 %val = extractvalue { i32, i1 } %pair, 0
240 define i64 @val_compare_and_swap_64(ptr %p, i64 %cmp, i64 %new) #0 {
241 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap_64:
242 ; CHECK-NOLSE-O1: ; %bb.0:
243 ; CHECK-NOLSE-O1-NEXT: LBB3_1: ; %cmpxchg.start
244 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
245 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
246 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
247 ; CHECK-NOLSE-O1-NEXT: b.ne LBB3_4
248 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
249 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB3_1 Depth=1
250 ; CHECK-NOLSE-O1-NEXT: stxr w9, x2, [x0]
251 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB3_1
252 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
253 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
254 ; CHECK-NOLSE-O1-NEXT: ret
255 ; CHECK-NOLSE-O1-NEXT: LBB3_4: ; %cmpxchg.nostore
256 ; CHECK-NOLSE-O1-NEXT: clrex
257 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
258 ; CHECK-NOLSE-O1-NEXT: ret
260 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap_64:
261 ; CHECK-OUTLINE-O1: ; %bb.0:
262 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
263 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
264 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
265 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
266 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
267 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas8_relax
268 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
269 ; CHECK-OUTLINE-O1-NEXT: ret
271 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap_64:
272 ; CHECK-NOLSE-O0: ; %bb.0:
273 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
274 ; CHECK-NOLSE-O0-NEXT: LBB3_1: ; =>This Inner Loop Header: Depth=1
275 ; CHECK-NOLSE-O0-NEXT: ldaxr x0, [x9]
276 ; CHECK-NOLSE-O0-NEXT: cmp x0, x1
277 ; CHECK-NOLSE-O0-NEXT: b.ne LBB3_3
278 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB3_1 Depth=1
279 ; CHECK-NOLSE-O0-NEXT: stlxr w8, x2, [x9]
280 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB3_1
281 ; CHECK-NOLSE-O0-NEXT: LBB3_3:
282 ; CHECK-NOLSE-O0-NEXT: ret
284 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap_64:
285 ; CHECK-OUTLINE-O0: ; %bb.0:
286 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
287 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
288 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
289 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
290 ; CHECK-OUTLINE-O0-NEXT: mov x1, x2
291 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
292 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_relax
293 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
294 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
295 ; CHECK-OUTLINE-O0-NEXT: ret
297 ; CHECK-LSE-O1-LABEL: val_compare_and_swap_64:
298 ; CHECK-LSE-O1: ; %bb.0:
299 ; CHECK-LSE-O1-NEXT: cas x1, x2, [x0]
300 ; CHECK-LSE-O1-NEXT: mov x0, x1
301 ; CHECK-LSE-O1-NEXT: ret
303 ; CHECK-LSE-O0-LABEL: val_compare_and_swap_64:
304 ; CHECK-LSE-O0: ; %bb.0:
305 ; CHECK-LSE-O0-NEXT: mov x8, x0
306 ; CHECK-LSE-O0-NEXT: mov x0, x1
307 ; CHECK-LSE-O0-NEXT: cas x0, x2, [x8]
308 ; CHECK-LSE-O0-NEXT: ret
309 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new monotonic monotonic
310 %val = extractvalue { i64, i1 } %pair, 0
314 define i64 @val_compare_and_swap_64_monotonic_seqcst(ptr %p, i64 %cmp, i64 %new) #0 {
315 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap_64_monotonic_seqcst:
316 ; CHECK-NOLSE-O1: ; %bb.0:
317 ; CHECK-NOLSE-O1-NEXT: LBB4_1: ; %cmpxchg.start
318 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
319 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
320 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
321 ; CHECK-NOLSE-O1-NEXT: b.ne LBB4_4
322 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
323 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB4_1 Depth=1
324 ; CHECK-NOLSE-O1-NEXT: stlxr w9, x2, [x0]
325 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB4_1
326 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
327 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
328 ; CHECK-NOLSE-O1-NEXT: ret
329 ; CHECK-NOLSE-O1-NEXT: LBB4_4: ; %cmpxchg.nostore
330 ; CHECK-NOLSE-O1-NEXT: clrex
331 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
332 ; CHECK-NOLSE-O1-NEXT: ret
334 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap_64_monotonic_seqcst:
335 ; CHECK-OUTLINE-O1: ; %bb.0:
336 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
337 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
338 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
339 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
340 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
341 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas8_acq_rel
342 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
343 ; CHECK-OUTLINE-O1-NEXT: ret
345 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap_64_monotonic_seqcst:
346 ; CHECK-NOLSE-O0: ; %bb.0:
347 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
348 ; CHECK-NOLSE-O0-NEXT: LBB4_1: ; =>This Inner Loop Header: Depth=1
349 ; CHECK-NOLSE-O0-NEXT: ldaxr x0, [x9]
350 ; CHECK-NOLSE-O0-NEXT: cmp x0, x1
351 ; CHECK-NOLSE-O0-NEXT: b.ne LBB4_3
352 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB4_1 Depth=1
353 ; CHECK-NOLSE-O0-NEXT: stlxr w8, x2, [x9]
354 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB4_1
355 ; CHECK-NOLSE-O0-NEXT: LBB4_3:
356 ; CHECK-NOLSE-O0-NEXT: ret
358 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap_64_monotonic_seqcst:
359 ; CHECK-OUTLINE-O0: ; %bb.0:
360 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
361 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
362 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
363 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
364 ; CHECK-OUTLINE-O0-NEXT: mov x1, x2
365 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
366 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_acq_rel
367 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
368 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
369 ; CHECK-OUTLINE-O0-NEXT: ret
371 ; CHECK-LSE-O1-LABEL: val_compare_and_swap_64_monotonic_seqcst:
372 ; CHECK-LSE-O1: ; %bb.0:
373 ; CHECK-LSE-O1-NEXT: casal x1, x2, [x0]
374 ; CHECK-LSE-O1-NEXT: mov x0, x1
375 ; CHECK-LSE-O1-NEXT: ret
377 ; CHECK-LSE-O0-LABEL: val_compare_and_swap_64_monotonic_seqcst:
378 ; CHECK-LSE-O0: ; %bb.0:
379 ; CHECK-LSE-O0-NEXT: mov x8, x0
380 ; CHECK-LSE-O0-NEXT: mov x0, x1
381 ; CHECK-LSE-O0-NEXT: casal x0, x2, [x8]
382 ; CHECK-LSE-O0-NEXT: ret
383 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new monotonic seq_cst
384 %val = extractvalue { i64, i1 } %pair, 0
388 define i64 @val_compare_and_swap_64_release_acquire(ptr %p, i64 %cmp, i64 %new) #0 {
389 ; CHECK-NOLSE-O1-LABEL: val_compare_and_swap_64_release_acquire:
390 ; CHECK-NOLSE-O1: ; %bb.0:
391 ; CHECK-NOLSE-O1-NEXT: LBB5_1: ; %cmpxchg.start
392 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
393 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
394 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
395 ; CHECK-NOLSE-O1-NEXT: b.ne LBB5_4
396 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
397 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB5_1 Depth=1
398 ; CHECK-NOLSE-O1-NEXT: stlxr w9, x2, [x0]
399 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB5_1
400 ; CHECK-NOLSE-O1-NEXT: ; %bb.3: ; %cmpxchg.end
401 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
402 ; CHECK-NOLSE-O1-NEXT: ret
403 ; CHECK-NOLSE-O1-NEXT: LBB5_4: ; %cmpxchg.nostore
404 ; CHECK-NOLSE-O1-NEXT: clrex
405 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
406 ; CHECK-NOLSE-O1-NEXT: ret
408 ; CHECK-OUTLINE-O1-LABEL: val_compare_and_swap_64_release_acquire:
409 ; CHECK-OUTLINE-O1: ; %bb.0:
410 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
411 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
412 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
413 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
414 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
415 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas8_acq_rel
416 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
417 ; CHECK-OUTLINE-O1-NEXT: ret
419 ; CHECK-NOLSE-O0-LABEL: val_compare_and_swap_64_release_acquire:
420 ; CHECK-NOLSE-O0: ; %bb.0:
421 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
422 ; CHECK-NOLSE-O0-NEXT: LBB5_1: ; =>This Inner Loop Header: Depth=1
423 ; CHECK-NOLSE-O0-NEXT: ldaxr x0, [x9]
424 ; CHECK-NOLSE-O0-NEXT: cmp x0, x1
425 ; CHECK-NOLSE-O0-NEXT: b.ne LBB5_3
426 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB5_1 Depth=1
427 ; CHECK-NOLSE-O0-NEXT: stlxr w8, x2, [x9]
428 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB5_1
429 ; CHECK-NOLSE-O0-NEXT: LBB5_3:
430 ; CHECK-NOLSE-O0-NEXT: ret
432 ; CHECK-OUTLINE-O0-LABEL: val_compare_and_swap_64_release_acquire:
433 ; CHECK-OUTLINE-O0: ; %bb.0:
434 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
435 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
436 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
437 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
438 ; CHECK-OUTLINE-O0-NEXT: mov x1, x2
439 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #8] ; 8-byte Folded Reload
440 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_acq_rel
441 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
442 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
443 ; CHECK-OUTLINE-O0-NEXT: ret
445 ; CHECK-LSE-O1-LABEL: val_compare_and_swap_64_release_acquire:
446 ; CHECK-LSE-O1: ; %bb.0:
447 ; CHECK-LSE-O1-NEXT: casal x1, x2, [x0]
448 ; CHECK-LSE-O1-NEXT: mov x0, x1
449 ; CHECK-LSE-O1-NEXT: ret
451 ; CHECK-LSE-O0-LABEL: val_compare_and_swap_64_release_acquire:
452 ; CHECK-LSE-O0: ; %bb.0:
453 ; CHECK-LSE-O0-NEXT: mov x8, x0
454 ; CHECK-LSE-O0-NEXT: mov x0, x1
455 ; CHECK-LSE-O0-NEXT: casal x0, x2, [x8]
456 ; CHECK-LSE-O0-NEXT: ret
457 %pair = cmpxchg ptr %p, i64 %cmp, i64 %new release acquire
458 %val = extractvalue { i64, i1 } %pair, 0
462 define i32 @fetch_and_nand(ptr %p) #0 {
463 ; CHECK-NOLSE-O1-LABEL: fetch_and_nand:
464 ; CHECK-NOLSE-O1: ; %bb.0:
465 ; CHECK-NOLSE-O1-NEXT: LBB6_1: ; %atomicrmw.start
466 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
467 ; CHECK-NOLSE-O1-NEXT: ldxr w8, [x0]
468 ; CHECK-NOLSE-O1-NEXT: and w9, w8, #0x7
469 ; CHECK-NOLSE-O1-NEXT: mvn w9, w9
470 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
471 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB6_1
472 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
473 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
474 ; CHECK-NOLSE-O1-NEXT: ret
476 ; CHECK-OUTLINE-O1-LABEL: fetch_and_nand:
477 ; CHECK-OUTLINE-O1: ; %bb.0:
478 ; CHECK-OUTLINE-O1-NEXT: LBB6_1: ; %atomicrmw.start
479 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
480 ; CHECK-OUTLINE-O1-NEXT: ldxr w8, [x0]
481 ; CHECK-OUTLINE-O1-NEXT: and w9, w8, #0x7
482 ; CHECK-OUTLINE-O1-NEXT: mvn w9, w9
483 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, w9, [x0]
484 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB6_1
485 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
486 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
487 ; CHECK-OUTLINE-O1-NEXT: ret
489 ; CHECK-NOLSE-O0-LABEL: fetch_and_nand:
490 ; CHECK-NOLSE-O0: ; %bb.0:
491 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
492 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
493 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
494 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
495 ; CHECK-NOLSE-O0-NEXT: b LBB6_1
496 ; CHECK-NOLSE-O0-NEXT: LBB6_1: ; %atomicrmw.start
497 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
498 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB6_2 Depth 2
499 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
500 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
501 ; CHECK-NOLSE-O0-NEXT: and w9, w8, #0x7
502 ; CHECK-NOLSE-O0-NEXT: mvn w12, w9
503 ; CHECK-NOLSE-O0-NEXT: LBB6_2: ; %atomicrmw.start
504 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB6_1 Depth=1
505 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
506 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
507 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
508 ; CHECK-NOLSE-O0-NEXT: b.ne LBB6_4
509 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
510 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB6_2 Depth=2
511 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
512 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB6_2
513 ; CHECK-NOLSE-O0-NEXT: LBB6_4: ; %atomicrmw.start
514 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB6_1 Depth=1
515 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
516 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
517 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
518 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
519 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB6_1
520 ; CHECK-NOLSE-O0-NEXT: b LBB6_5
521 ; CHECK-NOLSE-O0-NEXT: LBB6_5: ; %atomicrmw.end
522 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
523 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
524 ; CHECK-NOLSE-O0-NEXT: ret
526 ; CHECK-OUTLINE-O0-LABEL: fetch_and_nand:
527 ; CHECK-OUTLINE-O0: ; %bb.0:
528 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
529 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
530 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
531 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [x0]
532 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
533 ; CHECK-OUTLINE-O0-NEXT: b LBB6_1
534 ; CHECK-OUTLINE-O0-NEXT: LBB6_1: ; %atomicrmw.start
535 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
536 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
537 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
538 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
539 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0x7
540 ; CHECK-OUTLINE-O0-NEXT: mvn w1, w8
541 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_rel
542 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
543 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w8
544 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
545 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
546 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
547 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB6_1
548 ; CHECK-OUTLINE-O0-NEXT: b LBB6_2
549 ; CHECK-OUTLINE-O0-NEXT: LBB6_2: ; %atomicrmw.end
550 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
551 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
552 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
553 ; CHECK-OUTLINE-O0-NEXT: ret
555 ; CHECK-LSE-O1-LABEL: fetch_and_nand:
556 ; CHECK-LSE-O1: ; %bb.0:
557 ; CHECK-LSE-O1-NEXT: mov x8, x0
558 ; CHECK-LSE-O1-NEXT: ldr w0, [x0]
559 ; CHECK-LSE-O1-NEXT: LBB6_1: ; %atomicrmw.start
560 ; CHECK-LSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
561 ; CHECK-LSE-O1-NEXT: mov x9, x0
562 ; CHECK-LSE-O1-NEXT: and w10, w0, #0x7
563 ; CHECK-LSE-O1-NEXT: mvn w10, w10
564 ; CHECK-LSE-O1-NEXT: casl w0, w10, [x8]
565 ; CHECK-LSE-O1-NEXT: cmp w0, w9
566 ; CHECK-LSE-O1-NEXT: b.ne LBB6_1
567 ; CHECK-LSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
568 ; CHECK-LSE-O1-NEXT: ret
570 ; CHECK-LSE-O0-LABEL: fetch_and_nand:
571 ; CHECK-LSE-O0: ; %bb.0:
572 ; CHECK-LSE-O0-NEXT: sub sp, sp, #32
573 ; CHECK-LSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
574 ; CHECK-LSE-O0-NEXT: ldr w8, [x0]
575 ; CHECK-LSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
576 ; CHECK-LSE-O0-NEXT: b LBB6_1
577 ; CHECK-LSE-O0-NEXT: LBB6_1: ; %atomicrmw.start
578 ; CHECK-LSE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
579 ; CHECK-LSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
580 ; CHECK-LSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
581 ; CHECK-LSE-O0-NEXT: and w9, w8, #0x7
582 ; CHECK-LSE-O0-NEXT: mvn w10, w9
583 ; CHECK-LSE-O0-NEXT: mov x9, x8
584 ; CHECK-LSE-O0-NEXT: casl w9, w10, [x11]
585 ; CHECK-LSE-O0-NEXT: subs w8, w9, w8
586 ; CHECK-LSE-O0-NEXT: cset w8, eq
587 ; CHECK-LSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
588 ; CHECK-LSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
589 ; CHECK-LSE-O0-NEXT: tbz w8, #0, LBB6_1
590 ; CHECK-LSE-O0-NEXT: b LBB6_2
591 ; CHECK-LSE-O0-NEXT: LBB6_2: ; %atomicrmw.end
592 ; CHECK-LSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
593 ; CHECK-LSE-O0-NEXT: add sp, sp, #32
594 ; CHECK-LSE-O0-NEXT: ret
595 %val = atomicrmw nand ptr %p, i32 7 release
599 define i64 @fetch_and_nand_64(ptr %p) #0 {
600 ; CHECK-NOLSE-O1-LABEL: fetch_and_nand_64:
601 ; CHECK-NOLSE-O1: ; %bb.0:
602 ; CHECK-NOLSE-O1-NEXT: LBB7_1: ; %atomicrmw.start
603 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
604 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
605 ; CHECK-NOLSE-O1-NEXT: and x9, x8, #0x7
606 ; CHECK-NOLSE-O1-NEXT: mvn x9, x9
607 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
608 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB7_1
609 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
610 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
611 ; CHECK-NOLSE-O1-NEXT: ret
613 ; CHECK-OUTLINE-O1-LABEL: fetch_and_nand_64:
614 ; CHECK-OUTLINE-O1: ; %bb.0:
615 ; CHECK-OUTLINE-O1-NEXT: LBB7_1: ; %atomicrmw.start
616 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
617 ; CHECK-OUTLINE-O1-NEXT: ldaxr x8, [x0]
618 ; CHECK-OUTLINE-O1-NEXT: and x9, x8, #0x7
619 ; CHECK-OUTLINE-O1-NEXT: mvn x9, x9
620 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, x9, [x0]
621 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB7_1
622 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
623 ; CHECK-OUTLINE-O1-NEXT: mov x0, x8
624 ; CHECK-OUTLINE-O1-NEXT: ret
626 ; CHECK-NOLSE-O0-LABEL: fetch_and_nand_64:
627 ; CHECK-NOLSE-O0: ; %bb.0:
628 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
629 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
630 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
631 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
632 ; CHECK-NOLSE-O0-NEXT: b LBB7_1
633 ; CHECK-NOLSE-O0-NEXT: LBB7_1: ; %atomicrmw.start
634 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
635 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB7_2 Depth 2
636 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
637 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
638 ; CHECK-NOLSE-O0-NEXT: and x9, x8, #0x7
639 ; CHECK-NOLSE-O0-NEXT: mvn x12, x9
640 ; CHECK-NOLSE-O0-NEXT: LBB7_2: ; %atomicrmw.start
641 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB7_1 Depth=1
642 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
643 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
644 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
645 ; CHECK-NOLSE-O0-NEXT: b.ne LBB7_4
646 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
647 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB7_2 Depth=2
648 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
649 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB7_2
650 ; CHECK-NOLSE-O0-NEXT: LBB7_4: ; %atomicrmw.start
651 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB7_1 Depth=1
652 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
653 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
654 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #8] ; 8-byte Folded Spill
655 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
656 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB7_1
657 ; CHECK-NOLSE-O0-NEXT: b LBB7_5
658 ; CHECK-NOLSE-O0-NEXT: LBB7_5: ; %atomicrmw.end
659 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp, #8] ; 8-byte Folded Reload
660 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
661 ; CHECK-NOLSE-O0-NEXT: ret
663 ; CHECK-OUTLINE-O0-LABEL: fetch_and_nand_64:
664 ; CHECK-OUTLINE-O0: ; %bb.0:
665 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
666 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
667 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
668 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [x0]
669 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
670 ; CHECK-OUTLINE-O0-NEXT: b LBB7_1
671 ; CHECK-OUTLINE-O0-NEXT: LBB7_1: ; %atomicrmw.start
672 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
673 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #24] ; 8-byte Folded Reload
674 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
675 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
676 ; CHECK-OUTLINE-O0-NEXT: and x8, x0, #0x7
677 ; CHECK-OUTLINE-O0-NEXT: mvn x1, x8
678 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_acq_rel
679 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp] ; 8-byte Folded Reload
680 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x8
681 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
682 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
683 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
684 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB7_1
685 ; CHECK-OUTLINE-O0-NEXT: b LBB7_2
686 ; CHECK-OUTLINE-O0-NEXT: LBB7_2: ; %atomicrmw.end
687 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #8] ; 8-byte Folded Reload
688 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
689 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
690 ; CHECK-OUTLINE-O0-NEXT: ret
692 ; CHECK-LSE-O1-LABEL: fetch_and_nand_64:
693 ; CHECK-LSE-O1: ; %bb.0:
694 ; CHECK-LSE-O1-NEXT: mov x8, x0
695 ; CHECK-LSE-O1-NEXT: ldr x0, [x0]
696 ; CHECK-LSE-O1-NEXT: LBB7_1: ; %atomicrmw.start
697 ; CHECK-LSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
698 ; CHECK-LSE-O1-NEXT: mov x9, x0
699 ; CHECK-LSE-O1-NEXT: and x10, x0, #0x7
700 ; CHECK-LSE-O1-NEXT: mvn x10, x10
701 ; CHECK-LSE-O1-NEXT: casal x0, x10, [x8]
702 ; CHECK-LSE-O1-NEXT: cmp x0, x9
703 ; CHECK-LSE-O1-NEXT: b.ne LBB7_1
704 ; CHECK-LSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
705 ; CHECK-LSE-O1-NEXT: ret
707 ; CHECK-LSE-O0-LABEL: fetch_and_nand_64:
708 ; CHECK-LSE-O0: ; %bb.0:
709 ; CHECK-LSE-O0-NEXT: sub sp, sp, #32
710 ; CHECK-LSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
711 ; CHECK-LSE-O0-NEXT: ldr x8, [x0]
712 ; CHECK-LSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
713 ; CHECK-LSE-O0-NEXT: b LBB7_1
714 ; CHECK-LSE-O0-NEXT: LBB7_1: ; %atomicrmw.start
715 ; CHECK-LSE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
716 ; CHECK-LSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
717 ; CHECK-LSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
718 ; CHECK-LSE-O0-NEXT: and x9, x8, #0x7
719 ; CHECK-LSE-O0-NEXT: mvn x10, x9
720 ; CHECK-LSE-O0-NEXT: mov x9, x8
721 ; CHECK-LSE-O0-NEXT: casal x9, x10, [x11]
722 ; CHECK-LSE-O0-NEXT: subs x8, x9, x8
723 ; CHECK-LSE-O0-NEXT: cset w8, eq
724 ; CHECK-LSE-O0-NEXT: str x9, [sp, #8] ; 8-byte Folded Spill
725 ; CHECK-LSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
726 ; CHECK-LSE-O0-NEXT: tbz w8, #0, LBB7_1
727 ; CHECK-LSE-O0-NEXT: b LBB7_2
728 ; CHECK-LSE-O0-NEXT: LBB7_2: ; %atomicrmw.end
729 ; CHECK-LSE-O0-NEXT: ldr x0, [sp, #8] ; 8-byte Folded Reload
730 ; CHECK-LSE-O0-NEXT: add sp, sp, #32
731 ; CHECK-LSE-O0-NEXT: ret
732 %val = atomicrmw nand ptr %p, i64 7 acq_rel
736 define i32 @fetch_and_or(ptr %p) #0 {
737 ; CHECK-NOLSE-O1-LABEL: fetch_and_or:
738 ; CHECK-NOLSE-O1: ; %bb.0:
739 ; CHECK-NOLSE-O1-NEXT: mov w9, #5 ; =0x5
740 ; CHECK-NOLSE-O1-NEXT: LBB8_1: ; %atomicrmw.start
741 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
742 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
743 ; CHECK-NOLSE-O1-NEXT: orr w10, w8, w9
744 ; CHECK-NOLSE-O1-NEXT: stlxr w11, w10, [x0]
745 ; CHECK-NOLSE-O1-NEXT: cbnz w11, LBB8_1
746 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
747 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
748 ; CHECK-NOLSE-O1-NEXT: ret
750 ; CHECK-OUTLINE-LABEL: fetch_and_or:
751 ; CHECK-OUTLINE: ; %bb.0:
752 ; CHECK-OUTLINE-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
753 ; CHECK-OUTLINE-NEXT: mov x1, x0
754 ; CHECK-OUTLINE-NEXT: mov w0, #5 ; =0x5
755 ; CHECK-OUTLINE-NEXT: bl ___aarch64_ldset4_acq_rel
756 ; CHECK-OUTLINE-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
757 ; CHECK-OUTLINE-NEXT: ret
759 ; CHECK-NOLSE-O0-LABEL: fetch_and_or:
760 ; CHECK-NOLSE-O0: ; %bb.0:
761 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
762 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
763 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
764 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
765 ; CHECK-NOLSE-O0-NEXT: b LBB8_1
766 ; CHECK-NOLSE-O0-NEXT: LBB8_1: ; %atomicrmw.start
767 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
768 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB8_2 Depth 2
769 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
770 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
771 ; CHECK-NOLSE-O0-NEXT: mov w9, #5 ; =0x5
772 ; CHECK-NOLSE-O0-NEXT: orr w12, w8, w9
773 ; CHECK-NOLSE-O0-NEXT: LBB8_2: ; %atomicrmw.start
774 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB8_1 Depth=1
775 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
776 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
777 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
778 ; CHECK-NOLSE-O0-NEXT: b.ne LBB8_4
779 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
780 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB8_2 Depth=2
781 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
782 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB8_2
783 ; CHECK-NOLSE-O0-NEXT: LBB8_4: ; %atomicrmw.start
784 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB8_1 Depth=1
785 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
786 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
787 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
788 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
789 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB8_1
790 ; CHECK-NOLSE-O0-NEXT: b LBB8_5
791 ; CHECK-NOLSE-O0-NEXT: LBB8_5: ; %atomicrmw.end
792 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
793 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
794 ; CHECK-NOLSE-O0-NEXT: ret
796 ; CHECK-LSE-O1-LABEL: fetch_and_or:
797 ; CHECK-LSE-O1: ; %bb.0:
798 ; CHECK-LSE-O1-NEXT: mov w8, #5 ; =0x5
799 ; CHECK-LSE-O1-NEXT: ldsetal w8, w0, [x0]
800 ; CHECK-LSE-O1-NEXT: ret
802 ; CHECK-LSE-O0-LABEL: fetch_and_or:
803 ; CHECK-LSE-O0: ; %bb.0:
804 ; CHECK-LSE-O0-NEXT: mov w8, #5 ; =0x5
805 ; CHECK-LSE-O0-NEXT: ldsetal w8, w0, [x0]
806 ; CHECK-LSE-O0-NEXT: ret
807 %val = atomicrmw or ptr %p, i32 5 seq_cst
811 define i64 @fetch_and_or_64(ptr %p) #0 {
812 ; CHECK-NOLSE-O1-LABEL: fetch_and_or_64:
813 ; CHECK-NOLSE-O1: ; %bb.0:
814 ; CHECK-NOLSE-O1-NEXT: LBB9_1: ; %atomicrmw.start
815 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
816 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
817 ; CHECK-NOLSE-O1-NEXT: orr x9, x8, #0x7
818 ; CHECK-NOLSE-O1-NEXT: stxr w10, x9, [x0]
819 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB9_1
820 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
821 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
822 ; CHECK-NOLSE-O1-NEXT: ret
824 ; CHECK-OUTLINE-O1-LABEL: fetch_and_or_64:
825 ; CHECK-OUTLINE-O1: ; %bb.0:
826 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
827 ; CHECK-OUTLINE-O1-NEXT: mov x1, x0
828 ; CHECK-OUTLINE-O1-NEXT: mov w0, #7 ; =0x7
829 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldset8_relax
830 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
831 ; CHECK-OUTLINE-O1-NEXT: ret
833 ; CHECK-NOLSE-O0-LABEL: fetch_and_or_64:
834 ; CHECK-NOLSE-O0: ; %bb.0:
835 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
836 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
837 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
838 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
839 ; CHECK-NOLSE-O0-NEXT: b LBB9_1
840 ; CHECK-NOLSE-O0-NEXT: LBB9_1: ; %atomicrmw.start
841 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
842 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB9_2 Depth 2
843 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
844 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
845 ; CHECK-NOLSE-O0-NEXT: orr x12, x8, #0x7
846 ; CHECK-NOLSE-O0-NEXT: LBB9_2: ; %atomicrmw.start
847 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB9_1 Depth=1
848 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
849 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
850 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
851 ; CHECK-NOLSE-O0-NEXT: b.ne LBB9_4
852 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
853 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB9_2 Depth=2
854 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
855 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB9_2
856 ; CHECK-NOLSE-O0-NEXT: LBB9_4: ; %atomicrmw.start
857 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB9_1 Depth=1
858 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
859 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
860 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #8] ; 8-byte Folded Spill
861 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
862 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB9_1
863 ; CHECK-NOLSE-O0-NEXT: b LBB9_5
864 ; CHECK-NOLSE-O0-NEXT: LBB9_5: ; %atomicrmw.end
865 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp, #8] ; 8-byte Folded Reload
866 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
867 ; CHECK-NOLSE-O0-NEXT: ret
869 ; CHECK-OUTLINE-O0-LABEL: fetch_and_or_64:
870 ; CHECK-OUTLINE-O0: ; %bb.0:
871 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
872 ; CHECK-OUTLINE-O0-NEXT: mov x1, x0
873 ; CHECK-OUTLINE-O0-NEXT: mov w8, #7 ; =0x7
874 ; CHECK-OUTLINE-O0-NEXT: mov w0, w8
875 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldset8_relax
876 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
877 ; CHECK-OUTLINE-O0-NEXT: ret
879 ; CHECK-LSE-O1-LABEL: fetch_and_or_64:
880 ; CHECK-LSE-O1: ; %bb.0:
881 ; CHECK-LSE-O1-NEXT: mov w8, #7 ; =0x7
882 ; CHECK-LSE-O1-NEXT: ldset x8, x0, [x0]
883 ; CHECK-LSE-O1-NEXT: ret
885 ; CHECK-LSE-O0-LABEL: fetch_and_or_64:
886 ; CHECK-LSE-O0: ; %bb.0:
887 ; CHECK-LSE-O0-NEXT: mov w8, #7 ; =0x7
888 ; CHECK-LSE-O0-NEXT: ; kill: def $x8 killed $w8
889 ; CHECK-LSE-O0-NEXT: ldset x8, x0, [x0]
890 ; CHECK-LSE-O0-NEXT: ret
891 %val = atomicrmw or ptr %p, i64 7 monotonic
895 define void @acquire_fence() #0 {
896 ; CHECK-NOLSE-LABEL: acquire_fence:
897 ; CHECK-NOLSE: ; %bb.0:
898 ; CHECK-NOLSE-NEXT: dmb ishld
899 ; CHECK-NOLSE-NEXT: ret
901 ; CHECK-OUTLINE-LABEL: acquire_fence:
902 ; CHECK-OUTLINE: ; %bb.0:
903 ; CHECK-OUTLINE-NEXT: dmb ishld
904 ; CHECK-OUTLINE-NEXT: ret
906 ; CHECK-LSE-O1-LABEL: acquire_fence:
907 ; CHECK-LSE-O1: ; %bb.0:
908 ; CHECK-LSE-O1-NEXT: dmb ishld
909 ; CHECK-LSE-O1-NEXT: ret
911 ; CHECK-LSE-O0-LABEL: acquire_fence:
912 ; CHECK-LSE-O0: ; %bb.0:
913 ; CHECK-LSE-O0-NEXT: dmb ishld
914 ; CHECK-LSE-O0-NEXT: ret
919 define void @release_fence() #0 {
920 ; CHECK-NOLSE-LABEL: release_fence:
921 ; CHECK-NOLSE: ; %bb.0:
922 ; CHECK-NOLSE-NEXT: dmb ish
923 ; CHECK-NOLSE-NEXT: ret
925 ; CHECK-OUTLINE-LABEL: release_fence:
926 ; CHECK-OUTLINE: ; %bb.0:
927 ; CHECK-OUTLINE-NEXT: dmb ish
928 ; CHECK-OUTLINE-NEXT: ret
930 ; CHECK-LSE-O1-LABEL: release_fence:
931 ; CHECK-LSE-O1: ; %bb.0:
932 ; CHECK-LSE-O1-NEXT: dmb ish
933 ; CHECK-LSE-O1-NEXT: ret
935 ; CHECK-LSE-O0-LABEL: release_fence:
936 ; CHECK-LSE-O0: ; %bb.0:
937 ; CHECK-LSE-O0-NEXT: dmb ish
938 ; CHECK-LSE-O0-NEXT: ret
943 define void @seq_cst_fence() #0 {
944 ; CHECK-NOLSE-LABEL: seq_cst_fence:
945 ; CHECK-NOLSE: ; %bb.0:
946 ; CHECK-NOLSE-NEXT: dmb ish
947 ; CHECK-NOLSE-NEXT: ret
949 ; CHECK-OUTLINE-LABEL: seq_cst_fence:
950 ; CHECK-OUTLINE: ; %bb.0:
951 ; CHECK-OUTLINE-NEXT: dmb ish
952 ; CHECK-OUTLINE-NEXT: ret
954 ; CHECK-LSE-O1-LABEL: seq_cst_fence:
955 ; CHECK-LSE-O1: ; %bb.0:
956 ; CHECK-LSE-O1-NEXT: dmb ish
957 ; CHECK-LSE-O1-NEXT: ret
959 ; CHECK-LSE-O0-LABEL: seq_cst_fence:
960 ; CHECK-LSE-O0: ; %bb.0:
961 ; CHECK-LSE-O0-NEXT: dmb ish
962 ; CHECK-LSE-O0-NEXT: ret
967 define i32 @atomic_load(ptr %p) #0 {
968 ; CHECK-NOLSE-LABEL: atomic_load:
969 ; CHECK-NOLSE: ; %bb.0:
970 ; CHECK-NOLSE-NEXT: ldar w0, [x0]
971 ; CHECK-NOLSE-NEXT: ret
973 ; CHECK-OUTLINE-LABEL: atomic_load:
974 ; CHECK-OUTLINE: ; %bb.0:
975 ; CHECK-OUTLINE-NEXT: ldar w0, [x0]
976 ; CHECK-OUTLINE-NEXT: ret
978 ; CHECK-LSE-O1-LABEL: atomic_load:
979 ; CHECK-LSE-O1: ; %bb.0:
980 ; CHECK-LSE-O1-NEXT: ldar w0, [x0]
981 ; CHECK-LSE-O1-NEXT: ret
983 ; CHECK-LSE-O0-LABEL: atomic_load:
984 ; CHECK-LSE-O0: ; %bb.0:
985 ; CHECK-LSE-O0-NEXT: ldar w0, [x0]
986 ; CHECK-LSE-O0-NEXT: ret
987 %r = load atomic i32, ptr %p seq_cst, align 4
991 define i8 @atomic_load_relaxed_8(ptr %p, i32 %off32) #0 {
992 ; CHECK-NOLSE-O1-LABEL: atomic_load_relaxed_8:
993 ; CHECK-NOLSE-O1: ; %bb.0:
994 ; CHECK-NOLSE-O1-NEXT: ldrb w8, [x0, #4095]
995 ; CHECK-NOLSE-O1-NEXT: ldrb w9, [x0, w1, sxtw]
996 ; CHECK-NOLSE-O1-NEXT: ldurb w10, [x0, #-256]
997 ; CHECK-NOLSE-O1-NEXT: add w8, w9, w8, uxtb
998 ; CHECK-NOLSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
999 ; CHECK-NOLSE-O1-NEXT: ldrb w9, [x9]
1000 ; CHECK-NOLSE-O1-NEXT: add w8, w8, w10, uxtb
1001 ; CHECK-NOLSE-O1-NEXT: add w0, w8, w9, uxtb
1002 ; CHECK-NOLSE-O1-NEXT: ret
1004 ; CHECK-OUTLINE-O1-LABEL: atomic_load_relaxed_8:
1005 ; CHECK-OUTLINE-O1: ; %bb.0:
1006 ; CHECK-OUTLINE-O1-NEXT: ldrb w8, [x0, #4095]
1007 ; CHECK-OUTLINE-O1-NEXT: ldrb w9, [x0, w1, sxtw]
1008 ; CHECK-OUTLINE-O1-NEXT: ldurb w10, [x0, #-256]
1009 ; CHECK-OUTLINE-O1-NEXT: add w8, w9, w8, uxtb
1010 ; CHECK-OUTLINE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1011 ; CHECK-OUTLINE-O1-NEXT: ldrb w9, [x9]
1012 ; CHECK-OUTLINE-O1-NEXT: add w8, w8, w10, uxtb
1013 ; CHECK-OUTLINE-O1-NEXT: add w0, w8, w9, uxtb
1014 ; CHECK-OUTLINE-O1-NEXT: ret
1016 ; CHECK-NOLSE-O0-LABEL: atomic_load_relaxed_8:
1017 ; CHECK-NOLSE-O0: ; %bb.0:
1018 ; CHECK-NOLSE-O0-NEXT: ldrb w9, [x0, #4095]
1019 ; CHECK-NOLSE-O0-NEXT: add x8, x0, w1, sxtw
1020 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x8]
1021 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9, uxtb
1022 ; CHECK-NOLSE-O0-NEXT: subs x9, x0, #256
1023 ; CHECK-NOLSE-O0-NEXT: ldrb w9, [x9]
1024 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9, uxtb
1025 ; CHECK-NOLSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1026 ; CHECK-NOLSE-O0-NEXT: ldrb w9, [x9]
1027 ; CHECK-NOLSE-O0-NEXT: add w0, w8, w9, uxtb
1028 ; CHECK-NOLSE-O0-NEXT: ret
1030 ; CHECK-OUTLINE-O0-LABEL: atomic_load_relaxed_8:
1031 ; CHECK-OUTLINE-O0: ; %bb.0:
1032 ; CHECK-OUTLINE-O0-NEXT: ldrb w9, [x0, #4095]
1033 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, w1, sxtw
1034 ; CHECK-OUTLINE-O0-NEXT: ldrb w8, [x8]
1035 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9, uxtb
1036 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, #256
1037 ; CHECK-OUTLINE-O0-NEXT: ldrb w9, [x9]
1038 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9, uxtb
1039 ; CHECK-OUTLINE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1040 ; CHECK-OUTLINE-O0-NEXT: ldrb w9, [x9]
1041 ; CHECK-OUTLINE-O0-NEXT: add w0, w8, w9, uxtb
1042 ; CHECK-OUTLINE-O0-NEXT: ret
1044 ; CHECK-LSE-O1-LABEL: atomic_load_relaxed_8:
1045 ; CHECK-LSE-O1: ; %bb.0:
1046 ; CHECK-LSE-O1-NEXT: ldrb w8, [x0, #4095]
1047 ; CHECK-LSE-O1-NEXT: ldrb w9, [x0, w1, sxtw]
1048 ; CHECK-LSE-O1-NEXT: add w8, w9, w8, uxtb
1049 ; CHECK-LSE-O1-NEXT: ldurb w9, [x0, #-256]
1050 ; CHECK-LSE-O1-NEXT: add w8, w8, w9, uxtb
1051 ; CHECK-LSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1052 ; CHECK-LSE-O1-NEXT: ldrb w9, [x9]
1053 ; CHECK-LSE-O1-NEXT: add w0, w8, w9, uxtb
1054 ; CHECK-LSE-O1-NEXT: ret
1056 ; CHECK-LSE-O0-LABEL: atomic_load_relaxed_8:
1057 ; CHECK-LSE-O0: ; %bb.0:
1058 ; CHECK-LSE-O0-NEXT: ldrb w9, [x0, #4095]
1059 ; CHECK-LSE-O0-NEXT: add x8, x0, w1, sxtw
1060 ; CHECK-LSE-O0-NEXT: ldrb w8, [x8]
1061 ; CHECK-LSE-O0-NEXT: add w8, w8, w9, uxtb
1062 ; CHECK-LSE-O0-NEXT: subs x9, x0, #256
1063 ; CHECK-LSE-O0-NEXT: ldrb w9, [x9]
1064 ; CHECK-LSE-O0-NEXT: add w8, w8, w9, uxtb
1065 ; CHECK-LSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1066 ; CHECK-LSE-O0-NEXT: ldrb w9, [x9]
1067 ; CHECK-LSE-O0-NEXT: add w0, w8, w9, uxtb
1068 ; CHECK-LSE-O0-NEXT: ret
1069 %ptr_unsigned = getelementptr i8, ptr %p, i32 4095
1070 %val_unsigned = load atomic i8, ptr %ptr_unsigned monotonic, align 1
1072 %ptr_regoff = getelementptr i8, ptr %p, i32 %off32
1073 %val_regoff = load atomic i8, ptr %ptr_regoff unordered, align 1
1074 %tot1 = add i8 %val_unsigned, %val_regoff
1076 %ptr_unscaled = getelementptr i8, ptr %p, i32 -256
1077 %val_unscaled = load atomic i8, ptr %ptr_unscaled monotonic, align 1
1078 %tot2 = add i8 %tot1, %val_unscaled
1080 %ptr_random = getelementptr i8, ptr %p, i32 1191936 ; 0x123000 (i.e. ADD imm)
1081 %val_random = load atomic i8, ptr %ptr_random unordered, align 1
1082 %tot3 = add i8 %tot2, %val_random
1087 define i16 @atomic_load_relaxed_16(ptr %p, i32 %off32) #0 {
1088 ; CHECK-NOLSE-O1-LABEL: atomic_load_relaxed_16:
1089 ; CHECK-NOLSE-O1: ; %bb.0:
1090 ; CHECK-NOLSE-O1-NEXT: ldrh w8, [x0, #8190]
1091 ; CHECK-NOLSE-O1-NEXT: ldrh w9, [x0, w1, sxtw #1]
1092 ; CHECK-NOLSE-O1-NEXT: ldurh w10, [x0, #-256]
1093 ; CHECK-NOLSE-O1-NEXT: add w8, w9, w8, uxth
1094 ; CHECK-NOLSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1095 ; CHECK-NOLSE-O1-NEXT: ldrh w9, [x9]
1096 ; CHECK-NOLSE-O1-NEXT: add w8, w8, w10, uxth
1097 ; CHECK-NOLSE-O1-NEXT: add w0, w8, w9, uxth
1098 ; CHECK-NOLSE-O1-NEXT: ret
1100 ; CHECK-OUTLINE-O1-LABEL: atomic_load_relaxed_16:
1101 ; CHECK-OUTLINE-O1: ; %bb.0:
1102 ; CHECK-OUTLINE-O1-NEXT: ldrh w8, [x0, #8190]
1103 ; CHECK-OUTLINE-O1-NEXT: ldrh w9, [x0, w1, sxtw #1]
1104 ; CHECK-OUTLINE-O1-NEXT: ldurh w10, [x0, #-256]
1105 ; CHECK-OUTLINE-O1-NEXT: add w8, w9, w8, uxth
1106 ; CHECK-OUTLINE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1107 ; CHECK-OUTLINE-O1-NEXT: ldrh w9, [x9]
1108 ; CHECK-OUTLINE-O1-NEXT: add w8, w8, w10, uxth
1109 ; CHECK-OUTLINE-O1-NEXT: add w0, w8, w9, uxth
1110 ; CHECK-OUTLINE-O1-NEXT: ret
1112 ; CHECK-NOLSE-O0-LABEL: atomic_load_relaxed_16:
1113 ; CHECK-NOLSE-O0: ; %bb.0:
1114 ; CHECK-NOLSE-O0-NEXT: ldrh w9, [x0, #8190]
1115 ; CHECK-NOLSE-O0-NEXT: add x8, x0, w1, sxtw #1
1116 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x8]
1117 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9, uxth
1118 ; CHECK-NOLSE-O0-NEXT: subs x9, x0, #256
1119 ; CHECK-NOLSE-O0-NEXT: ldrh w9, [x9]
1120 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9, uxth
1121 ; CHECK-NOLSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1122 ; CHECK-NOLSE-O0-NEXT: ldrh w9, [x9]
1123 ; CHECK-NOLSE-O0-NEXT: add w0, w8, w9, uxth
1124 ; CHECK-NOLSE-O0-NEXT: ret
1126 ; CHECK-OUTLINE-O0-LABEL: atomic_load_relaxed_16:
1127 ; CHECK-OUTLINE-O0: ; %bb.0:
1128 ; CHECK-OUTLINE-O0-NEXT: ldrh w9, [x0, #8190]
1129 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, w1, sxtw #1
1130 ; CHECK-OUTLINE-O0-NEXT: ldrh w8, [x8]
1131 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9, uxth
1132 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, #256
1133 ; CHECK-OUTLINE-O0-NEXT: ldrh w9, [x9]
1134 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9, uxth
1135 ; CHECK-OUTLINE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1136 ; CHECK-OUTLINE-O0-NEXT: ldrh w9, [x9]
1137 ; CHECK-OUTLINE-O0-NEXT: add w0, w8, w9, uxth
1138 ; CHECK-OUTLINE-O0-NEXT: ret
1140 ; CHECK-LSE-O1-LABEL: atomic_load_relaxed_16:
1141 ; CHECK-LSE-O1: ; %bb.0:
1142 ; CHECK-LSE-O1-NEXT: ldrh w8, [x0, #8190]
1143 ; CHECK-LSE-O1-NEXT: ldrh w9, [x0, w1, sxtw #1]
1144 ; CHECK-LSE-O1-NEXT: add w8, w9, w8, uxth
1145 ; CHECK-LSE-O1-NEXT: ldurh w9, [x0, #-256]
1146 ; CHECK-LSE-O1-NEXT: add w8, w8, w9, uxth
1147 ; CHECK-LSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1148 ; CHECK-LSE-O1-NEXT: ldrh w9, [x9]
1149 ; CHECK-LSE-O1-NEXT: add w0, w8, w9, uxth
1150 ; CHECK-LSE-O1-NEXT: ret
1152 ; CHECK-LSE-O0-LABEL: atomic_load_relaxed_16:
1153 ; CHECK-LSE-O0: ; %bb.0:
1154 ; CHECK-LSE-O0-NEXT: ldrh w9, [x0, #8190]
1155 ; CHECK-LSE-O0-NEXT: add x8, x0, w1, sxtw #1
1156 ; CHECK-LSE-O0-NEXT: ldrh w8, [x8]
1157 ; CHECK-LSE-O0-NEXT: add w8, w8, w9, uxth
1158 ; CHECK-LSE-O0-NEXT: subs x9, x0, #256
1159 ; CHECK-LSE-O0-NEXT: ldrh w9, [x9]
1160 ; CHECK-LSE-O0-NEXT: add w8, w8, w9, uxth
1161 ; CHECK-LSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1162 ; CHECK-LSE-O0-NEXT: ldrh w9, [x9]
1163 ; CHECK-LSE-O0-NEXT: add w0, w8, w9, uxth
1164 ; CHECK-LSE-O0-NEXT: ret
1165 %ptr_unsigned = getelementptr i16, ptr %p, i32 4095
1166 %val_unsigned = load atomic i16, ptr %ptr_unsigned monotonic, align 2
1168 %ptr_regoff = getelementptr i16, ptr %p, i32 %off32
1169 %val_regoff = load atomic i16, ptr %ptr_regoff unordered, align 2
1170 %tot1 = add i16 %val_unsigned, %val_regoff
1172 %ptr_unscaled = getelementptr i16, ptr %p, i32 -128
1173 %val_unscaled = load atomic i16, ptr %ptr_unscaled monotonic, align 2
1174 %tot2 = add i16 %tot1, %val_unscaled
1176 %ptr_random = getelementptr i16, ptr %p, i32 595968 ; 0x123000/2 (i.e. ADD imm)
1177 %val_random = load atomic i16, ptr %ptr_random unordered, align 2
1178 %tot3 = add i16 %tot2, %val_random
1183 define i32 @atomic_load_relaxed_32(ptr %p, i32 %off32) #0 {
1184 ; CHECK-NOLSE-O1-LABEL: atomic_load_relaxed_32:
1185 ; CHECK-NOLSE-O1: ; %bb.0:
1186 ; CHECK-NOLSE-O1-NEXT: ldr w8, [x0, #16380]
1187 ; CHECK-NOLSE-O1-NEXT: ldr w9, [x0, w1, sxtw #2]
1188 ; CHECK-NOLSE-O1-NEXT: add x11, x0, #291, lsl #12 ; =1191936
1189 ; CHECK-NOLSE-O1-NEXT: ldur w10, [x0, #-256]
1190 ; CHECK-NOLSE-O1-NEXT: add w8, w8, w9
1191 ; CHECK-NOLSE-O1-NEXT: ldr w9, [x11]
1192 ; CHECK-NOLSE-O1-NEXT: add w8, w8, w10
1193 ; CHECK-NOLSE-O1-NEXT: add w0, w8, w9
1194 ; CHECK-NOLSE-O1-NEXT: ret
1196 ; CHECK-OUTLINE-O1-LABEL: atomic_load_relaxed_32:
1197 ; CHECK-OUTLINE-O1: ; %bb.0:
1198 ; CHECK-OUTLINE-O1-NEXT: ldr w8, [x0, #16380]
1199 ; CHECK-OUTLINE-O1-NEXT: ldr w9, [x0, w1, sxtw #2]
1200 ; CHECK-OUTLINE-O1-NEXT: add x11, x0, #291, lsl #12 ; =1191936
1201 ; CHECK-OUTLINE-O1-NEXT: ldur w10, [x0, #-256]
1202 ; CHECK-OUTLINE-O1-NEXT: add w8, w8, w9
1203 ; CHECK-OUTLINE-O1-NEXT: ldr w9, [x11]
1204 ; CHECK-OUTLINE-O1-NEXT: add w8, w8, w10
1205 ; CHECK-OUTLINE-O1-NEXT: add w0, w8, w9
1206 ; CHECK-OUTLINE-O1-NEXT: ret
1208 ; CHECK-NOLSE-O0-LABEL: atomic_load_relaxed_32:
1209 ; CHECK-NOLSE-O0: ; %bb.0:
1210 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0, #16380]
1211 ; CHECK-NOLSE-O0-NEXT: ldr w9, [x0, w1, sxtw #2]
1212 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9
1213 ; CHECK-NOLSE-O0-NEXT: ldur w9, [x0, #-256]
1214 ; CHECK-NOLSE-O0-NEXT: add w8, w8, w9
1215 ; CHECK-NOLSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1216 ; CHECK-NOLSE-O0-NEXT: ldr w9, [x9]
1217 ; CHECK-NOLSE-O0-NEXT: add w0, w8, w9
1218 ; CHECK-NOLSE-O0-NEXT: ret
1220 ; CHECK-OUTLINE-O0-LABEL: atomic_load_relaxed_32:
1221 ; CHECK-OUTLINE-O0: ; %bb.0:
1222 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [x0, #16380]
1223 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [x0, w1, sxtw #2]
1224 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9
1225 ; CHECK-OUTLINE-O0-NEXT: ldur w9, [x0, #-256]
1226 ; CHECK-OUTLINE-O0-NEXT: add w8, w8, w9
1227 ; CHECK-OUTLINE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1228 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [x9]
1229 ; CHECK-OUTLINE-O0-NEXT: add w0, w8, w9
1230 ; CHECK-OUTLINE-O0-NEXT: ret
1232 ; CHECK-LSE-O1-LABEL: atomic_load_relaxed_32:
1233 ; CHECK-LSE-O1: ; %bb.0:
1234 ; CHECK-LSE-O1-NEXT: ldr w8, [x0, #16380]
1235 ; CHECK-LSE-O1-NEXT: ldr w9, [x0, w1, sxtw #2]
1236 ; CHECK-LSE-O1-NEXT: ldur w10, [x0, #-256]
1237 ; CHECK-LSE-O1-NEXT: add w8, w8, w10
1238 ; CHECK-LSE-O1-NEXT: add w8, w8, w9
1239 ; CHECK-LSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1240 ; CHECK-LSE-O1-NEXT: ldr w9, [x9]
1241 ; CHECK-LSE-O1-NEXT: add w0, w8, w9
1242 ; CHECK-LSE-O1-NEXT: ret
1244 ; CHECK-LSE-O0-LABEL: atomic_load_relaxed_32:
1245 ; CHECK-LSE-O0: ; %bb.0:
1246 ; CHECK-LSE-O0-NEXT: ldr w8, [x0, #16380]
1247 ; CHECK-LSE-O0-NEXT: ldr w9, [x0, w1, sxtw #2]
1248 ; CHECK-LSE-O0-NEXT: add w8, w8, w9
1249 ; CHECK-LSE-O0-NEXT: ldur w9, [x0, #-256]
1250 ; CHECK-LSE-O0-NEXT: add w8, w8, w9
1251 ; CHECK-LSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1252 ; CHECK-LSE-O0-NEXT: ldr w9, [x9]
1253 ; CHECK-LSE-O0-NEXT: add w0, w8, w9
1254 ; CHECK-LSE-O0-NEXT: ret
1255 %ptr_unsigned = getelementptr i32, ptr %p, i32 4095
1256 %val_unsigned = load atomic i32, ptr %ptr_unsigned monotonic, align 4
1258 %ptr_regoff = getelementptr i32, ptr %p, i32 %off32
1259 %val_regoff = load atomic i32, ptr %ptr_regoff unordered, align 4
1260 %tot1 = add i32 %val_unsigned, %val_regoff
1262 %ptr_unscaled = getelementptr i32, ptr %p, i32 -64
1263 %val_unscaled = load atomic i32, ptr %ptr_unscaled monotonic, align 4
1264 %tot2 = add i32 %tot1, %val_unscaled
1266 %ptr_random = getelementptr i32, ptr %p, i32 297984 ; 0x123000/4 (i.e. ADD imm)
1267 %val_random = load atomic i32, ptr %ptr_random unordered, align 4
1268 %tot3 = add i32 %tot2, %val_random
1273 define i64 @atomic_load_relaxed_64(ptr %p, i32 %off32) #0 {
1274 ; CHECK-NOLSE-O1-LABEL: atomic_load_relaxed_64:
1275 ; CHECK-NOLSE-O1: ; %bb.0:
1276 ; CHECK-NOLSE-O1-NEXT: ldr x8, [x0, #32760]
1277 ; CHECK-NOLSE-O1-NEXT: ldr x9, [x0, w1, sxtw #3]
1278 ; CHECK-NOLSE-O1-NEXT: add x11, x0, #291, lsl #12 ; =1191936
1279 ; CHECK-NOLSE-O1-NEXT: ldur x10, [x0, #-256]
1280 ; CHECK-NOLSE-O1-NEXT: add x8, x8, x9
1281 ; CHECK-NOLSE-O1-NEXT: ldr x9, [x11]
1282 ; CHECK-NOLSE-O1-NEXT: add x8, x8, x10
1283 ; CHECK-NOLSE-O1-NEXT: add x0, x8, x9
1284 ; CHECK-NOLSE-O1-NEXT: ret
1286 ; CHECK-OUTLINE-O1-LABEL: atomic_load_relaxed_64:
1287 ; CHECK-OUTLINE-O1: ; %bb.0:
1288 ; CHECK-OUTLINE-O1-NEXT: ldr x8, [x0, #32760]
1289 ; CHECK-OUTLINE-O1-NEXT: ldr x9, [x0, w1, sxtw #3]
1290 ; CHECK-OUTLINE-O1-NEXT: add x11, x0, #291, lsl #12 ; =1191936
1291 ; CHECK-OUTLINE-O1-NEXT: ldur x10, [x0, #-256]
1292 ; CHECK-OUTLINE-O1-NEXT: add x8, x8, x9
1293 ; CHECK-OUTLINE-O1-NEXT: ldr x9, [x11]
1294 ; CHECK-OUTLINE-O1-NEXT: add x8, x8, x10
1295 ; CHECK-OUTLINE-O1-NEXT: add x0, x8, x9
1296 ; CHECK-OUTLINE-O1-NEXT: ret
1298 ; CHECK-NOLSE-O0-LABEL: atomic_load_relaxed_64:
1299 ; CHECK-NOLSE-O0: ; %bb.0:
1300 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0, #32760]
1301 ; CHECK-NOLSE-O0-NEXT: ldr x9, [x0, w1, sxtw #3]
1302 ; CHECK-NOLSE-O0-NEXT: add x8, x8, x9
1303 ; CHECK-NOLSE-O0-NEXT: ldur x9, [x0, #-256]
1304 ; CHECK-NOLSE-O0-NEXT: add x8, x8, x9
1305 ; CHECK-NOLSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1306 ; CHECK-NOLSE-O0-NEXT: ldr x9, [x9]
1307 ; CHECK-NOLSE-O0-NEXT: add x0, x8, x9
1308 ; CHECK-NOLSE-O0-NEXT: ret
1310 ; CHECK-OUTLINE-O0-LABEL: atomic_load_relaxed_64:
1311 ; CHECK-OUTLINE-O0: ; %bb.0:
1312 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [x0, #32760]
1313 ; CHECK-OUTLINE-O0-NEXT: ldr x9, [x0, w1, sxtw #3]
1314 ; CHECK-OUTLINE-O0-NEXT: add x8, x8, x9
1315 ; CHECK-OUTLINE-O0-NEXT: ldur x9, [x0, #-256]
1316 ; CHECK-OUTLINE-O0-NEXT: add x8, x8, x9
1317 ; CHECK-OUTLINE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1318 ; CHECK-OUTLINE-O0-NEXT: ldr x9, [x9]
1319 ; CHECK-OUTLINE-O0-NEXT: add x0, x8, x9
1320 ; CHECK-OUTLINE-O0-NEXT: ret
1322 ; CHECK-LSE-O1-LABEL: atomic_load_relaxed_64:
1323 ; CHECK-LSE-O1: ; %bb.0:
1324 ; CHECK-LSE-O1-NEXT: ldr x8, [x0, #32760]
1325 ; CHECK-LSE-O1-NEXT: ldr x9, [x0, w1, sxtw #3]
1326 ; CHECK-LSE-O1-NEXT: ldur x10, [x0, #-256]
1327 ; CHECK-LSE-O1-NEXT: add x8, x8, x10
1328 ; CHECK-LSE-O1-NEXT: add x8, x8, x9
1329 ; CHECK-LSE-O1-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1330 ; CHECK-LSE-O1-NEXT: ldr x9, [x9]
1331 ; CHECK-LSE-O1-NEXT: add x0, x8, x9
1332 ; CHECK-LSE-O1-NEXT: ret
1334 ; CHECK-LSE-O0-LABEL: atomic_load_relaxed_64:
1335 ; CHECK-LSE-O0: ; %bb.0:
1336 ; CHECK-LSE-O0-NEXT: ldr x8, [x0, #32760]
1337 ; CHECK-LSE-O0-NEXT: ldr x9, [x0, w1, sxtw #3]
1338 ; CHECK-LSE-O0-NEXT: add x8, x8, x9
1339 ; CHECK-LSE-O0-NEXT: ldur x9, [x0, #-256]
1340 ; CHECK-LSE-O0-NEXT: add x8, x8, x9
1341 ; CHECK-LSE-O0-NEXT: add x9, x0, #291, lsl #12 ; =1191936
1342 ; CHECK-LSE-O0-NEXT: ldr x9, [x9]
1343 ; CHECK-LSE-O0-NEXT: add x0, x8, x9
1344 ; CHECK-LSE-O0-NEXT: ret
1345 %ptr_unsigned = getelementptr i64, ptr %p, i32 4095
1346 %val_unsigned = load atomic i64, ptr %ptr_unsigned monotonic, align 8
1348 %ptr_regoff = getelementptr i64, ptr %p, i32 %off32
1349 %val_regoff = load atomic i64, ptr %ptr_regoff unordered, align 8
1350 %tot1 = add i64 %val_unsigned, %val_regoff
1352 %ptr_unscaled = getelementptr i64, ptr %p, i32 -32
1353 %val_unscaled = load atomic i64, ptr %ptr_unscaled monotonic, align 8
1354 %tot2 = add i64 %tot1, %val_unscaled
1356 %ptr_random = getelementptr i64, ptr %p, i32 148992 ; 0x123000/8 (i.e. ADD imm)
1357 %val_random = load atomic i64, ptr %ptr_random unordered, align 8
1358 %tot3 = add i64 %tot2, %val_random
1364 define void @atomc_store(ptr %p) #0 {
1365 ; CHECK-NOLSE-LABEL: atomc_store:
1366 ; CHECK-NOLSE: ; %bb.0:
1367 ; CHECK-NOLSE-NEXT: mov w8, #4 ; =0x4
1368 ; CHECK-NOLSE-NEXT: stlr w8, [x0]
1369 ; CHECK-NOLSE-NEXT: ret
1371 ; CHECK-OUTLINE-LABEL: atomc_store:
1372 ; CHECK-OUTLINE: ; %bb.0:
1373 ; CHECK-OUTLINE-NEXT: mov w8, #4 ; =0x4
1374 ; CHECK-OUTLINE-NEXT: stlr w8, [x0]
1375 ; CHECK-OUTLINE-NEXT: ret
1377 ; CHECK-LSE-O1-LABEL: atomc_store:
1378 ; CHECK-LSE-O1: ; %bb.0:
1379 ; CHECK-LSE-O1-NEXT: mov w8, #4 ; =0x4
1380 ; CHECK-LSE-O1-NEXT: stlr w8, [x0]
1381 ; CHECK-LSE-O1-NEXT: ret
1383 ; CHECK-LSE-O0-LABEL: atomc_store:
1384 ; CHECK-LSE-O0: ; %bb.0:
1385 ; CHECK-LSE-O0-NEXT: mov w8, #4 ; =0x4
1386 ; CHECK-LSE-O0-NEXT: stlr w8, [x0]
1387 ; CHECK-LSE-O0-NEXT: ret
1388 store atomic i32 4, ptr %p seq_cst, align 4
1392 define void @atomic_store_relaxed_8(ptr %p, i32 %off32, i8 %val) #0 {
1393 ; CHECK-NOLSE-O1-LABEL: atomic_store_relaxed_8:
1394 ; CHECK-NOLSE-O1: ; %bb.0:
1395 ; CHECK-NOLSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1396 ; CHECK-NOLSE-O1-NEXT: strb w2, [x0, #4095]
1397 ; CHECK-NOLSE-O1-NEXT: strb w2, [x0, w1, sxtw]
1398 ; CHECK-NOLSE-O1-NEXT: sturb w2, [x0, #-256]
1399 ; CHECK-NOLSE-O1-NEXT: strb w2, [x8]
1400 ; CHECK-NOLSE-O1-NEXT: ret
1402 ; CHECK-OUTLINE-O1-LABEL: atomic_store_relaxed_8:
1403 ; CHECK-OUTLINE-O1: ; %bb.0:
1404 ; CHECK-OUTLINE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1405 ; CHECK-OUTLINE-O1-NEXT: strb w2, [x0, #4095]
1406 ; CHECK-OUTLINE-O1-NEXT: strb w2, [x0, w1, sxtw]
1407 ; CHECK-OUTLINE-O1-NEXT: sturb w2, [x0, #-256]
1408 ; CHECK-OUTLINE-O1-NEXT: strb w2, [x8]
1409 ; CHECK-OUTLINE-O1-NEXT: ret
1411 ; CHECK-NOLSE-O0-LABEL: atomic_store_relaxed_8:
1412 ; CHECK-NOLSE-O0: ; %bb.0:
1413 ; CHECK-NOLSE-O0-NEXT: strb w2, [x0, #4095]
1414 ; CHECK-NOLSE-O0-NEXT: strb w2, [x0, w1, sxtw]
1415 ; CHECK-NOLSE-O0-NEXT: sturb w2, [x0, #-256]
1416 ; CHECK-NOLSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1417 ; CHECK-NOLSE-O0-NEXT: strb w2, [x8]
1418 ; CHECK-NOLSE-O0-NEXT: ret
1420 ; CHECK-OUTLINE-O0-LABEL: atomic_store_relaxed_8:
1421 ; CHECK-OUTLINE-O0: ; %bb.0:
1422 ; CHECK-OUTLINE-O0-NEXT: strb w2, [x0, #4095]
1423 ; CHECK-OUTLINE-O0-NEXT: strb w2, [x0, w1, sxtw]
1424 ; CHECK-OUTLINE-O0-NEXT: sturb w2, [x0, #-256]
1425 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1426 ; CHECK-OUTLINE-O0-NEXT: strb w2, [x8]
1427 ; CHECK-OUTLINE-O0-NEXT: ret
1429 ; CHECK-LSE-O1-LABEL: atomic_store_relaxed_8:
1430 ; CHECK-LSE-O1: ; %bb.0:
1431 ; CHECK-LSE-O1-NEXT: strb w2, [x0, #4095]
1432 ; CHECK-LSE-O1-NEXT: strb w2, [x0, w1, sxtw]
1433 ; CHECK-LSE-O1-NEXT: sturb w2, [x0, #-256]
1434 ; CHECK-LSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1435 ; CHECK-LSE-O1-NEXT: strb w2, [x8]
1436 ; CHECK-LSE-O1-NEXT: ret
1438 ; CHECK-LSE-O0-LABEL: atomic_store_relaxed_8:
1439 ; CHECK-LSE-O0: ; %bb.0:
1440 ; CHECK-LSE-O0-NEXT: strb w2, [x0, #4095]
1441 ; CHECK-LSE-O0-NEXT: strb w2, [x0, w1, sxtw]
1442 ; CHECK-LSE-O0-NEXT: sturb w2, [x0, #-256]
1443 ; CHECK-LSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1444 ; CHECK-LSE-O0-NEXT: strb w2, [x8]
1445 ; CHECK-LSE-O0-NEXT: ret
1446 %ptr_unsigned = getelementptr i8, ptr %p, i32 4095
1447 store atomic i8 %val, ptr %ptr_unsigned monotonic, align 1
1449 %ptr_regoff = getelementptr i8, ptr %p, i32 %off32
1450 store atomic i8 %val, ptr %ptr_regoff unordered, align 1
1452 %ptr_unscaled = getelementptr i8, ptr %p, i32 -256
1453 store atomic i8 %val, ptr %ptr_unscaled monotonic, align 1
1455 %ptr_random = getelementptr i8, ptr %p, i32 1191936 ; 0x123000 (i.e. ADD imm)
1456 store atomic i8 %val, ptr %ptr_random unordered, align 1
1461 define void @atomic_store_relaxed_16(ptr %p, i32 %off32, i16 %val) #0 {
1462 ; CHECK-NOLSE-O1-LABEL: atomic_store_relaxed_16:
1463 ; CHECK-NOLSE-O1: ; %bb.0:
1464 ; CHECK-NOLSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1465 ; CHECK-NOLSE-O1-NEXT: strh w2, [x0, #8190]
1466 ; CHECK-NOLSE-O1-NEXT: strh w2, [x0, w1, sxtw #1]
1467 ; CHECK-NOLSE-O1-NEXT: sturh w2, [x0, #-256]
1468 ; CHECK-NOLSE-O1-NEXT: strh w2, [x8]
1469 ; CHECK-NOLSE-O1-NEXT: ret
1471 ; CHECK-OUTLINE-O1-LABEL: atomic_store_relaxed_16:
1472 ; CHECK-OUTLINE-O1: ; %bb.0:
1473 ; CHECK-OUTLINE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1474 ; CHECK-OUTLINE-O1-NEXT: strh w2, [x0, #8190]
1475 ; CHECK-OUTLINE-O1-NEXT: strh w2, [x0, w1, sxtw #1]
1476 ; CHECK-OUTLINE-O1-NEXT: sturh w2, [x0, #-256]
1477 ; CHECK-OUTLINE-O1-NEXT: strh w2, [x8]
1478 ; CHECK-OUTLINE-O1-NEXT: ret
1480 ; CHECK-NOLSE-O0-LABEL: atomic_store_relaxed_16:
1481 ; CHECK-NOLSE-O0: ; %bb.0:
1482 ; CHECK-NOLSE-O0-NEXT: strh w2, [x0, #8190]
1483 ; CHECK-NOLSE-O0-NEXT: strh w2, [x0, w1, sxtw #1]
1484 ; CHECK-NOLSE-O0-NEXT: sturh w2, [x0, #-256]
1485 ; CHECK-NOLSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1486 ; CHECK-NOLSE-O0-NEXT: strh w2, [x8]
1487 ; CHECK-NOLSE-O0-NEXT: ret
1489 ; CHECK-OUTLINE-O0-LABEL: atomic_store_relaxed_16:
1490 ; CHECK-OUTLINE-O0: ; %bb.0:
1491 ; CHECK-OUTLINE-O0-NEXT: strh w2, [x0, #8190]
1492 ; CHECK-OUTLINE-O0-NEXT: strh w2, [x0, w1, sxtw #1]
1493 ; CHECK-OUTLINE-O0-NEXT: sturh w2, [x0, #-256]
1494 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1495 ; CHECK-OUTLINE-O0-NEXT: strh w2, [x8]
1496 ; CHECK-OUTLINE-O0-NEXT: ret
1498 ; CHECK-LSE-O1-LABEL: atomic_store_relaxed_16:
1499 ; CHECK-LSE-O1: ; %bb.0:
1500 ; CHECK-LSE-O1-NEXT: strh w2, [x0, #8190]
1501 ; CHECK-LSE-O1-NEXT: strh w2, [x0, w1, sxtw #1]
1502 ; CHECK-LSE-O1-NEXT: sturh w2, [x0, #-256]
1503 ; CHECK-LSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1504 ; CHECK-LSE-O1-NEXT: strh w2, [x8]
1505 ; CHECK-LSE-O1-NEXT: ret
1507 ; CHECK-LSE-O0-LABEL: atomic_store_relaxed_16:
1508 ; CHECK-LSE-O0: ; %bb.0:
1509 ; CHECK-LSE-O0-NEXT: strh w2, [x0, #8190]
1510 ; CHECK-LSE-O0-NEXT: strh w2, [x0, w1, sxtw #1]
1511 ; CHECK-LSE-O0-NEXT: sturh w2, [x0, #-256]
1512 ; CHECK-LSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1513 ; CHECK-LSE-O0-NEXT: strh w2, [x8]
1514 ; CHECK-LSE-O0-NEXT: ret
1515 %ptr_unsigned = getelementptr i16, ptr %p, i32 4095
1516 store atomic i16 %val, ptr %ptr_unsigned monotonic, align 2
1518 %ptr_regoff = getelementptr i16, ptr %p, i32 %off32
1519 store atomic i16 %val, ptr %ptr_regoff unordered, align 2
1521 %ptr_unscaled = getelementptr i16, ptr %p, i32 -128
1522 store atomic i16 %val, ptr %ptr_unscaled monotonic, align 2
1524 %ptr_random = getelementptr i16, ptr %p, i32 595968 ; 0x123000/2 (i.e. ADD imm)
1525 store atomic i16 %val, ptr %ptr_random unordered, align 2
1530 define void @atomic_store_relaxed_32(ptr %p, i32 %off32, i32 %val) #0 {
1531 ; CHECK-NOLSE-O1-LABEL: atomic_store_relaxed_32:
1532 ; CHECK-NOLSE-O1: ; %bb.0:
1533 ; CHECK-NOLSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1534 ; CHECK-NOLSE-O1-NEXT: str w2, [x0, #16380]
1535 ; CHECK-NOLSE-O1-NEXT: str w2, [x0, w1, sxtw #2]
1536 ; CHECK-NOLSE-O1-NEXT: stur w2, [x0, #-256]
1537 ; CHECK-NOLSE-O1-NEXT: str w2, [x8]
1538 ; CHECK-NOLSE-O1-NEXT: ret
1540 ; CHECK-OUTLINE-O1-LABEL: atomic_store_relaxed_32:
1541 ; CHECK-OUTLINE-O1: ; %bb.0:
1542 ; CHECK-OUTLINE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1543 ; CHECK-OUTLINE-O1-NEXT: str w2, [x0, #16380]
1544 ; CHECK-OUTLINE-O1-NEXT: str w2, [x0, w1, sxtw #2]
1545 ; CHECK-OUTLINE-O1-NEXT: stur w2, [x0, #-256]
1546 ; CHECK-OUTLINE-O1-NEXT: str w2, [x8]
1547 ; CHECK-OUTLINE-O1-NEXT: ret
1549 ; CHECK-NOLSE-O0-LABEL: atomic_store_relaxed_32:
1550 ; CHECK-NOLSE-O0: ; %bb.0:
1551 ; CHECK-NOLSE-O0-NEXT: str w2, [x0, #16380]
1552 ; CHECK-NOLSE-O0-NEXT: str w2, [x0, w1, sxtw #2]
1553 ; CHECK-NOLSE-O0-NEXT: stur w2, [x0, #-256]
1554 ; CHECK-NOLSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1555 ; CHECK-NOLSE-O0-NEXT: str w2, [x8]
1556 ; CHECK-NOLSE-O0-NEXT: ret
1558 ; CHECK-OUTLINE-O0-LABEL: atomic_store_relaxed_32:
1559 ; CHECK-OUTLINE-O0: ; %bb.0:
1560 ; CHECK-OUTLINE-O0-NEXT: str w2, [x0, #16380]
1561 ; CHECK-OUTLINE-O0-NEXT: str w2, [x0, w1, sxtw #2]
1562 ; CHECK-OUTLINE-O0-NEXT: stur w2, [x0, #-256]
1563 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1564 ; CHECK-OUTLINE-O0-NEXT: str w2, [x8]
1565 ; CHECK-OUTLINE-O0-NEXT: ret
1567 ; CHECK-LSE-O1-LABEL: atomic_store_relaxed_32:
1568 ; CHECK-LSE-O1: ; %bb.0:
1569 ; CHECK-LSE-O1-NEXT: str w2, [x0, #16380]
1570 ; CHECK-LSE-O1-NEXT: str w2, [x0, w1, sxtw #2]
1571 ; CHECK-LSE-O1-NEXT: stur w2, [x0, #-256]
1572 ; CHECK-LSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1573 ; CHECK-LSE-O1-NEXT: str w2, [x8]
1574 ; CHECK-LSE-O1-NEXT: ret
1576 ; CHECK-LSE-O0-LABEL: atomic_store_relaxed_32:
1577 ; CHECK-LSE-O0: ; %bb.0:
1578 ; CHECK-LSE-O0-NEXT: str w2, [x0, #16380]
1579 ; CHECK-LSE-O0-NEXT: str w2, [x0, w1, sxtw #2]
1580 ; CHECK-LSE-O0-NEXT: stur w2, [x0, #-256]
1581 ; CHECK-LSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1582 ; CHECK-LSE-O0-NEXT: str w2, [x8]
1583 ; CHECK-LSE-O0-NEXT: ret
1584 %ptr_unsigned = getelementptr i32, ptr %p, i32 4095
1585 store atomic i32 %val, ptr %ptr_unsigned monotonic, align 4
1587 %ptr_regoff = getelementptr i32, ptr %p, i32 %off32
1588 store atomic i32 %val, ptr %ptr_regoff unordered, align 4
1590 %ptr_unscaled = getelementptr i32, ptr %p, i32 -64
1591 store atomic i32 %val, ptr %ptr_unscaled monotonic, align 4
1593 %ptr_random = getelementptr i32, ptr %p, i32 297984 ; 0x123000/4 (i.e. ADD imm)
1594 store atomic i32 %val, ptr %ptr_random unordered, align 4
1599 define void @atomic_store_relaxed_64(ptr %p, i32 %off32, i64 %val) #0 {
1600 ; CHECK-NOLSE-O1-LABEL: atomic_store_relaxed_64:
1601 ; CHECK-NOLSE-O1: ; %bb.0:
1602 ; CHECK-NOLSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1603 ; CHECK-NOLSE-O1-NEXT: str x2, [x0, #32760]
1604 ; CHECK-NOLSE-O1-NEXT: str x2, [x0, w1, sxtw #3]
1605 ; CHECK-NOLSE-O1-NEXT: stur x2, [x0, #-256]
1606 ; CHECK-NOLSE-O1-NEXT: str x2, [x8]
1607 ; CHECK-NOLSE-O1-NEXT: ret
1609 ; CHECK-OUTLINE-O1-LABEL: atomic_store_relaxed_64:
1610 ; CHECK-OUTLINE-O1: ; %bb.0:
1611 ; CHECK-OUTLINE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1612 ; CHECK-OUTLINE-O1-NEXT: str x2, [x0, #32760]
1613 ; CHECK-OUTLINE-O1-NEXT: str x2, [x0, w1, sxtw #3]
1614 ; CHECK-OUTLINE-O1-NEXT: stur x2, [x0, #-256]
1615 ; CHECK-OUTLINE-O1-NEXT: str x2, [x8]
1616 ; CHECK-OUTLINE-O1-NEXT: ret
1618 ; CHECK-NOLSE-O0-LABEL: atomic_store_relaxed_64:
1619 ; CHECK-NOLSE-O0: ; %bb.0:
1620 ; CHECK-NOLSE-O0-NEXT: str x2, [x0, #32760]
1621 ; CHECK-NOLSE-O0-NEXT: str x2, [x0, w1, sxtw #3]
1622 ; CHECK-NOLSE-O0-NEXT: stur x2, [x0, #-256]
1623 ; CHECK-NOLSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1624 ; CHECK-NOLSE-O0-NEXT: str x2, [x8]
1625 ; CHECK-NOLSE-O0-NEXT: ret
1627 ; CHECK-OUTLINE-O0-LABEL: atomic_store_relaxed_64:
1628 ; CHECK-OUTLINE-O0: ; %bb.0:
1629 ; CHECK-OUTLINE-O0-NEXT: str x2, [x0, #32760]
1630 ; CHECK-OUTLINE-O0-NEXT: str x2, [x0, w1, sxtw #3]
1631 ; CHECK-OUTLINE-O0-NEXT: stur x2, [x0, #-256]
1632 ; CHECK-OUTLINE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1633 ; CHECK-OUTLINE-O0-NEXT: str x2, [x8]
1634 ; CHECK-OUTLINE-O0-NEXT: ret
1636 ; CHECK-LSE-O1-LABEL: atomic_store_relaxed_64:
1637 ; CHECK-LSE-O1: ; %bb.0:
1638 ; CHECK-LSE-O1-NEXT: str x2, [x0, #32760]
1639 ; CHECK-LSE-O1-NEXT: str x2, [x0, w1, sxtw #3]
1640 ; CHECK-LSE-O1-NEXT: stur x2, [x0, #-256]
1641 ; CHECK-LSE-O1-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1642 ; CHECK-LSE-O1-NEXT: str x2, [x8]
1643 ; CHECK-LSE-O1-NEXT: ret
1645 ; CHECK-LSE-O0-LABEL: atomic_store_relaxed_64:
1646 ; CHECK-LSE-O0: ; %bb.0:
1647 ; CHECK-LSE-O0-NEXT: str x2, [x0, #32760]
1648 ; CHECK-LSE-O0-NEXT: str x2, [x0, w1, sxtw #3]
1649 ; CHECK-LSE-O0-NEXT: stur x2, [x0, #-256]
1650 ; CHECK-LSE-O0-NEXT: add x8, x0, #291, lsl #12 ; =1191936
1651 ; CHECK-LSE-O0-NEXT: str x2, [x8]
1652 ; CHECK-LSE-O0-NEXT: ret
1653 %ptr_unsigned = getelementptr i64, ptr %p, i32 4095
1654 store atomic i64 %val, ptr %ptr_unsigned monotonic, align 8
1656 %ptr_regoff = getelementptr i64, ptr %p, i32 %off32
1657 store atomic i64 %val, ptr %ptr_regoff unordered, align 8
1659 %ptr_unscaled = getelementptr i64, ptr %p, i32 -32
1660 store atomic i64 %val, ptr %ptr_unscaled monotonic, align 8
1662 %ptr_random = getelementptr i64, ptr %p, i32 148992 ; 0x123000/8 (i.e. ADD imm)
1663 store atomic i64 %val, ptr %ptr_random unordered, align 8
1668 define i32 @load_zext(ptr %p8, ptr %p16) {
1669 ; CHECK-NOLSE-O1-LABEL: load_zext:
1670 ; CHECK-NOLSE-O1: ; %bb.0:
1671 ; CHECK-NOLSE-O1-NEXT: ldarb w8, [x0]
1672 ; CHECK-NOLSE-O1-NEXT: ldrh w9, [x1]
1673 ; CHECK-NOLSE-O1-NEXT: add w0, w9, w8, uxtb
1674 ; CHECK-NOLSE-O1-NEXT: ret
1676 ; CHECK-OUTLINE-O1-LABEL: load_zext:
1677 ; CHECK-OUTLINE-O1: ; %bb.0:
1678 ; CHECK-OUTLINE-O1-NEXT: ldarb w8, [x0]
1679 ; CHECK-OUTLINE-O1-NEXT: ldrh w9, [x1]
1680 ; CHECK-OUTLINE-O1-NEXT: add w0, w9, w8, uxtb
1681 ; CHECK-OUTLINE-O1-NEXT: ret
1683 ; CHECK-NOLSE-O0-LABEL: load_zext:
1684 ; CHECK-NOLSE-O0: ; %bb.0:
1685 ; CHECK-NOLSE-O0-NEXT: ldarb w9, [x0]
1686 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x1]
1687 ; CHECK-NOLSE-O0-NEXT: add w0, w8, w9, uxtb
1688 ; CHECK-NOLSE-O0-NEXT: ret
1690 ; CHECK-OUTLINE-O0-LABEL: load_zext:
1691 ; CHECK-OUTLINE-O0: ; %bb.0:
1692 ; CHECK-OUTLINE-O0-NEXT: ldarb w9, [x0]
1693 ; CHECK-OUTLINE-O0-NEXT: ldrh w8, [x1]
1694 ; CHECK-OUTLINE-O0-NEXT: add w0, w8, w9, uxtb
1695 ; CHECK-OUTLINE-O0-NEXT: ret
1697 ; CHECK-LSE-O1-LABEL: load_zext:
1698 ; CHECK-LSE-O1: ; %bb.0:
1699 ; CHECK-LSE-O1-NEXT: ldaprb w8, [x0]
1700 ; CHECK-LSE-O1-NEXT: ldrh w9, [x1]
1701 ; CHECK-LSE-O1-NEXT: add w0, w9, w8, uxtb
1702 ; CHECK-LSE-O1-NEXT: ret
1704 ; CHECK-LSE-O0-LABEL: load_zext:
1705 ; CHECK-LSE-O0: ; %bb.0:
1706 ; CHECK-LSE-O0-NEXT: ldaprb w9, [x0]
1707 ; CHECK-LSE-O0-NEXT: ldrh w8, [x1]
1708 ; CHECK-LSE-O0-NEXT: add w0, w8, w9, uxtb
1709 ; CHECK-LSE-O0-NEXT: ret
1710 %val1.8 = load atomic i8, ptr %p8 acquire, align 1
1711 %val1 = zext i8 %val1.8 to i32
1713 %val2.16 = load atomic i16, ptr %p16 unordered, align 2
1714 %val2 = zext i16 %val2.16 to i32
1716 %res = add i32 %val1, %val2
1720 define { i32, i64 } @load_acq(ptr %p32, ptr %p64) {
1721 ; CHECK-NOLSE-LABEL: load_acq:
1722 ; CHECK-NOLSE: ; %bb.0:
1723 ; CHECK-NOLSE-NEXT: ldar w0, [x0]
1724 ; CHECK-NOLSE-NEXT: ldar x1, [x1]
1725 ; CHECK-NOLSE-NEXT: ret
1727 ; CHECK-OUTLINE-LABEL: load_acq:
1728 ; CHECK-OUTLINE: ; %bb.0:
1729 ; CHECK-OUTLINE-NEXT: ldar w0, [x0]
1730 ; CHECK-OUTLINE-NEXT: ldar x1, [x1]
1731 ; CHECK-OUTLINE-NEXT: ret
1733 ; CHECK-LSE-O1-LABEL: load_acq:
1734 ; CHECK-LSE-O1: ; %bb.0:
1735 ; CHECK-LSE-O1-NEXT: ldar w0, [x0]
1736 ; CHECK-LSE-O1-NEXT: ldapr x1, [x1]
1737 ; CHECK-LSE-O1-NEXT: ret
1739 ; CHECK-LSE-O0-LABEL: load_acq:
1740 ; CHECK-LSE-O0: ; %bb.0:
1741 ; CHECK-LSE-O0-NEXT: ldar w0, [x0]
1742 ; CHECK-LSE-O0-NEXT: ldapr x1, [x1]
1743 ; CHECK-LSE-O0-NEXT: ret
1744 %val32 = load atomic i32, ptr %p32 seq_cst, align 4
1745 %tmp = insertvalue { i32, i64 } undef, i32 %val32, 0
1747 %val64 = load atomic i64, ptr %p64 acquire, align 8
1748 %res = insertvalue { i32, i64 } %tmp, i64 %val64, 1
1750 ret { i32, i64 } %res
1753 define i32 @load_sext(ptr %p8, ptr %p16) {
1754 ; CHECK-NOLSE-O1-LABEL: load_sext:
1755 ; CHECK-NOLSE-O1: ; %bb.0:
1756 ; CHECK-NOLSE-O1-NEXT: ldarb w8, [x0]
1757 ; CHECK-NOLSE-O1-NEXT: ldrh w9, [x1]
1758 ; CHECK-NOLSE-O1-NEXT: sxth w9, w9
1759 ; CHECK-NOLSE-O1-NEXT: add w0, w9, w8, sxtb
1760 ; CHECK-NOLSE-O1-NEXT: ret
1762 ; CHECK-OUTLINE-O1-LABEL: load_sext:
1763 ; CHECK-OUTLINE-O1: ; %bb.0:
1764 ; CHECK-OUTLINE-O1-NEXT: ldarb w8, [x0]
1765 ; CHECK-OUTLINE-O1-NEXT: ldrh w9, [x1]
1766 ; CHECK-OUTLINE-O1-NEXT: sxth w9, w9
1767 ; CHECK-OUTLINE-O1-NEXT: add w0, w9, w8, sxtb
1768 ; CHECK-OUTLINE-O1-NEXT: ret
1770 ; CHECK-NOLSE-O0-LABEL: load_sext:
1771 ; CHECK-NOLSE-O0: ; %bb.0:
1772 ; CHECK-NOLSE-O0-NEXT: ldarb w9, [x0]
1773 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x1]
1774 ; CHECK-NOLSE-O0-NEXT: sxth w8, w8
1775 ; CHECK-NOLSE-O0-NEXT: add w0, w8, w9, sxtb
1776 ; CHECK-NOLSE-O0-NEXT: ret
1778 ; CHECK-OUTLINE-O0-LABEL: load_sext:
1779 ; CHECK-OUTLINE-O0: ; %bb.0:
1780 ; CHECK-OUTLINE-O0-NEXT: ldarb w9, [x0]
1781 ; CHECK-OUTLINE-O0-NEXT: ldrh w8, [x1]
1782 ; CHECK-OUTLINE-O0-NEXT: sxth w8, w8
1783 ; CHECK-OUTLINE-O0-NEXT: add w0, w8, w9, sxtb
1784 ; CHECK-OUTLINE-O0-NEXT: ret
1786 ; CHECK-LSE-O1-LABEL: load_sext:
1787 ; CHECK-LSE-O1: ; %bb.0:
1788 ; CHECK-LSE-O1-NEXT: ldaprb w8, [x0]
1789 ; CHECK-LSE-O1-NEXT: ldrh w9, [x1]
1790 ; CHECK-LSE-O1-NEXT: sxth w9, w9
1791 ; CHECK-LSE-O1-NEXT: add w0, w9, w8, sxtb
1792 ; CHECK-LSE-O1-NEXT: ret
1794 ; CHECK-LSE-O0-LABEL: load_sext:
1795 ; CHECK-LSE-O0: ; %bb.0:
1796 ; CHECK-LSE-O0-NEXT: ldaprb w9, [x0]
1797 ; CHECK-LSE-O0-NEXT: ldrh w8, [x1]
1798 ; CHECK-LSE-O0-NEXT: sxth w8, w8
1799 ; CHECK-LSE-O0-NEXT: add w0, w8, w9, sxtb
1800 ; CHECK-LSE-O0-NEXT: ret
1801 %val1.8 = load atomic i8, ptr %p8 acquire, align 1
1802 %val1 = sext i8 %val1.8 to i32
1804 %val2.16 = load atomic i16, ptr %p16 unordered, align 2
1805 %val2 = sext i16 %val2.16 to i32
1807 %res = add i32 %val1, %val2
1811 define void @store_trunc(i32 %val, ptr %p8, ptr %p16) {
1812 ; CHECK-NOLSE-LABEL: store_trunc:
1813 ; CHECK-NOLSE: ; %bb.0:
1814 ; CHECK-NOLSE-NEXT: stlrb w0, [x1]
1815 ; CHECK-NOLSE-NEXT: strh w0, [x2]
1816 ; CHECK-NOLSE-NEXT: ret
1818 ; CHECK-OUTLINE-LABEL: store_trunc:
1819 ; CHECK-OUTLINE: ; %bb.0:
1820 ; CHECK-OUTLINE-NEXT: stlrb w0, [x1]
1821 ; CHECK-OUTLINE-NEXT: strh w0, [x2]
1822 ; CHECK-OUTLINE-NEXT: ret
1824 ; CHECK-LSE-O1-LABEL: store_trunc:
1825 ; CHECK-LSE-O1: ; %bb.0:
1826 ; CHECK-LSE-O1-NEXT: stlrb w0, [x1]
1827 ; CHECK-LSE-O1-NEXT: strh w0, [x2]
1828 ; CHECK-LSE-O1-NEXT: ret
1830 ; CHECK-LSE-O0-LABEL: store_trunc:
1831 ; CHECK-LSE-O0: ; %bb.0:
1832 ; CHECK-LSE-O0-NEXT: stlrb w0, [x1]
1833 ; CHECK-LSE-O0-NEXT: strh w0, [x2]
1834 ; CHECK-LSE-O0-NEXT: ret
1835 %val8 = trunc i32 %val to i8
1836 store atomic i8 %val8, ptr %p8 seq_cst, align 1
1838 %val16 = trunc i32 %val to i16
1839 store atomic i16 %val16, ptr %p16 monotonic, align 2
1844 define i8 @atomicrmw_add_i8(ptr %ptr, i8 %rhs) {
1845 ; CHECK-NOLSE-O1-LABEL: atomicrmw_add_i8:
1846 ; CHECK-NOLSE-O1: ; %bb.0:
1847 ; CHECK-NOLSE-O1-NEXT: LBB27_1: ; %atomicrmw.start
1848 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
1849 ; CHECK-NOLSE-O1-NEXT: ldaxrb w8, [x0]
1850 ; CHECK-NOLSE-O1-NEXT: add w9, w8, w1
1851 ; CHECK-NOLSE-O1-NEXT: stlxrb w10, w9, [x0]
1852 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB27_1
1853 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
1854 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
1855 ; CHECK-NOLSE-O1-NEXT: ret
1857 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_add_i8:
1858 ; CHECK-OUTLINE-O1: ; %bb.0:
1859 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
1860 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
1861 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
1862 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
1863 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
1864 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
1865 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
1866 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd1_acq_rel
1867 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
1868 ; CHECK-OUTLINE-O1-NEXT: ret
1870 ; CHECK-NOLSE-O0-LABEL: atomicrmw_add_i8:
1871 ; CHECK-NOLSE-O0: ; %bb.0:
1872 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
1873 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
1874 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
1875 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
1876 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
1877 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
1878 ; CHECK-NOLSE-O0-NEXT: b LBB27_1
1879 ; CHECK-NOLSE-O0-NEXT: LBB27_1: ; %atomicrmw.start
1880 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
1881 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB27_2 Depth 2
1882 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
1883 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
1884 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
1885 ; CHECK-NOLSE-O0-NEXT: add w12, w8, w10, uxth
1886 ; CHECK-NOLSE-O0-NEXT: LBB27_2: ; %atomicrmw.start
1887 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB27_1 Depth=1
1888 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
1889 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
1890 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
1891 ; CHECK-NOLSE-O0-NEXT: b.ne LBB27_4
1892 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
1893 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB27_2 Depth=2
1894 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
1895 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB27_2
1896 ; CHECK-NOLSE-O0-NEXT: LBB27_4: ; %atomicrmw.start
1897 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB27_1 Depth=1
1898 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
1899 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
1900 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
1901 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
1902 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
1903 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB27_1
1904 ; CHECK-NOLSE-O0-NEXT: b LBB27_5
1905 ; CHECK-NOLSE-O0-NEXT: LBB27_5: ; %atomicrmw.end
1906 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
1907 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
1908 ; CHECK-NOLSE-O0-NEXT: ret
1910 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_add_i8:
1911 ; CHECK-OUTLINE-O0: ; %bb.0:
1912 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
1913 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
1914 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
1915 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
1916 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
1917 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
1918 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
1919 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
1920 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd1_acq_rel
1921 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
1922 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
1923 ; CHECK-OUTLINE-O0-NEXT: ret
1925 ; CHECK-LSE-O1-LABEL: atomicrmw_add_i8:
1926 ; CHECK-LSE-O1: ; %bb.0:
1927 ; CHECK-LSE-O1-NEXT: ldaddalb w1, w0, [x0]
1928 ; CHECK-LSE-O1-NEXT: ret
1930 ; CHECK-LSE-O0-LABEL: atomicrmw_add_i8:
1931 ; CHECK-LSE-O0: ; %bb.0:
1932 ; CHECK-LSE-O0-NEXT: ldaddalb w1, w0, [x0]
1933 ; CHECK-LSE-O0-NEXT: ret
1934 %res = atomicrmw add ptr %ptr, i8 %rhs seq_cst
1938 define i8 @atomicrmw_xchg_i8(ptr %ptr, i8 %rhs) {
1939 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xchg_i8:
1940 ; CHECK-NOLSE-O1: ; %bb.0:
1941 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w1 killed $w1 def $x1
1942 ; CHECK-NOLSE-O1-NEXT: LBB28_1: ; %atomicrmw.start
1943 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
1944 ; CHECK-NOLSE-O1-NEXT: ldxrb w8, [x0]
1945 ; CHECK-NOLSE-O1-NEXT: stxrb w9, w1, [x0]
1946 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB28_1
1947 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
1948 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
1949 ; CHECK-NOLSE-O1-NEXT: ret
1951 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xchg_i8:
1952 ; CHECK-OUTLINE-O1: ; %bb.0:
1953 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
1954 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
1955 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
1956 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
1957 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
1958 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
1959 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
1960 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_swp1_relax
1961 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
1962 ; CHECK-OUTLINE-O1-NEXT: ret
1964 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xchg_i8:
1965 ; CHECK-NOLSE-O0: ; %bb.0:
1966 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
1967 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
1968 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
1969 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
1970 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
1971 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
1972 ; CHECK-NOLSE-O0-NEXT: b LBB28_1
1973 ; CHECK-NOLSE-O0-NEXT: LBB28_1: ; %atomicrmw.start
1974 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
1975 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB28_2 Depth 2
1976 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
1977 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
1978 ; CHECK-NOLSE-O0-NEXT: ldr w12, [sp, #24] ; 4-byte Folded Reload
1979 ; CHECK-NOLSE-O0-NEXT: LBB28_2: ; %atomicrmw.start
1980 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB28_1 Depth=1
1981 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
1982 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
1983 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
1984 ; CHECK-NOLSE-O0-NEXT: b.ne LBB28_4
1985 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
1986 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB28_2 Depth=2
1987 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
1988 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB28_2
1989 ; CHECK-NOLSE-O0-NEXT: LBB28_4: ; %atomicrmw.start
1990 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB28_1 Depth=1
1991 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
1992 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
1993 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
1994 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
1995 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
1996 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB28_1
1997 ; CHECK-NOLSE-O0-NEXT: b LBB28_5
1998 ; CHECK-NOLSE-O0-NEXT: LBB28_5: ; %atomicrmw.end
1999 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2000 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2001 ; CHECK-NOLSE-O0-NEXT: ret
2003 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xchg_i8:
2004 ; CHECK-OUTLINE-O0: ; %bb.0:
2005 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2006 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2007 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2008 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2009 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2010 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2011 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
2012 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2013 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_swp1_relax
2014 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2015 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2016 ; CHECK-OUTLINE-O0-NEXT: ret
2018 ; CHECK-LSE-O1-LABEL: atomicrmw_xchg_i8:
2019 ; CHECK-LSE-O1: ; %bb.0:
2020 ; CHECK-LSE-O1-NEXT: swpb w1, w0, [x0]
2021 ; CHECK-LSE-O1-NEXT: ret
2023 ; CHECK-LSE-O0-LABEL: atomicrmw_xchg_i8:
2024 ; CHECK-LSE-O0: ; %bb.0:
2025 ; CHECK-LSE-O0-NEXT: swpb w1, w0, [x0]
2026 ; CHECK-LSE-O0-NEXT: ret
2027 %res = atomicrmw xchg ptr %ptr, i8 %rhs monotonic
2031 define i8 @atomicrmw_sub_i8(ptr %ptr, i8 %rhs) {
2032 ; CHECK-NOLSE-O1-LABEL: atomicrmw_sub_i8:
2033 ; CHECK-NOLSE-O1: ; %bb.0:
2034 ; CHECK-NOLSE-O1-NEXT: LBB29_1: ; %atomicrmw.start
2035 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2036 ; CHECK-NOLSE-O1-NEXT: ldaxrb w8, [x0]
2037 ; CHECK-NOLSE-O1-NEXT: sub w9, w8, w1
2038 ; CHECK-NOLSE-O1-NEXT: stxrb w10, w9, [x0]
2039 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB29_1
2040 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2041 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2042 ; CHECK-NOLSE-O1-NEXT: ret
2044 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_sub_i8:
2045 ; CHECK-OUTLINE-O1: ; %bb.0:
2046 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
2047 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
2048 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
2049 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
2050 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
2051 ; CHECK-OUTLINE-O1-NEXT: neg w0, w1
2052 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
2053 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd1_acq
2054 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
2055 ; CHECK-OUTLINE-O1-NEXT: ret
2057 ; CHECK-NOLSE-O0-LABEL: atomicrmw_sub_i8:
2058 ; CHECK-NOLSE-O0: ; %bb.0:
2059 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2060 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2061 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2062 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2063 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2064 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2065 ; CHECK-NOLSE-O0-NEXT: b LBB29_1
2066 ; CHECK-NOLSE-O0-NEXT: LBB29_1: ; %atomicrmw.start
2067 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2068 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB29_2 Depth 2
2069 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2070 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2071 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2072 ; CHECK-NOLSE-O0-NEXT: subs w12, w10, w8
2073 ; CHECK-NOLSE-O0-NEXT: LBB29_2: ; %atomicrmw.start
2074 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB29_1 Depth=1
2075 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2076 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2077 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2078 ; CHECK-NOLSE-O0-NEXT: b.ne LBB29_4
2079 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2080 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB29_2 Depth=2
2081 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2082 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB29_2
2083 ; CHECK-NOLSE-O0-NEXT: LBB29_4: ; %atomicrmw.start
2084 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB29_1 Depth=1
2085 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2086 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2087 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2088 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2089 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2090 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB29_1
2091 ; CHECK-NOLSE-O0-NEXT: b LBB29_5
2092 ; CHECK-NOLSE-O0-NEXT: LBB29_5: ; %atomicrmw.end
2093 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2094 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2095 ; CHECK-NOLSE-O0-NEXT: ret
2097 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_sub_i8:
2098 ; CHECK-OUTLINE-O0: ; %bb.0:
2099 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2100 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2101 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2102 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2103 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2104 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2105 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
2106 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2107 ; CHECK-OUTLINE-O0-NEXT: mov w8, wzr
2108 ; CHECK-OUTLINE-O0-NEXT: subs w0, w8, w9
2109 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd1_acq
2110 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2111 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2112 ; CHECK-OUTLINE-O0-NEXT: ret
2114 ; CHECK-LSE-O1-LABEL: atomicrmw_sub_i8:
2115 ; CHECK-LSE-O1: ; %bb.0:
2116 ; CHECK-LSE-O1-NEXT: neg w8, w1
2117 ; CHECK-LSE-O1-NEXT: ldaddab w8, w0, [x0]
2118 ; CHECK-LSE-O1-NEXT: ret
2120 ; CHECK-LSE-O0-LABEL: atomicrmw_sub_i8:
2121 ; CHECK-LSE-O0: ; %bb.0:
2122 ; CHECK-LSE-O0-NEXT: neg w8, w1
2123 ; CHECK-LSE-O0-NEXT: ldaddab w8, w0, [x0]
2124 ; CHECK-LSE-O0-NEXT: ret
2125 %res = atomicrmw sub ptr %ptr, i8 %rhs acquire
2129 define i8 @atomicrmw_and_i8(ptr %ptr, i8 %rhs) {
2130 ; CHECK-NOLSE-O1-LABEL: atomicrmw_and_i8:
2131 ; CHECK-NOLSE-O1: ; %bb.0:
2132 ; CHECK-NOLSE-O1-NEXT: LBB30_1: ; %atomicrmw.start
2133 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2134 ; CHECK-NOLSE-O1-NEXT: ldxrb w8, [x0]
2135 ; CHECK-NOLSE-O1-NEXT: and w9, w8, w1
2136 ; CHECK-NOLSE-O1-NEXT: stlxrb w10, w9, [x0]
2137 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB30_1
2138 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2139 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2140 ; CHECK-NOLSE-O1-NEXT: ret
2142 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_and_i8:
2143 ; CHECK-OUTLINE-O1: ; %bb.0:
2144 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
2145 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
2146 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
2147 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
2148 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
2149 ; CHECK-OUTLINE-O1-NEXT: mvn w0, w1
2150 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
2151 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr1_rel
2152 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
2153 ; CHECK-OUTLINE-O1-NEXT: ret
2155 ; CHECK-NOLSE-O0-LABEL: atomicrmw_and_i8:
2156 ; CHECK-NOLSE-O0: ; %bb.0:
2157 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2158 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2159 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2160 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2161 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2162 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2163 ; CHECK-NOLSE-O0-NEXT: b LBB30_1
2164 ; CHECK-NOLSE-O0-NEXT: LBB30_1: ; %atomicrmw.start
2165 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2166 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB30_2 Depth 2
2167 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2168 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2169 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2170 ; CHECK-NOLSE-O0-NEXT: and w12, w10, w8
2171 ; CHECK-NOLSE-O0-NEXT: LBB30_2: ; %atomicrmw.start
2172 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB30_1 Depth=1
2173 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2174 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2175 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2176 ; CHECK-NOLSE-O0-NEXT: b.ne LBB30_4
2177 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2178 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB30_2 Depth=2
2179 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2180 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB30_2
2181 ; CHECK-NOLSE-O0-NEXT: LBB30_4: ; %atomicrmw.start
2182 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB30_1 Depth=1
2183 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2184 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2185 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2186 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2187 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2188 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB30_1
2189 ; CHECK-NOLSE-O0-NEXT: b LBB30_5
2190 ; CHECK-NOLSE-O0-NEXT: LBB30_5: ; %atomicrmw.end
2191 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2192 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2193 ; CHECK-NOLSE-O0-NEXT: ret
2195 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_and_i8:
2196 ; CHECK-OUTLINE-O0: ; %bb.0:
2197 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2198 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2199 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2200 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2201 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2202 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2203 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
2204 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2205 ; CHECK-OUTLINE-O0-NEXT: mov w8, #-1 ; =0xffffffff
2206 ; CHECK-OUTLINE-O0-NEXT: eor w0, w8, w9
2207 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldclr1_rel
2208 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2209 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2210 ; CHECK-OUTLINE-O0-NEXT: ret
2212 ; CHECK-LSE-O1-LABEL: atomicrmw_and_i8:
2213 ; CHECK-LSE-O1: ; %bb.0:
2214 ; CHECK-LSE-O1-NEXT: mvn w8, w1
2215 ; CHECK-LSE-O1-NEXT: ldclrlb w8, w0, [x0]
2216 ; CHECK-LSE-O1-NEXT: ret
2218 ; CHECK-LSE-O0-LABEL: atomicrmw_and_i8:
2219 ; CHECK-LSE-O0: ; %bb.0:
2220 ; CHECK-LSE-O0-NEXT: mvn w8, w1
2221 ; CHECK-LSE-O0-NEXT: ldclrlb w8, w0, [x0]
2222 ; CHECK-LSE-O0-NEXT: ret
2223 %res = atomicrmw and ptr %ptr, i8 %rhs release
2227 define i8 @atomicrmw_or_i8(ptr %ptr, i8 %rhs) {
2228 ; CHECK-NOLSE-O1-LABEL: atomicrmw_or_i8:
2229 ; CHECK-NOLSE-O1: ; %bb.0:
2230 ; CHECK-NOLSE-O1-NEXT: LBB31_1: ; %atomicrmw.start
2231 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2232 ; CHECK-NOLSE-O1-NEXT: ldaxrb w8, [x0]
2233 ; CHECK-NOLSE-O1-NEXT: orr w9, w8, w1
2234 ; CHECK-NOLSE-O1-NEXT: stlxrb w10, w9, [x0]
2235 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB31_1
2236 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2237 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2238 ; CHECK-NOLSE-O1-NEXT: ret
2240 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_or_i8:
2241 ; CHECK-OUTLINE-O1: ; %bb.0:
2242 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
2243 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
2244 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
2245 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
2246 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
2247 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
2248 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
2249 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldset1_acq_rel
2250 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
2251 ; CHECK-OUTLINE-O1-NEXT: ret
2253 ; CHECK-NOLSE-O0-LABEL: atomicrmw_or_i8:
2254 ; CHECK-NOLSE-O0: ; %bb.0:
2255 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2256 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2257 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2258 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2259 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2260 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2261 ; CHECK-NOLSE-O0-NEXT: b LBB31_1
2262 ; CHECK-NOLSE-O0-NEXT: LBB31_1: ; %atomicrmw.start
2263 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2264 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB31_2 Depth 2
2265 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2266 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2267 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2268 ; CHECK-NOLSE-O0-NEXT: orr w12, w10, w8
2269 ; CHECK-NOLSE-O0-NEXT: LBB31_2: ; %atomicrmw.start
2270 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB31_1 Depth=1
2271 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2272 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2273 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2274 ; CHECK-NOLSE-O0-NEXT: b.ne LBB31_4
2275 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2276 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB31_2 Depth=2
2277 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2278 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB31_2
2279 ; CHECK-NOLSE-O0-NEXT: LBB31_4: ; %atomicrmw.start
2280 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB31_1 Depth=1
2281 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2282 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2283 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2284 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2285 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2286 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB31_1
2287 ; CHECK-NOLSE-O0-NEXT: b LBB31_5
2288 ; CHECK-NOLSE-O0-NEXT: LBB31_5: ; %atomicrmw.end
2289 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2290 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2291 ; CHECK-NOLSE-O0-NEXT: ret
2293 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_or_i8:
2294 ; CHECK-OUTLINE-O0: ; %bb.0:
2295 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2296 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2297 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2298 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2299 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2300 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2301 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
2302 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2303 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldset1_acq_rel
2304 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2305 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2306 ; CHECK-OUTLINE-O0-NEXT: ret
2308 ; CHECK-LSE-O1-LABEL: atomicrmw_or_i8:
2309 ; CHECK-LSE-O1: ; %bb.0:
2310 ; CHECK-LSE-O1-NEXT: ldsetalb w1, w0, [x0]
2311 ; CHECK-LSE-O1-NEXT: ret
2313 ; CHECK-LSE-O0-LABEL: atomicrmw_or_i8:
2314 ; CHECK-LSE-O0: ; %bb.0:
2315 ; CHECK-LSE-O0-NEXT: ldsetalb w1, w0, [x0]
2316 ; CHECK-LSE-O0-NEXT: ret
2317 %res = atomicrmw or ptr %ptr, i8 %rhs seq_cst
2321 define i8 @atomicrmw_xor_i8(ptr %ptr, i8 %rhs) {
2322 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xor_i8:
2323 ; CHECK-NOLSE-O1: ; %bb.0:
2324 ; CHECK-NOLSE-O1-NEXT: LBB32_1: ; %atomicrmw.start
2325 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2326 ; CHECK-NOLSE-O1-NEXT: ldxrb w8, [x0]
2327 ; CHECK-NOLSE-O1-NEXT: eor w9, w8, w1
2328 ; CHECK-NOLSE-O1-NEXT: stxrb w10, w9, [x0]
2329 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB32_1
2330 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2331 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2332 ; CHECK-NOLSE-O1-NEXT: ret
2334 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xor_i8:
2335 ; CHECK-OUTLINE-O1: ; %bb.0:
2336 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
2337 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
2338 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
2339 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
2340 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
2341 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
2342 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
2343 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldeor1_relax
2344 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
2345 ; CHECK-OUTLINE-O1-NEXT: ret
2347 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xor_i8:
2348 ; CHECK-NOLSE-O0: ; %bb.0:
2349 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2350 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2351 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2352 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2353 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2354 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2355 ; CHECK-NOLSE-O0-NEXT: b LBB32_1
2356 ; CHECK-NOLSE-O0-NEXT: LBB32_1: ; %atomicrmw.start
2357 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2358 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB32_2 Depth 2
2359 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2360 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2361 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2362 ; CHECK-NOLSE-O0-NEXT: eor w12, w10, w8
2363 ; CHECK-NOLSE-O0-NEXT: LBB32_2: ; %atomicrmw.start
2364 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB32_1 Depth=1
2365 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2366 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2367 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2368 ; CHECK-NOLSE-O0-NEXT: b.ne LBB32_4
2369 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2370 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB32_2 Depth=2
2371 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2372 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB32_2
2373 ; CHECK-NOLSE-O0-NEXT: LBB32_4: ; %atomicrmw.start
2374 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB32_1 Depth=1
2375 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2376 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2377 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2378 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2379 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2380 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB32_1
2381 ; CHECK-NOLSE-O0-NEXT: b LBB32_5
2382 ; CHECK-NOLSE-O0-NEXT: LBB32_5: ; %atomicrmw.end
2383 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2384 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2385 ; CHECK-NOLSE-O0-NEXT: ret
2387 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xor_i8:
2388 ; CHECK-OUTLINE-O0: ; %bb.0:
2389 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2390 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2391 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2392 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2393 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2394 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2395 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
2396 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2397 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldeor1_relax
2398 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2399 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2400 ; CHECK-OUTLINE-O0-NEXT: ret
2402 ; CHECK-LSE-O1-LABEL: atomicrmw_xor_i8:
2403 ; CHECK-LSE-O1: ; %bb.0:
2404 ; CHECK-LSE-O1-NEXT: ldeorb w1, w0, [x0]
2405 ; CHECK-LSE-O1-NEXT: ret
2407 ; CHECK-LSE-O0-LABEL: atomicrmw_xor_i8:
2408 ; CHECK-LSE-O0: ; %bb.0:
2409 ; CHECK-LSE-O0-NEXT: ldeorb w1, w0, [x0]
2410 ; CHECK-LSE-O0-NEXT: ret
2411 %res = atomicrmw xor ptr %ptr, i8 %rhs monotonic
2415 define i8 @atomicrmw_min_i8(ptr %ptr, i8 %rhs) {
2416 ; CHECK-NOLSE-O1-LABEL: atomicrmw_min_i8:
2417 ; CHECK-NOLSE-O1: ; %bb.0:
2418 ; CHECK-NOLSE-O1-NEXT: LBB33_1: ; %atomicrmw.start
2419 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2420 ; CHECK-NOLSE-O1-NEXT: ldaxrb w8, [x0]
2421 ; CHECK-NOLSE-O1-NEXT: sxtb w9, w8
2422 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, sxtb
2423 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, lt
2424 ; CHECK-NOLSE-O1-NEXT: stxrb w10, w9, [x0]
2425 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB33_1
2426 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2427 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2428 ; CHECK-NOLSE-O1-NEXT: ret
2430 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_min_i8:
2431 ; CHECK-OUTLINE-O1: ; %bb.0:
2432 ; CHECK-OUTLINE-O1-NEXT: LBB33_1: ; %atomicrmw.start
2433 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2434 ; CHECK-OUTLINE-O1-NEXT: ldaxrb w8, [x0]
2435 ; CHECK-OUTLINE-O1-NEXT: sxtb w9, w8
2436 ; CHECK-OUTLINE-O1-NEXT: cmp w9, w1, sxtb
2437 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, lt
2438 ; CHECK-OUTLINE-O1-NEXT: stxrb w10, w9, [x0]
2439 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB33_1
2440 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2441 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
2442 ; CHECK-OUTLINE-O1-NEXT: ret
2444 ; CHECK-NOLSE-O0-LABEL: atomicrmw_min_i8:
2445 ; CHECK-NOLSE-O0: ; %bb.0:
2446 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2447 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2448 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2449 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2450 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2451 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2452 ; CHECK-NOLSE-O0-NEXT: b LBB33_1
2453 ; CHECK-NOLSE-O0-NEXT: LBB33_1: ; %atomicrmw.start
2454 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2455 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB33_2 Depth 2
2456 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2457 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2458 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2459 ; CHECK-NOLSE-O0-NEXT: sxtb w9, w10
2460 ; CHECK-NOLSE-O0-NEXT: subs w9, w9, w8, sxtb
2461 ; CHECK-NOLSE-O0-NEXT: csel w12, w10, w8, le
2462 ; CHECK-NOLSE-O0-NEXT: LBB33_2: ; %atomicrmw.start
2463 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB33_1 Depth=1
2464 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2465 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2466 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2467 ; CHECK-NOLSE-O0-NEXT: b.ne LBB33_4
2468 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2469 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB33_2 Depth=2
2470 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2471 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB33_2
2472 ; CHECK-NOLSE-O0-NEXT: LBB33_4: ; %atomicrmw.start
2473 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB33_1 Depth=1
2474 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2475 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2476 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2477 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2478 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2479 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB33_1
2480 ; CHECK-NOLSE-O0-NEXT: b LBB33_5
2481 ; CHECK-NOLSE-O0-NEXT: LBB33_5: ; %atomicrmw.end
2482 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2483 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2484 ; CHECK-NOLSE-O0-NEXT: ret
2486 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_min_i8:
2487 ; CHECK-OUTLINE-O0: ; %bb.0:
2488 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
2489 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
2490 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
2491 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2492 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2493 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2494 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2495 ; CHECK-OUTLINE-O0-NEXT: ldrb w0, [x0]
2496 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2497 ; CHECK-OUTLINE-O0-NEXT: b LBB33_1
2498 ; CHECK-OUTLINE-O0-NEXT: LBB33_1: ; %atomicrmw.start
2499 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
2500 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
2501 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
2502 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2503 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
2504 ; CHECK-OUTLINE-O0-NEXT: sxtb w9, w0
2505 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, sxtb
2506 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, le
2507 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas1_acq
2508 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [sp, #8] ; 4-byte Folded Reload
2509 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
2510 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xff
2511 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w9, uxtb
2512 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
2513 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2514 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB33_1
2515 ; CHECK-OUTLINE-O0-NEXT: b LBB33_2
2516 ; CHECK-OUTLINE-O0-NEXT: LBB33_2: ; %atomicrmw.end
2517 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2518 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
2519 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
2520 ; CHECK-OUTLINE-O0-NEXT: ret
2522 ; CHECK-LSE-O1-LABEL: atomicrmw_min_i8:
2523 ; CHECK-LSE-O1: ; %bb.0:
2524 ; CHECK-LSE-O1-NEXT: ldsminab w1, w0, [x0]
2525 ; CHECK-LSE-O1-NEXT: ret
2527 ; CHECK-LSE-O0-LABEL: atomicrmw_min_i8:
2528 ; CHECK-LSE-O0: ; %bb.0:
2529 ; CHECK-LSE-O0-NEXT: ldsminab w1, w0, [x0]
2530 ; CHECK-LSE-O0-NEXT: ret
2531 %res = atomicrmw min ptr %ptr, i8 %rhs acquire
2535 define i8 @atomicrmw_max_i8(ptr %ptr, i8 %rhs) {
2536 ; CHECK-NOLSE-O1-LABEL: atomicrmw_max_i8:
2537 ; CHECK-NOLSE-O1: ; %bb.0:
2538 ; CHECK-NOLSE-O1-NEXT: LBB34_1: ; %atomicrmw.start
2539 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2540 ; CHECK-NOLSE-O1-NEXT: ldxrb w8, [x0]
2541 ; CHECK-NOLSE-O1-NEXT: sxtb w9, w8
2542 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, sxtb
2543 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, gt
2544 ; CHECK-NOLSE-O1-NEXT: stlxrb w10, w9, [x0]
2545 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB34_1
2546 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2547 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2548 ; CHECK-NOLSE-O1-NEXT: ret
2550 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_max_i8:
2551 ; CHECK-OUTLINE-O1: ; %bb.0:
2552 ; CHECK-OUTLINE-O1-NEXT: LBB34_1: ; %atomicrmw.start
2553 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2554 ; CHECK-OUTLINE-O1-NEXT: ldxrb w8, [x0]
2555 ; CHECK-OUTLINE-O1-NEXT: sxtb w9, w8
2556 ; CHECK-OUTLINE-O1-NEXT: cmp w9, w1, sxtb
2557 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, gt
2558 ; CHECK-OUTLINE-O1-NEXT: stlxrb w10, w9, [x0]
2559 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB34_1
2560 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2561 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
2562 ; CHECK-OUTLINE-O1-NEXT: ret
2564 ; CHECK-NOLSE-O0-LABEL: atomicrmw_max_i8:
2565 ; CHECK-NOLSE-O0: ; %bb.0:
2566 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2567 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2568 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2569 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2570 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2571 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2572 ; CHECK-NOLSE-O0-NEXT: b LBB34_1
2573 ; CHECK-NOLSE-O0-NEXT: LBB34_1: ; %atomicrmw.start
2574 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2575 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB34_2 Depth 2
2576 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2577 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2578 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2579 ; CHECK-NOLSE-O0-NEXT: sxtb w9, w10
2580 ; CHECK-NOLSE-O0-NEXT: subs w9, w9, w8, sxtb
2581 ; CHECK-NOLSE-O0-NEXT: csel w12, w10, w8, gt
2582 ; CHECK-NOLSE-O0-NEXT: LBB34_2: ; %atomicrmw.start
2583 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB34_1 Depth=1
2584 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2585 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2586 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2587 ; CHECK-NOLSE-O0-NEXT: b.ne LBB34_4
2588 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2589 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB34_2 Depth=2
2590 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2591 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB34_2
2592 ; CHECK-NOLSE-O0-NEXT: LBB34_4: ; %atomicrmw.start
2593 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB34_1 Depth=1
2594 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2595 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2596 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2597 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2598 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2599 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB34_1
2600 ; CHECK-NOLSE-O0-NEXT: b LBB34_5
2601 ; CHECK-NOLSE-O0-NEXT: LBB34_5: ; %atomicrmw.end
2602 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2603 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2604 ; CHECK-NOLSE-O0-NEXT: ret
2606 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_max_i8:
2607 ; CHECK-OUTLINE-O0: ; %bb.0:
2608 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
2609 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
2610 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
2611 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2612 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2613 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2614 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2615 ; CHECK-OUTLINE-O0-NEXT: ldrb w0, [x0]
2616 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2617 ; CHECK-OUTLINE-O0-NEXT: b LBB34_1
2618 ; CHECK-OUTLINE-O0-NEXT: LBB34_1: ; %atomicrmw.start
2619 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
2620 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
2621 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
2622 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2623 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
2624 ; CHECK-OUTLINE-O0-NEXT: sxtb w9, w0
2625 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, sxtb
2626 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, gt
2627 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas1_rel
2628 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [sp, #8] ; 4-byte Folded Reload
2629 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
2630 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xff
2631 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w9, uxtb
2632 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
2633 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2634 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB34_1
2635 ; CHECK-OUTLINE-O0-NEXT: b LBB34_2
2636 ; CHECK-OUTLINE-O0-NEXT: LBB34_2: ; %atomicrmw.end
2637 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2638 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
2639 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
2640 ; CHECK-OUTLINE-O0-NEXT: ret
2642 ; CHECK-LSE-O1-LABEL: atomicrmw_max_i8:
2643 ; CHECK-LSE-O1: ; %bb.0:
2644 ; CHECK-LSE-O1-NEXT: ldsmaxlb w1, w0, [x0]
2645 ; CHECK-LSE-O1-NEXT: ret
2647 ; CHECK-LSE-O0-LABEL: atomicrmw_max_i8:
2648 ; CHECK-LSE-O0: ; %bb.0:
2649 ; CHECK-LSE-O0-NEXT: ldsmaxlb w1, w0, [x0]
2650 ; CHECK-LSE-O0-NEXT: ret
2651 %res = atomicrmw max ptr %ptr, i8 %rhs release
2655 define i8 @atomicrmw_umin_i8(ptr %ptr, i8 %rhs) {
2656 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umin_i8:
2657 ; CHECK-NOLSE-O1: ; %bb.0:
2658 ; CHECK-NOLSE-O1-NEXT: and w9, w1, #0xff
2659 ; CHECK-NOLSE-O1-NEXT: LBB35_1: ; %atomicrmw.start
2660 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2661 ; CHECK-NOLSE-O1-NEXT: ldaxrb w8, [x0]
2662 ; CHECK-NOLSE-O1-NEXT: and w10, w8, #0xff
2663 ; CHECK-NOLSE-O1-NEXT: cmp w10, w9
2664 ; CHECK-NOLSE-O1-NEXT: csel w10, w10, w9, lo
2665 ; CHECK-NOLSE-O1-NEXT: stlxrb w11, w10, [x0]
2666 ; CHECK-NOLSE-O1-NEXT: cbnz w11, LBB35_1
2667 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2668 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2669 ; CHECK-NOLSE-O1-NEXT: ret
2671 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umin_i8:
2672 ; CHECK-OUTLINE-O1: ; %bb.0:
2673 ; CHECK-OUTLINE-O1-NEXT: and w9, w1, #0xff
2674 ; CHECK-OUTLINE-O1-NEXT: LBB35_1: ; %atomicrmw.start
2675 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2676 ; CHECK-OUTLINE-O1-NEXT: ldaxrb w8, [x0]
2677 ; CHECK-OUTLINE-O1-NEXT: and w10, w8, #0xff
2678 ; CHECK-OUTLINE-O1-NEXT: cmp w10, w9
2679 ; CHECK-OUTLINE-O1-NEXT: csel w10, w10, w9, lo
2680 ; CHECK-OUTLINE-O1-NEXT: stlxrb w11, w10, [x0]
2681 ; CHECK-OUTLINE-O1-NEXT: cbnz w11, LBB35_1
2682 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2683 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
2684 ; CHECK-OUTLINE-O1-NEXT: ret
2686 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umin_i8:
2687 ; CHECK-NOLSE-O0: ; %bb.0:
2688 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2689 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2690 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2691 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2692 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2693 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2694 ; CHECK-NOLSE-O0-NEXT: b LBB35_1
2695 ; CHECK-NOLSE-O0-NEXT: LBB35_1: ; %atomicrmw.start
2696 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2697 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB35_2 Depth 2
2698 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2699 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2700 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2701 ; CHECK-NOLSE-O0-NEXT: and w9, w10, #0xff
2702 ; CHECK-NOLSE-O0-NEXT: subs w9, w9, w8, uxtb
2703 ; CHECK-NOLSE-O0-NEXT: csel w12, w10, w8, ls
2704 ; CHECK-NOLSE-O0-NEXT: LBB35_2: ; %atomicrmw.start
2705 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB35_1 Depth=1
2706 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2707 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2708 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2709 ; CHECK-NOLSE-O0-NEXT: b.ne LBB35_4
2710 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2711 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB35_2 Depth=2
2712 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2713 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB35_2
2714 ; CHECK-NOLSE-O0-NEXT: LBB35_4: ; %atomicrmw.start
2715 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB35_1 Depth=1
2716 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2717 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2718 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2719 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2720 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2721 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB35_1
2722 ; CHECK-NOLSE-O0-NEXT: b LBB35_5
2723 ; CHECK-NOLSE-O0-NEXT: LBB35_5: ; %atomicrmw.end
2724 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2725 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2726 ; CHECK-NOLSE-O0-NEXT: ret
2728 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umin_i8:
2729 ; CHECK-OUTLINE-O0: ; %bb.0:
2730 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
2731 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
2732 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
2733 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2734 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2735 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2736 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2737 ; CHECK-OUTLINE-O0-NEXT: ldrb w0, [x0]
2738 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2739 ; CHECK-OUTLINE-O0-NEXT: b LBB35_1
2740 ; CHECK-OUTLINE-O0-NEXT: LBB35_1: ; %atomicrmw.start
2741 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
2742 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
2743 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
2744 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2745 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
2746 ; CHECK-OUTLINE-O0-NEXT: and w9, w0, #0xff
2747 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, uxtb
2748 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, ls
2749 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas1_acq_rel
2750 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [sp, #8] ; 4-byte Folded Reload
2751 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
2752 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xff
2753 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w9, uxtb
2754 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
2755 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2756 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB35_1
2757 ; CHECK-OUTLINE-O0-NEXT: b LBB35_2
2758 ; CHECK-OUTLINE-O0-NEXT: LBB35_2: ; %atomicrmw.end
2759 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2760 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
2761 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
2762 ; CHECK-OUTLINE-O0-NEXT: ret
2764 ; CHECK-LSE-O1-LABEL: atomicrmw_umin_i8:
2765 ; CHECK-LSE-O1: ; %bb.0:
2766 ; CHECK-LSE-O1-NEXT: lduminalb w1, w0, [x0]
2767 ; CHECK-LSE-O1-NEXT: ret
2769 ; CHECK-LSE-O0-LABEL: atomicrmw_umin_i8:
2770 ; CHECK-LSE-O0: ; %bb.0:
2771 ; CHECK-LSE-O0-NEXT: lduminalb w1, w0, [x0]
2772 ; CHECK-LSE-O0-NEXT: ret
2773 %res = atomicrmw umin ptr %ptr, i8 %rhs seq_cst
2777 define i8 @atomicrmw_umax_i8(ptr %ptr, i8 %rhs) {
2778 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umax_i8:
2779 ; CHECK-NOLSE-O1: ; %bb.0:
2780 ; CHECK-NOLSE-O1-NEXT: and w9, w1, #0xff
2781 ; CHECK-NOLSE-O1-NEXT: LBB36_1: ; %atomicrmw.start
2782 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2783 ; CHECK-NOLSE-O1-NEXT: ldxrb w8, [x0]
2784 ; CHECK-NOLSE-O1-NEXT: and w10, w8, #0xff
2785 ; CHECK-NOLSE-O1-NEXT: cmp w10, w9
2786 ; CHECK-NOLSE-O1-NEXT: csel w10, w10, w9, hi
2787 ; CHECK-NOLSE-O1-NEXT: stxrb w11, w10, [x0]
2788 ; CHECK-NOLSE-O1-NEXT: cbnz w11, LBB36_1
2789 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2790 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2791 ; CHECK-NOLSE-O1-NEXT: ret
2793 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umax_i8:
2794 ; CHECK-OUTLINE-O1: ; %bb.0:
2795 ; CHECK-OUTLINE-O1-NEXT: and w9, w1, #0xff
2796 ; CHECK-OUTLINE-O1-NEXT: LBB36_1: ; %atomicrmw.start
2797 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2798 ; CHECK-OUTLINE-O1-NEXT: ldxrb w8, [x0]
2799 ; CHECK-OUTLINE-O1-NEXT: and w10, w8, #0xff
2800 ; CHECK-OUTLINE-O1-NEXT: cmp w10, w9
2801 ; CHECK-OUTLINE-O1-NEXT: csel w10, w10, w9, hi
2802 ; CHECK-OUTLINE-O1-NEXT: stxrb w11, w10, [x0]
2803 ; CHECK-OUTLINE-O1-NEXT: cbnz w11, LBB36_1
2804 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2805 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
2806 ; CHECK-OUTLINE-O1-NEXT: ret
2808 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umax_i8:
2809 ; CHECK-NOLSE-O0: ; %bb.0:
2810 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2811 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2812 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2813 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2814 ; CHECK-NOLSE-O0-NEXT: ldrb w8, [x0]
2815 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2816 ; CHECK-NOLSE-O0-NEXT: b LBB36_1
2817 ; CHECK-NOLSE-O0-NEXT: LBB36_1: ; %atomicrmw.start
2818 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2819 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB36_2 Depth 2
2820 ; CHECK-NOLSE-O0-NEXT: ldr w10, [sp, #28] ; 4-byte Folded Reload
2821 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2822 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2823 ; CHECK-NOLSE-O0-NEXT: and w9, w10, #0xff
2824 ; CHECK-NOLSE-O0-NEXT: subs w9, w9, w8, uxtb
2825 ; CHECK-NOLSE-O0-NEXT: csel w12, w10, w8, hi
2826 ; CHECK-NOLSE-O0-NEXT: LBB36_2: ; %atomicrmw.start
2827 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB36_1 Depth=1
2828 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2829 ; CHECK-NOLSE-O0-NEXT: ldaxrb w9, [x11]
2830 ; CHECK-NOLSE-O0-NEXT: cmp w9, w10, uxtb
2831 ; CHECK-NOLSE-O0-NEXT: b.ne LBB36_4
2832 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2833 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB36_2 Depth=2
2834 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w12, [x11]
2835 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB36_2
2836 ; CHECK-NOLSE-O0-NEXT: LBB36_4: ; %atomicrmw.start
2837 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB36_1 Depth=1
2838 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2839 ; CHECK-NOLSE-O0-NEXT: and w8, w9, #0xff
2840 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w10, uxtb
2841 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2842 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2843 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB36_1
2844 ; CHECK-NOLSE-O0-NEXT: b LBB36_5
2845 ; CHECK-NOLSE-O0-NEXT: LBB36_5: ; %atomicrmw.end
2846 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2847 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2848 ; CHECK-NOLSE-O0-NEXT: ret
2850 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umax_i8:
2851 ; CHECK-OUTLINE-O0: ; %bb.0:
2852 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
2853 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
2854 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
2855 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2856 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2857 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2858 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2859 ; CHECK-OUTLINE-O0-NEXT: ldrb w0, [x0]
2860 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2861 ; CHECK-OUTLINE-O0-NEXT: b LBB36_1
2862 ; CHECK-OUTLINE-O0-NEXT: LBB36_1: ; %atomicrmw.start
2863 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
2864 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
2865 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
2866 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
2867 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
2868 ; CHECK-OUTLINE-O0-NEXT: and w9, w0, #0xff
2869 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, uxtb
2870 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, hi
2871 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas1_relax
2872 ; CHECK-OUTLINE-O0-NEXT: ldr w9, [sp, #8] ; 4-byte Folded Reload
2873 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
2874 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xff
2875 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w9, uxtb
2876 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
2877 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
2878 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB36_1
2879 ; CHECK-OUTLINE-O0-NEXT: b LBB36_2
2880 ; CHECK-OUTLINE-O0-NEXT: LBB36_2: ; %atomicrmw.end
2881 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2882 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
2883 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
2884 ; CHECK-OUTLINE-O0-NEXT: ret
2886 ; CHECK-LSE-O1-LABEL: atomicrmw_umax_i8:
2887 ; CHECK-LSE-O1: ; %bb.0:
2888 ; CHECK-LSE-O1-NEXT: ldumaxb w1, w0, [x0]
2889 ; CHECK-LSE-O1-NEXT: ret
2891 ; CHECK-LSE-O0-LABEL: atomicrmw_umax_i8:
2892 ; CHECK-LSE-O0: ; %bb.0:
2893 ; CHECK-LSE-O0-NEXT: ldumaxb w1, w0, [x0]
2894 ; CHECK-LSE-O0-NEXT: ret
2895 %res = atomicrmw umax ptr %ptr, i8 %rhs monotonic
2899 define i16 @atomicrmw_add_i16(ptr %ptr, i16 %rhs) {
2900 ; CHECK-NOLSE-O1-LABEL: atomicrmw_add_i16:
2901 ; CHECK-NOLSE-O1: ; %bb.0:
2902 ; CHECK-NOLSE-O1-NEXT: LBB37_1: ; %atomicrmw.start
2903 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2904 ; CHECK-NOLSE-O1-NEXT: ldaxrh w8, [x0]
2905 ; CHECK-NOLSE-O1-NEXT: add w9, w8, w1
2906 ; CHECK-NOLSE-O1-NEXT: stlxrh w10, w9, [x0]
2907 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB37_1
2908 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
2909 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
2910 ; CHECK-NOLSE-O1-NEXT: ret
2912 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_add_i16:
2913 ; CHECK-OUTLINE-O1: ; %bb.0:
2914 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
2915 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
2916 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
2917 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
2918 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
2919 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
2920 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
2921 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd2_acq_rel
2922 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
2923 ; CHECK-OUTLINE-O1-NEXT: ret
2925 ; CHECK-NOLSE-O0-LABEL: atomicrmw_add_i16:
2926 ; CHECK-NOLSE-O0: ; %bb.0:
2927 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
2928 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
2929 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
2930 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
2931 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
2932 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
2933 ; CHECK-NOLSE-O0-NEXT: b LBB37_1
2934 ; CHECK-NOLSE-O0-NEXT: LBB37_1: ; %atomicrmw.start
2935 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
2936 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB37_2 Depth 2
2937 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
2938 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
2939 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
2940 ; CHECK-NOLSE-O0-NEXT: add w12, w9, w8, uxth
2941 ; CHECK-NOLSE-O0-NEXT: LBB37_2: ; %atomicrmw.start
2942 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB37_1 Depth=1
2943 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
2944 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
2945 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
2946 ; CHECK-NOLSE-O0-NEXT: b.ne LBB37_4
2947 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
2948 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB37_2 Depth=2
2949 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
2950 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB37_2
2951 ; CHECK-NOLSE-O0-NEXT: LBB37_4: ; %atomicrmw.start
2952 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB37_1 Depth=1
2953 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
2954 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
2955 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
2956 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
2957 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
2958 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB37_1
2959 ; CHECK-NOLSE-O0-NEXT: b LBB37_5
2960 ; CHECK-NOLSE-O0-NEXT: LBB37_5: ; %atomicrmw.end
2961 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
2962 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
2963 ; CHECK-NOLSE-O0-NEXT: ret
2965 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_add_i16:
2966 ; CHECK-OUTLINE-O0: ; %bb.0:
2967 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
2968 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
2969 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
2970 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
2971 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
2972 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
2973 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
2974 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
2975 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd2_acq_rel
2976 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
2977 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
2978 ; CHECK-OUTLINE-O0-NEXT: ret
2980 ; CHECK-LSE-O1-LABEL: atomicrmw_add_i16:
2981 ; CHECK-LSE-O1: ; %bb.0:
2982 ; CHECK-LSE-O1-NEXT: ldaddalh w1, w0, [x0]
2983 ; CHECK-LSE-O1-NEXT: ret
2985 ; CHECK-LSE-O0-LABEL: atomicrmw_add_i16:
2986 ; CHECK-LSE-O0: ; %bb.0:
2987 ; CHECK-LSE-O0-NEXT: ldaddalh w1, w0, [x0]
2988 ; CHECK-LSE-O0-NEXT: ret
2989 %res = atomicrmw add ptr %ptr, i16 %rhs seq_cst
2993 define i16 @atomicrmw_xchg_i16(ptr %ptr, i16 %rhs) {
2994 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xchg_i16:
2995 ; CHECK-NOLSE-O1: ; %bb.0:
2996 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w1 killed $w1 def $x1
2997 ; CHECK-NOLSE-O1-NEXT: LBB38_1: ; %atomicrmw.start
2998 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
2999 ; CHECK-NOLSE-O1-NEXT: ldxrh w8, [x0]
3000 ; CHECK-NOLSE-O1-NEXT: stxrh w9, w1, [x0]
3001 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB38_1
3002 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3003 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3004 ; CHECK-NOLSE-O1-NEXT: ret
3006 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xchg_i16:
3007 ; CHECK-OUTLINE-O1: ; %bb.0:
3008 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3009 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3010 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3011 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3012 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3013 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
3014 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3015 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_swp2_relax
3016 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3017 ; CHECK-OUTLINE-O1-NEXT: ret
3019 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xchg_i16:
3020 ; CHECK-NOLSE-O0: ; %bb.0:
3021 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3022 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3023 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3024 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3025 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3026 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3027 ; CHECK-NOLSE-O0-NEXT: b LBB38_1
3028 ; CHECK-NOLSE-O0-NEXT: LBB38_1: ; %atomicrmw.start
3029 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3030 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB38_2 Depth 2
3031 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3032 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3033 ; CHECK-NOLSE-O0-NEXT: ldr w12, [sp, #24] ; 4-byte Folded Reload
3034 ; CHECK-NOLSE-O0-NEXT: LBB38_2: ; %atomicrmw.start
3035 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB38_1 Depth=1
3036 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3037 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3038 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3039 ; CHECK-NOLSE-O0-NEXT: b.ne LBB38_4
3040 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3041 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB38_2 Depth=2
3042 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3043 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB38_2
3044 ; CHECK-NOLSE-O0-NEXT: LBB38_4: ; %atomicrmw.start
3045 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB38_1 Depth=1
3046 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3047 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3048 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3049 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3050 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3051 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB38_1
3052 ; CHECK-NOLSE-O0-NEXT: b LBB38_5
3053 ; CHECK-NOLSE-O0-NEXT: LBB38_5: ; %atomicrmw.end
3054 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3055 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3056 ; CHECK-NOLSE-O0-NEXT: ret
3058 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xchg_i16:
3059 ; CHECK-OUTLINE-O0: ; %bb.0:
3060 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
3061 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
3062 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
3063 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3064 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3065 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
3066 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
3067 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
3068 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_swp2_relax
3069 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
3070 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
3071 ; CHECK-OUTLINE-O0-NEXT: ret
3073 ; CHECK-LSE-O1-LABEL: atomicrmw_xchg_i16:
3074 ; CHECK-LSE-O1: ; %bb.0:
3075 ; CHECK-LSE-O1-NEXT: swph w1, w0, [x0]
3076 ; CHECK-LSE-O1-NEXT: ret
3078 ; CHECK-LSE-O0-LABEL: atomicrmw_xchg_i16:
3079 ; CHECK-LSE-O0: ; %bb.0:
3080 ; CHECK-LSE-O0-NEXT: swph w1, w0, [x0]
3081 ; CHECK-LSE-O0-NEXT: ret
3082 %res = atomicrmw xchg ptr %ptr, i16 %rhs monotonic
3086 define i16 @atomicrmw_sub_i16(ptr %ptr, i16 %rhs) {
3087 ; CHECK-NOLSE-O1-LABEL: atomicrmw_sub_i16:
3088 ; CHECK-NOLSE-O1: ; %bb.0:
3089 ; CHECK-NOLSE-O1-NEXT: LBB39_1: ; %atomicrmw.start
3090 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3091 ; CHECK-NOLSE-O1-NEXT: ldaxrh w8, [x0]
3092 ; CHECK-NOLSE-O1-NEXT: sub w9, w8, w1
3093 ; CHECK-NOLSE-O1-NEXT: stxrh w10, w9, [x0]
3094 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB39_1
3095 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3096 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3097 ; CHECK-NOLSE-O1-NEXT: ret
3099 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_sub_i16:
3100 ; CHECK-OUTLINE-O1: ; %bb.0:
3101 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3102 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3103 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3104 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3105 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3106 ; CHECK-OUTLINE-O1-NEXT: neg w0, w1
3107 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3108 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd2_acq
3109 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3110 ; CHECK-OUTLINE-O1-NEXT: ret
3112 ; CHECK-NOLSE-O0-LABEL: atomicrmw_sub_i16:
3113 ; CHECK-NOLSE-O0: ; %bb.0:
3114 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3115 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3116 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3117 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3118 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3119 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3120 ; CHECK-NOLSE-O0-NEXT: b LBB39_1
3121 ; CHECK-NOLSE-O0-NEXT: LBB39_1: ; %atomicrmw.start
3122 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3123 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB39_2 Depth 2
3124 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3125 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3126 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3127 ; CHECK-NOLSE-O0-NEXT: subs w12, w8, w9
3128 ; CHECK-NOLSE-O0-NEXT: LBB39_2: ; %atomicrmw.start
3129 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB39_1 Depth=1
3130 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3131 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3132 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3133 ; CHECK-NOLSE-O0-NEXT: b.ne LBB39_4
3134 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3135 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB39_2 Depth=2
3136 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3137 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB39_2
3138 ; CHECK-NOLSE-O0-NEXT: LBB39_4: ; %atomicrmw.start
3139 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB39_1 Depth=1
3140 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3141 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3142 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3143 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3144 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3145 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB39_1
3146 ; CHECK-NOLSE-O0-NEXT: b LBB39_5
3147 ; CHECK-NOLSE-O0-NEXT: LBB39_5: ; %atomicrmw.end
3148 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3149 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3150 ; CHECK-NOLSE-O0-NEXT: ret
3152 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_sub_i16:
3153 ; CHECK-OUTLINE-O0: ; %bb.0:
3154 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
3155 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
3156 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
3157 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3158 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3159 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
3160 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
3161 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
3162 ; CHECK-OUTLINE-O0-NEXT: mov w8, wzr
3163 ; CHECK-OUTLINE-O0-NEXT: subs w0, w8, w9
3164 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd2_acq
3165 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
3166 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
3167 ; CHECK-OUTLINE-O0-NEXT: ret
3169 ; CHECK-LSE-O1-LABEL: atomicrmw_sub_i16:
3170 ; CHECK-LSE-O1: ; %bb.0:
3171 ; CHECK-LSE-O1-NEXT: neg w8, w1
3172 ; CHECK-LSE-O1-NEXT: ldaddah w8, w0, [x0]
3173 ; CHECK-LSE-O1-NEXT: ret
3175 ; CHECK-LSE-O0-LABEL: atomicrmw_sub_i16:
3176 ; CHECK-LSE-O0: ; %bb.0:
3177 ; CHECK-LSE-O0-NEXT: neg w8, w1
3178 ; CHECK-LSE-O0-NEXT: ldaddah w8, w0, [x0]
3179 ; CHECK-LSE-O0-NEXT: ret
3180 %res = atomicrmw sub ptr %ptr, i16 %rhs acquire
3184 define i16 @atomicrmw_and_i16(ptr %ptr, i16 %rhs) {
3185 ; CHECK-NOLSE-O1-LABEL: atomicrmw_and_i16:
3186 ; CHECK-NOLSE-O1: ; %bb.0:
3187 ; CHECK-NOLSE-O1-NEXT: LBB40_1: ; %atomicrmw.start
3188 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3189 ; CHECK-NOLSE-O1-NEXT: ldxrh w8, [x0]
3190 ; CHECK-NOLSE-O1-NEXT: and w9, w8, w1
3191 ; CHECK-NOLSE-O1-NEXT: stlxrh w10, w9, [x0]
3192 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB40_1
3193 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3194 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3195 ; CHECK-NOLSE-O1-NEXT: ret
3197 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_and_i16:
3198 ; CHECK-OUTLINE-O1: ; %bb.0:
3199 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3200 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3201 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3202 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3203 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3204 ; CHECK-OUTLINE-O1-NEXT: mvn w0, w1
3205 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3206 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr2_rel
3207 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3208 ; CHECK-OUTLINE-O1-NEXT: ret
3210 ; CHECK-NOLSE-O0-LABEL: atomicrmw_and_i16:
3211 ; CHECK-NOLSE-O0: ; %bb.0:
3212 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3213 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3214 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3215 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3216 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3217 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3218 ; CHECK-NOLSE-O0-NEXT: b LBB40_1
3219 ; CHECK-NOLSE-O0-NEXT: LBB40_1: ; %atomicrmw.start
3220 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3221 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB40_2 Depth 2
3222 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3223 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3224 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3225 ; CHECK-NOLSE-O0-NEXT: and w12, w8, w9
3226 ; CHECK-NOLSE-O0-NEXT: LBB40_2: ; %atomicrmw.start
3227 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB40_1 Depth=1
3228 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3229 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3230 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3231 ; CHECK-NOLSE-O0-NEXT: b.ne LBB40_4
3232 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3233 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB40_2 Depth=2
3234 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3235 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB40_2
3236 ; CHECK-NOLSE-O0-NEXT: LBB40_4: ; %atomicrmw.start
3237 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB40_1 Depth=1
3238 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3239 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3240 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3241 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3242 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3243 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB40_1
3244 ; CHECK-NOLSE-O0-NEXT: b LBB40_5
3245 ; CHECK-NOLSE-O0-NEXT: LBB40_5: ; %atomicrmw.end
3246 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3247 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3248 ; CHECK-NOLSE-O0-NEXT: ret
3250 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_and_i16:
3251 ; CHECK-OUTLINE-O0: ; %bb.0:
3252 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
3253 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
3254 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
3255 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3256 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3257 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
3258 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
3259 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
3260 ; CHECK-OUTLINE-O0-NEXT: mov w8, #-1 ; =0xffffffff
3261 ; CHECK-OUTLINE-O0-NEXT: eor w0, w8, w9
3262 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldclr2_rel
3263 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
3264 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
3265 ; CHECK-OUTLINE-O0-NEXT: ret
3267 ; CHECK-LSE-O1-LABEL: atomicrmw_and_i16:
3268 ; CHECK-LSE-O1: ; %bb.0:
3269 ; CHECK-LSE-O1-NEXT: mvn w8, w1
3270 ; CHECK-LSE-O1-NEXT: ldclrlh w8, w0, [x0]
3271 ; CHECK-LSE-O1-NEXT: ret
3273 ; CHECK-LSE-O0-LABEL: atomicrmw_and_i16:
3274 ; CHECK-LSE-O0: ; %bb.0:
3275 ; CHECK-LSE-O0-NEXT: mvn w8, w1
3276 ; CHECK-LSE-O0-NEXT: ldclrlh w8, w0, [x0]
3277 ; CHECK-LSE-O0-NEXT: ret
3278 %res = atomicrmw and ptr %ptr, i16 %rhs release
3282 define i16 @atomicrmw_or_i16(ptr %ptr, i16 %rhs) {
3283 ; CHECK-NOLSE-O1-LABEL: atomicrmw_or_i16:
3284 ; CHECK-NOLSE-O1: ; %bb.0:
3285 ; CHECK-NOLSE-O1-NEXT: LBB41_1: ; %atomicrmw.start
3286 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3287 ; CHECK-NOLSE-O1-NEXT: ldaxrh w8, [x0]
3288 ; CHECK-NOLSE-O1-NEXT: orr w9, w8, w1
3289 ; CHECK-NOLSE-O1-NEXT: stlxrh w10, w9, [x0]
3290 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB41_1
3291 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3292 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3293 ; CHECK-NOLSE-O1-NEXT: ret
3295 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_or_i16:
3296 ; CHECK-OUTLINE-O1: ; %bb.0:
3297 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3298 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3299 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3300 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3301 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3302 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
3303 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3304 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldset2_acq_rel
3305 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3306 ; CHECK-OUTLINE-O1-NEXT: ret
3308 ; CHECK-NOLSE-O0-LABEL: atomicrmw_or_i16:
3309 ; CHECK-NOLSE-O0: ; %bb.0:
3310 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3311 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3312 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3313 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3314 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3315 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3316 ; CHECK-NOLSE-O0-NEXT: b LBB41_1
3317 ; CHECK-NOLSE-O0-NEXT: LBB41_1: ; %atomicrmw.start
3318 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3319 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB41_2 Depth 2
3320 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3321 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3322 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3323 ; CHECK-NOLSE-O0-NEXT: orr w12, w8, w9
3324 ; CHECK-NOLSE-O0-NEXT: LBB41_2: ; %atomicrmw.start
3325 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB41_1 Depth=1
3326 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3327 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3328 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3329 ; CHECK-NOLSE-O0-NEXT: b.ne LBB41_4
3330 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3331 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB41_2 Depth=2
3332 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3333 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB41_2
3334 ; CHECK-NOLSE-O0-NEXT: LBB41_4: ; %atomicrmw.start
3335 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB41_1 Depth=1
3336 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3337 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3338 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3339 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3340 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3341 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB41_1
3342 ; CHECK-NOLSE-O0-NEXT: b LBB41_5
3343 ; CHECK-NOLSE-O0-NEXT: LBB41_5: ; %atomicrmw.end
3344 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3345 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3346 ; CHECK-NOLSE-O0-NEXT: ret
3348 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_or_i16:
3349 ; CHECK-OUTLINE-O0: ; %bb.0:
3350 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
3351 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
3352 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
3353 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3354 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3355 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
3356 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
3357 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
3358 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldset2_acq_rel
3359 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
3360 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
3361 ; CHECK-OUTLINE-O0-NEXT: ret
3363 ; CHECK-LSE-O1-LABEL: atomicrmw_or_i16:
3364 ; CHECK-LSE-O1: ; %bb.0:
3365 ; CHECK-LSE-O1-NEXT: ldsetalh w1, w0, [x0]
3366 ; CHECK-LSE-O1-NEXT: ret
3368 ; CHECK-LSE-O0-LABEL: atomicrmw_or_i16:
3369 ; CHECK-LSE-O0: ; %bb.0:
3370 ; CHECK-LSE-O0-NEXT: ldsetalh w1, w0, [x0]
3371 ; CHECK-LSE-O0-NEXT: ret
3372 %res = atomicrmw or ptr %ptr, i16 %rhs seq_cst
3376 define i16 @atomicrmw_xor_i16(ptr %ptr, i16 %rhs) {
3377 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xor_i16:
3378 ; CHECK-NOLSE-O1: ; %bb.0:
3379 ; CHECK-NOLSE-O1-NEXT: LBB42_1: ; %atomicrmw.start
3380 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3381 ; CHECK-NOLSE-O1-NEXT: ldxrh w8, [x0]
3382 ; CHECK-NOLSE-O1-NEXT: eor w9, w8, w1
3383 ; CHECK-NOLSE-O1-NEXT: stxrh w10, w9, [x0]
3384 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB42_1
3385 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3386 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3387 ; CHECK-NOLSE-O1-NEXT: ret
3389 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xor_i16:
3390 ; CHECK-OUTLINE-O1: ; %bb.0:
3391 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3392 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3393 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3394 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3395 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3396 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
3397 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3398 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldeor2_relax
3399 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3400 ; CHECK-OUTLINE-O1-NEXT: ret
3402 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xor_i16:
3403 ; CHECK-NOLSE-O0: ; %bb.0:
3404 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3405 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3406 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3407 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3408 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3409 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3410 ; CHECK-NOLSE-O0-NEXT: b LBB42_1
3411 ; CHECK-NOLSE-O0-NEXT: LBB42_1: ; %atomicrmw.start
3412 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3413 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB42_2 Depth 2
3414 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3415 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3416 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3417 ; CHECK-NOLSE-O0-NEXT: eor w12, w8, w9
3418 ; CHECK-NOLSE-O0-NEXT: LBB42_2: ; %atomicrmw.start
3419 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB42_1 Depth=1
3420 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3421 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3422 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3423 ; CHECK-NOLSE-O0-NEXT: b.ne LBB42_4
3424 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3425 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB42_2 Depth=2
3426 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3427 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB42_2
3428 ; CHECK-NOLSE-O0-NEXT: LBB42_4: ; %atomicrmw.start
3429 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB42_1 Depth=1
3430 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3431 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3432 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3433 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3434 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3435 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB42_1
3436 ; CHECK-NOLSE-O0-NEXT: b LBB42_5
3437 ; CHECK-NOLSE-O0-NEXT: LBB42_5: ; %atomicrmw.end
3438 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3439 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3440 ; CHECK-NOLSE-O0-NEXT: ret
3442 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xor_i16:
3443 ; CHECK-OUTLINE-O0: ; %bb.0:
3444 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
3445 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
3446 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
3447 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3448 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3449 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
3450 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
3451 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
3452 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldeor2_relax
3453 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
3454 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
3455 ; CHECK-OUTLINE-O0-NEXT: ret
3457 ; CHECK-LSE-O1-LABEL: atomicrmw_xor_i16:
3458 ; CHECK-LSE-O1: ; %bb.0:
3459 ; CHECK-LSE-O1-NEXT: ldeorh w1, w0, [x0]
3460 ; CHECK-LSE-O1-NEXT: ret
3462 ; CHECK-LSE-O0-LABEL: atomicrmw_xor_i16:
3463 ; CHECK-LSE-O0: ; %bb.0:
3464 ; CHECK-LSE-O0-NEXT: ldeorh w1, w0, [x0]
3465 ; CHECK-LSE-O0-NEXT: ret
3466 %res = atomicrmw xor ptr %ptr, i16 %rhs monotonic
3470 define i16 @atomicrmw_min_i16(ptr %ptr, i16 %rhs) {
3471 ; CHECK-NOLSE-O1-LABEL: atomicrmw_min_i16:
3472 ; CHECK-NOLSE-O1: ; %bb.0:
3473 ; CHECK-NOLSE-O1-NEXT: LBB43_1: ; %atomicrmw.start
3474 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3475 ; CHECK-NOLSE-O1-NEXT: ldaxrh w8, [x0]
3476 ; CHECK-NOLSE-O1-NEXT: sxth w9, w8
3477 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, sxth
3478 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, lt
3479 ; CHECK-NOLSE-O1-NEXT: stxrh w10, w9, [x0]
3480 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB43_1
3481 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3482 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3483 ; CHECK-NOLSE-O1-NEXT: ret
3485 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_min_i16:
3486 ; CHECK-OUTLINE-O1: ; %bb.0:
3487 ; CHECK-OUTLINE-O1-NEXT: LBB43_1: ; %atomicrmw.start
3488 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3489 ; CHECK-OUTLINE-O1-NEXT: ldaxrh w8, [x0]
3490 ; CHECK-OUTLINE-O1-NEXT: sxth w9, w8
3491 ; CHECK-OUTLINE-O1-NEXT: cmp w9, w1, sxth
3492 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, lt
3493 ; CHECK-OUTLINE-O1-NEXT: stxrh w10, w9, [x0]
3494 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB43_1
3495 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3496 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
3497 ; CHECK-OUTLINE-O1-NEXT: ret
3499 ; CHECK-NOLSE-O0-LABEL: atomicrmw_min_i16:
3500 ; CHECK-NOLSE-O0: ; %bb.0:
3501 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3502 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3503 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3504 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3505 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3506 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3507 ; CHECK-NOLSE-O0-NEXT: b LBB43_1
3508 ; CHECK-NOLSE-O0-NEXT: LBB43_1: ; %atomicrmw.start
3509 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3510 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB43_2 Depth 2
3511 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3512 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3513 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3514 ; CHECK-NOLSE-O0-NEXT: sxth w10, w8
3515 ; CHECK-NOLSE-O0-NEXT: subs w10, w10, w9, sxth
3516 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, le
3517 ; CHECK-NOLSE-O0-NEXT: LBB43_2: ; %atomicrmw.start
3518 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB43_1 Depth=1
3519 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3520 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3521 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3522 ; CHECK-NOLSE-O0-NEXT: b.ne LBB43_4
3523 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3524 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB43_2 Depth=2
3525 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3526 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB43_2
3527 ; CHECK-NOLSE-O0-NEXT: LBB43_4: ; %atomicrmw.start
3528 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB43_1 Depth=1
3529 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3530 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3531 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3532 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3533 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3534 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB43_1
3535 ; CHECK-NOLSE-O0-NEXT: b LBB43_5
3536 ; CHECK-NOLSE-O0-NEXT: LBB43_5: ; %atomicrmw.end
3537 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3538 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3539 ; CHECK-NOLSE-O0-NEXT: ret
3541 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_min_i16:
3542 ; CHECK-OUTLINE-O0: ; %bb.0:
3543 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
3544 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
3545 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
3546 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3547 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3548 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3549 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3550 ; CHECK-OUTLINE-O0-NEXT: ldrh w0, [x0]
3551 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3552 ; CHECK-OUTLINE-O0-NEXT: b LBB43_1
3553 ; CHECK-OUTLINE-O0-NEXT: LBB43_1: ; %atomicrmw.start
3554 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
3555 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
3556 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
3557 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
3558 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
3559 ; CHECK-OUTLINE-O0-NEXT: sxth w9, w0
3560 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, sxth
3561 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, le
3562 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas2_acq
3563 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
3564 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
3565 ; CHECK-OUTLINE-O0-NEXT: uxth w8, w8
3566 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w0, uxth
3567 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
3568 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3569 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB43_1
3570 ; CHECK-OUTLINE-O0-NEXT: b LBB43_2
3571 ; CHECK-OUTLINE-O0-NEXT: LBB43_2: ; %atomicrmw.end
3572 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3573 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
3574 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
3575 ; CHECK-OUTLINE-O0-NEXT: ret
3577 ; CHECK-LSE-O1-LABEL: atomicrmw_min_i16:
3578 ; CHECK-LSE-O1: ; %bb.0:
3579 ; CHECK-LSE-O1-NEXT: ldsminah w1, w0, [x0]
3580 ; CHECK-LSE-O1-NEXT: ret
3582 ; CHECK-LSE-O0-LABEL: atomicrmw_min_i16:
3583 ; CHECK-LSE-O0: ; %bb.0:
3584 ; CHECK-LSE-O0-NEXT: ldsminah w1, w0, [x0]
3585 ; CHECK-LSE-O0-NEXT: ret
3586 %res = atomicrmw min ptr %ptr, i16 %rhs acquire
3590 define i16 @atomicrmw_max_i16(ptr %ptr, i16 %rhs) {
3591 ; CHECK-NOLSE-O1-LABEL: atomicrmw_max_i16:
3592 ; CHECK-NOLSE-O1: ; %bb.0:
3593 ; CHECK-NOLSE-O1-NEXT: LBB44_1: ; %atomicrmw.start
3594 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3595 ; CHECK-NOLSE-O1-NEXT: ldxrh w8, [x0]
3596 ; CHECK-NOLSE-O1-NEXT: sxth w9, w8
3597 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, sxth
3598 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, gt
3599 ; CHECK-NOLSE-O1-NEXT: stlxrh w10, w9, [x0]
3600 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB44_1
3601 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3602 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3603 ; CHECK-NOLSE-O1-NEXT: ret
3605 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_max_i16:
3606 ; CHECK-OUTLINE-O1: ; %bb.0:
3607 ; CHECK-OUTLINE-O1-NEXT: LBB44_1: ; %atomicrmw.start
3608 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3609 ; CHECK-OUTLINE-O1-NEXT: ldxrh w8, [x0]
3610 ; CHECK-OUTLINE-O1-NEXT: sxth w9, w8
3611 ; CHECK-OUTLINE-O1-NEXT: cmp w9, w1, sxth
3612 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, gt
3613 ; CHECK-OUTLINE-O1-NEXT: stlxrh w10, w9, [x0]
3614 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB44_1
3615 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3616 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
3617 ; CHECK-OUTLINE-O1-NEXT: ret
3619 ; CHECK-NOLSE-O0-LABEL: atomicrmw_max_i16:
3620 ; CHECK-NOLSE-O0: ; %bb.0:
3621 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3622 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3623 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3624 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3625 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3626 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3627 ; CHECK-NOLSE-O0-NEXT: b LBB44_1
3628 ; CHECK-NOLSE-O0-NEXT: LBB44_1: ; %atomicrmw.start
3629 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3630 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB44_2 Depth 2
3631 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3632 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3633 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3634 ; CHECK-NOLSE-O0-NEXT: sxth w10, w8
3635 ; CHECK-NOLSE-O0-NEXT: subs w10, w10, w9, sxth
3636 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, gt
3637 ; CHECK-NOLSE-O0-NEXT: LBB44_2: ; %atomicrmw.start
3638 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB44_1 Depth=1
3639 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3640 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3641 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3642 ; CHECK-NOLSE-O0-NEXT: b.ne LBB44_4
3643 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3644 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB44_2 Depth=2
3645 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3646 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB44_2
3647 ; CHECK-NOLSE-O0-NEXT: LBB44_4: ; %atomicrmw.start
3648 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB44_1 Depth=1
3649 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3650 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3651 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3652 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3653 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3654 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB44_1
3655 ; CHECK-NOLSE-O0-NEXT: b LBB44_5
3656 ; CHECK-NOLSE-O0-NEXT: LBB44_5: ; %atomicrmw.end
3657 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3658 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3659 ; CHECK-NOLSE-O0-NEXT: ret
3661 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_max_i16:
3662 ; CHECK-OUTLINE-O0: ; %bb.0:
3663 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
3664 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
3665 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
3666 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3667 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3668 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3669 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3670 ; CHECK-OUTLINE-O0-NEXT: ldrh w0, [x0]
3671 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3672 ; CHECK-OUTLINE-O0-NEXT: b LBB44_1
3673 ; CHECK-OUTLINE-O0-NEXT: LBB44_1: ; %atomicrmw.start
3674 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
3675 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
3676 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
3677 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
3678 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
3679 ; CHECK-OUTLINE-O0-NEXT: sxth w9, w0
3680 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, sxth
3681 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, gt
3682 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas2_rel
3683 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
3684 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
3685 ; CHECK-OUTLINE-O0-NEXT: uxth w8, w8
3686 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w0, uxth
3687 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
3688 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3689 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB44_1
3690 ; CHECK-OUTLINE-O0-NEXT: b LBB44_2
3691 ; CHECK-OUTLINE-O0-NEXT: LBB44_2: ; %atomicrmw.end
3692 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3693 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
3694 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
3695 ; CHECK-OUTLINE-O0-NEXT: ret
3697 ; CHECK-LSE-O1-LABEL: atomicrmw_max_i16:
3698 ; CHECK-LSE-O1: ; %bb.0:
3699 ; CHECK-LSE-O1-NEXT: ldsmaxlh w1, w0, [x0]
3700 ; CHECK-LSE-O1-NEXT: ret
3702 ; CHECK-LSE-O0-LABEL: atomicrmw_max_i16:
3703 ; CHECK-LSE-O0: ; %bb.0:
3704 ; CHECK-LSE-O0-NEXT: ldsmaxlh w1, w0, [x0]
3705 ; CHECK-LSE-O0-NEXT: ret
3706 %res = atomicrmw max ptr %ptr, i16 %rhs release
3710 define i16 @atomicrmw_umin_i16(ptr %ptr, i16 %rhs) {
3711 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umin_i16:
3712 ; CHECK-NOLSE-O1: ; %bb.0:
3713 ; CHECK-NOLSE-O1-NEXT: and w9, w1, #0xffff
3714 ; CHECK-NOLSE-O1-NEXT: LBB45_1: ; %atomicrmw.start
3715 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3716 ; CHECK-NOLSE-O1-NEXT: ldaxrh w8, [x0]
3717 ; CHECK-NOLSE-O1-NEXT: and w10, w8, #0xffff
3718 ; CHECK-NOLSE-O1-NEXT: cmp w10, w9
3719 ; CHECK-NOLSE-O1-NEXT: csel w10, w10, w9, lo
3720 ; CHECK-NOLSE-O1-NEXT: stlxrh w11, w10, [x0]
3721 ; CHECK-NOLSE-O1-NEXT: cbnz w11, LBB45_1
3722 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3723 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3724 ; CHECK-NOLSE-O1-NEXT: ret
3726 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umin_i16:
3727 ; CHECK-OUTLINE-O1: ; %bb.0:
3728 ; CHECK-OUTLINE-O1-NEXT: and w9, w1, #0xffff
3729 ; CHECK-OUTLINE-O1-NEXT: LBB45_1: ; %atomicrmw.start
3730 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3731 ; CHECK-OUTLINE-O1-NEXT: ldaxrh w8, [x0]
3732 ; CHECK-OUTLINE-O1-NEXT: and w10, w8, #0xffff
3733 ; CHECK-OUTLINE-O1-NEXT: cmp w10, w9
3734 ; CHECK-OUTLINE-O1-NEXT: csel w10, w10, w9, lo
3735 ; CHECK-OUTLINE-O1-NEXT: stlxrh w11, w10, [x0]
3736 ; CHECK-OUTLINE-O1-NEXT: cbnz w11, LBB45_1
3737 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3738 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
3739 ; CHECK-OUTLINE-O1-NEXT: ret
3741 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umin_i16:
3742 ; CHECK-NOLSE-O0: ; %bb.0:
3743 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3744 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3745 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3746 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3747 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3748 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3749 ; CHECK-NOLSE-O0-NEXT: b LBB45_1
3750 ; CHECK-NOLSE-O0-NEXT: LBB45_1: ; %atomicrmw.start
3751 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3752 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB45_2 Depth 2
3753 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3754 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3755 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3756 ; CHECK-NOLSE-O0-NEXT: uxth w10, w8
3757 ; CHECK-NOLSE-O0-NEXT: subs w10, w10, w9, uxth
3758 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, ls
3759 ; CHECK-NOLSE-O0-NEXT: LBB45_2: ; %atomicrmw.start
3760 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB45_1 Depth=1
3761 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3762 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3763 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3764 ; CHECK-NOLSE-O0-NEXT: b.ne LBB45_4
3765 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3766 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB45_2 Depth=2
3767 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3768 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB45_2
3769 ; CHECK-NOLSE-O0-NEXT: LBB45_4: ; %atomicrmw.start
3770 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB45_1 Depth=1
3771 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3772 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3773 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3774 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3775 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3776 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB45_1
3777 ; CHECK-NOLSE-O0-NEXT: b LBB45_5
3778 ; CHECK-NOLSE-O0-NEXT: LBB45_5: ; %atomicrmw.end
3779 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3780 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3781 ; CHECK-NOLSE-O0-NEXT: ret
3783 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umin_i16:
3784 ; CHECK-OUTLINE-O0: ; %bb.0:
3785 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
3786 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
3787 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
3788 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3789 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3790 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3791 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3792 ; CHECK-OUTLINE-O0-NEXT: ldrh w0, [x0]
3793 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3794 ; CHECK-OUTLINE-O0-NEXT: b LBB45_1
3795 ; CHECK-OUTLINE-O0-NEXT: LBB45_1: ; %atomicrmw.start
3796 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
3797 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
3798 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
3799 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
3800 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
3801 ; CHECK-OUTLINE-O0-NEXT: uxth w9, w0
3802 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, uxth
3803 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, ls
3804 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas2_acq_rel
3805 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
3806 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
3807 ; CHECK-OUTLINE-O0-NEXT: uxth w8, w8
3808 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w0, uxth
3809 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
3810 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3811 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB45_1
3812 ; CHECK-OUTLINE-O0-NEXT: b LBB45_2
3813 ; CHECK-OUTLINE-O0-NEXT: LBB45_2: ; %atomicrmw.end
3814 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3815 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
3816 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
3817 ; CHECK-OUTLINE-O0-NEXT: ret
3819 ; CHECK-LSE-O1-LABEL: atomicrmw_umin_i16:
3820 ; CHECK-LSE-O1: ; %bb.0:
3821 ; CHECK-LSE-O1-NEXT: lduminalh w1, w0, [x0]
3822 ; CHECK-LSE-O1-NEXT: ret
3824 ; CHECK-LSE-O0-LABEL: atomicrmw_umin_i16:
3825 ; CHECK-LSE-O0: ; %bb.0:
3826 ; CHECK-LSE-O0-NEXT: lduminalh w1, w0, [x0]
3827 ; CHECK-LSE-O0-NEXT: ret
3828 %res = atomicrmw umin ptr %ptr, i16 %rhs seq_cst
3832 define i16 @atomicrmw_umax_i16(ptr %ptr, i16 %rhs) {
3833 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umax_i16:
3834 ; CHECK-NOLSE-O1: ; %bb.0:
3835 ; CHECK-NOLSE-O1-NEXT: and w9, w1, #0xffff
3836 ; CHECK-NOLSE-O1-NEXT: LBB46_1: ; %atomicrmw.start
3837 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3838 ; CHECK-NOLSE-O1-NEXT: ldxrh w8, [x0]
3839 ; CHECK-NOLSE-O1-NEXT: and w10, w8, #0xffff
3840 ; CHECK-NOLSE-O1-NEXT: cmp w10, w9
3841 ; CHECK-NOLSE-O1-NEXT: csel w10, w10, w9, hi
3842 ; CHECK-NOLSE-O1-NEXT: stxrh w11, w10, [x0]
3843 ; CHECK-NOLSE-O1-NEXT: cbnz w11, LBB46_1
3844 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3845 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3846 ; CHECK-NOLSE-O1-NEXT: ret
3848 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umax_i16:
3849 ; CHECK-OUTLINE-O1: ; %bb.0:
3850 ; CHECK-OUTLINE-O1-NEXT: and w9, w1, #0xffff
3851 ; CHECK-OUTLINE-O1-NEXT: LBB46_1: ; %atomicrmw.start
3852 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3853 ; CHECK-OUTLINE-O1-NEXT: ldxrh w8, [x0]
3854 ; CHECK-OUTLINE-O1-NEXT: and w10, w8, #0xffff
3855 ; CHECK-OUTLINE-O1-NEXT: cmp w10, w9
3856 ; CHECK-OUTLINE-O1-NEXT: csel w10, w10, w9, hi
3857 ; CHECK-OUTLINE-O1-NEXT: stxrh w11, w10, [x0]
3858 ; CHECK-OUTLINE-O1-NEXT: cbnz w11, LBB46_1
3859 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3860 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
3861 ; CHECK-OUTLINE-O1-NEXT: ret
3863 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umax_i16:
3864 ; CHECK-NOLSE-O0: ; %bb.0:
3865 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3866 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3867 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3868 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3869 ; CHECK-NOLSE-O0-NEXT: ldrh w8, [x0]
3870 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3871 ; CHECK-NOLSE-O0-NEXT: b LBB46_1
3872 ; CHECK-NOLSE-O0-NEXT: LBB46_1: ; %atomicrmw.start
3873 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3874 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB46_2 Depth 2
3875 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3876 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3877 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3878 ; CHECK-NOLSE-O0-NEXT: uxth w10, w8
3879 ; CHECK-NOLSE-O0-NEXT: subs w10, w10, w9, uxth
3880 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, hi
3881 ; CHECK-NOLSE-O0-NEXT: LBB46_2: ; %atomicrmw.start
3882 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB46_1 Depth=1
3883 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3884 ; CHECK-NOLSE-O0-NEXT: ldaxrh w9, [x11]
3885 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8, uxth
3886 ; CHECK-NOLSE-O0-NEXT: b.ne LBB46_4
3887 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
3888 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB46_2 Depth=2
3889 ; CHECK-NOLSE-O0-NEXT: stlxrh w10, w12, [x11]
3890 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB46_2
3891 ; CHECK-NOLSE-O0-NEXT: LBB46_4: ; %atomicrmw.start
3892 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB46_1 Depth=1
3893 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
3894 ; CHECK-NOLSE-O0-NEXT: uxth w8, w8
3895 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w9, uxth
3896 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
3897 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
3898 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB46_1
3899 ; CHECK-NOLSE-O0-NEXT: b LBB46_5
3900 ; CHECK-NOLSE-O0-NEXT: LBB46_5: ; %atomicrmw.end
3901 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3902 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
3903 ; CHECK-NOLSE-O0-NEXT: ret
3905 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umax_i16:
3906 ; CHECK-OUTLINE-O0: ; %bb.0:
3907 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
3908 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
3909 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
3910 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
3911 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
3912 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3913 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3914 ; CHECK-OUTLINE-O0-NEXT: ldrh w0, [x0]
3915 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3916 ; CHECK-OUTLINE-O0-NEXT: b LBB46_1
3917 ; CHECK-OUTLINE-O0-NEXT: LBB46_1: ; %atomicrmw.start
3918 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
3919 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
3920 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
3921 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
3922 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
3923 ; CHECK-OUTLINE-O0-NEXT: uxth w9, w0
3924 ; CHECK-OUTLINE-O0-NEXT: subs w9, w9, w8, uxth
3925 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, hi
3926 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas2_relax
3927 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
3928 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
3929 ; CHECK-OUTLINE-O0-NEXT: uxth w8, w8
3930 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w0, uxth
3931 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
3932 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
3933 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB46_1
3934 ; CHECK-OUTLINE-O0-NEXT: b LBB46_2
3935 ; CHECK-OUTLINE-O0-NEXT: LBB46_2: ; %atomicrmw.end
3936 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
3937 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
3938 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
3939 ; CHECK-OUTLINE-O0-NEXT: ret
3941 ; CHECK-LSE-O1-LABEL: atomicrmw_umax_i16:
3942 ; CHECK-LSE-O1: ; %bb.0:
3943 ; CHECK-LSE-O1-NEXT: ldumaxh w1, w0, [x0]
3944 ; CHECK-LSE-O1-NEXT: ret
3946 ; CHECK-LSE-O0-LABEL: atomicrmw_umax_i16:
3947 ; CHECK-LSE-O0: ; %bb.0:
3948 ; CHECK-LSE-O0-NEXT: ldumaxh w1, w0, [x0]
3949 ; CHECK-LSE-O0-NEXT: ret
3950 %res = atomicrmw umax ptr %ptr, i16 %rhs monotonic
3954 define i32 @atomicrmw_add_i32(ptr %ptr, i32 %rhs) {
3955 ; CHECK-NOLSE-O1-LABEL: atomicrmw_add_i32:
3956 ; CHECK-NOLSE-O1: ; %bb.0:
3957 ; CHECK-NOLSE-O1-NEXT: LBB47_1: ; %atomicrmw.start
3958 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
3959 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
3960 ; CHECK-NOLSE-O1-NEXT: add w9, w8, w1
3961 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
3962 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB47_1
3963 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
3964 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
3965 ; CHECK-NOLSE-O1-NEXT: ret
3967 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_add_i32:
3968 ; CHECK-OUTLINE-O1: ; %bb.0:
3969 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
3970 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
3971 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
3972 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
3973 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
3974 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
3975 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
3976 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd4_acq_rel
3977 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
3978 ; CHECK-OUTLINE-O1-NEXT: ret
3980 ; CHECK-NOLSE-O0-LABEL: atomicrmw_add_i32:
3981 ; CHECK-NOLSE-O0: ; %bb.0:
3982 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
3983 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
3984 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
3985 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
3986 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
3987 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
3988 ; CHECK-NOLSE-O0-NEXT: b LBB47_1
3989 ; CHECK-NOLSE-O0-NEXT: LBB47_1: ; %atomicrmw.start
3990 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
3991 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB47_2 Depth 2
3992 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
3993 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
3994 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
3995 ; CHECK-NOLSE-O0-NEXT: add w12, w8, w9
3996 ; CHECK-NOLSE-O0-NEXT: LBB47_2: ; %atomicrmw.start
3997 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB47_1 Depth=1
3998 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
3999 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4000 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4001 ; CHECK-NOLSE-O0-NEXT: b.ne LBB47_4
4002 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4003 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB47_2 Depth=2
4004 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4005 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB47_2
4006 ; CHECK-NOLSE-O0-NEXT: LBB47_4: ; %atomicrmw.start
4007 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB47_1 Depth=1
4008 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4009 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4010 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4011 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4012 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB47_1
4013 ; CHECK-NOLSE-O0-NEXT: b LBB47_5
4014 ; CHECK-NOLSE-O0-NEXT: LBB47_5: ; %atomicrmw.end
4015 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4016 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4017 ; CHECK-NOLSE-O0-NEXT: ret
4019 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_add_i32:
4020 ; CHECK-OUTLINE-O0: ; %bb.0:
4021 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4022 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4023 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4024 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4025 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4026 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4027 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
4028 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4029 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd4_acq_rel
4030 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4031 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4032 ; CHECK-OUTLINE-O0-NEXT: ret
4034 ; CHECK-LSE-O1-LABEL: atomicrmw_add_i32:
4035 ; CHECK-LSE-O1: ; %bb.0:
4036 ; CHECK-LSE-O1-NEXT: ldaddal w1, w0, [x0]
4037 ; CHECK-LSE-O1-NEXT: ret
4039 ; CHECK-LSE-O0-LABEL: atomicrmw_add_i32:
4040 ; CHECK-LSE-O0: ; %bb.0:
4041 ; CHECK-LSE-O0-NEXT: ldaddal w1, w0, [x0]
4042 ; CHECK-LSE-O0-NEXT: ret
4043 %res = atomicrmw add ptr %ptr, i32 %rhs seq_cst
4047 define i32 @atomicrmw_xchg_i32(ptr %ptr, i32 %rhs) {
4048 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xchg_i32:
4049 ; CHECK-NOLSE-O1: ; %bb.0:
4050 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
4051 ; CHECK-NOLSE-O1-NEXT: LBB48_1: ; %atomicrmw.start
4052 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4053 ; CHECK-NOLSE-O1-NEXT: ldxr w0, [x8]
4054 ; CHECK-NOLSE-O1-NEXT: stxr w9, w1, [x8]
4055 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB48_1
4056 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4057 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
4058 ; CHECK-NOLSE-O1-NEXT: ret
4060 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xchg_i32:
4061 ; CHECK-OUTLINE-O1: ; %bb.0:
4062 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4063 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4064 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4065 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4066 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4067 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
4068 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4069 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_swp4_relax
4070 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4071 ; CHECK-OUTLINE-O1-NEXT: ret
4073 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xchg_i32:
4074 ; CHECK-NOLSE-O0: ; %bb.0:
4075 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4076 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4077 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4078 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4079 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4080 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4081 ; CHECK-NOLSE-O0-NEXT: b LBB48_1
4082 ; CHECK-NOLSE-O0-NEXT: LBB48_1: ; %atomicrmw.start
4083 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4084 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB48_2 Depth 2
4085 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4086 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4087 ; CHECK-NOLSE-O0-NEXT: ldr w12, [sp, #24] ; 4-byte Folded Reload
4088 ; CHECK-NOLSE-O0-NEXT: LBB48_2: ; %atomicrmw.start
4089 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB48_1 Depth=1
4090 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4091 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4092 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4093 ; CHECK-NOLSE-O0-NEXT: b.ne LBB48_4
4094 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4095 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB48_2 Depth=2
4096 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4097 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB48_2
4098 ; CHECK-NOLSE-O0-NEXT: LBB48_4: ; %atomicrmw.start
4099 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB48_1 Depth=1
4100 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4101 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4102 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4103 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4104 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB48_1
4105 ; CHECK-NOLSE-O0-NEXT: b LBB48_5
4106 ; CHECK-NOLSE-O0-NEXT: LBB48_5: ; %atomicrmw.end
4107 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4108 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4109 ; CHECK-NOLSE-O0-NEXT: ret
4111 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xchg_i32:
4112 ; CHECK-OUTLINE-O0: ; %bb.0:
4113 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4114 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4115 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4116 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4117 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4118 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4119 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
4120 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4121 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_swp4_relax
4122 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4123 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4124 ; CHECK-OUTLINE-O0-NEXT: ret
4126 ; CHECK-LSE-O1-LABEL: atomicrmw_xchg_i32:
4127 ; CHECK-LSE-O1: ; %bb.0:
4128 ; CHECK-LSE-O1-NEXT: swp w1, w0, [x0]
4129 ; CHECK-LSE-O1-NEXT: ret
4131 ; CHECK-LSE-O0-LABEL: atomicrmw_xchg_i32:
4132 ; CHECK-LSE-O0: ; %bb.0:
4133 ; CHECK-LSE-O0-NEXT: swp w1, w0, [x0]
4134 ; CHECK-LSE-O0-NEXT: ret
4135 %res = atomicrmw xchg ptr %ptr, i32 %rhs monotonic
4139 define i32 @atomicrmw_sub_i32(ptr %ptr, i32 %rhs) {
4140 ; CHECK-NOLSE-O1-LABEL: atomicrmw_sub_i32:
4141 ; CHECK-NOLSE-O1: ; %bb.0:
4142 ; CHECK-NOLSE-O1-NEXT: LBB49_1: ; %atomicrmw.start
4143 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4144 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
4145 ; CHECK-NOLSE-O1-NEXT: sub w9, w8, w1
4146 ; CHECK-NOLSE-O1-NEXT: stxr w10, w9, [x0]
4147 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB49_1
4148 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4149 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4150 ; CHECK-NOLSE-O1-NEXT: ret
4152 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_sub_i32:
4153 ; CHECK-OUTLINE-O1: ; %bb.0:
4154 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4155 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4156 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4157 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4158 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4159 ; CHECK-OUTLINE-O1-NEXT: neg w0, w1
4160 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4161 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd4_acq
4162 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4163 ; CHECK-OUTLINE-O1-NEXT: ret
4165 ; CHECK-NOLSE-O0-LABEL: atomicrmw_sub_i32:
4166 ; CHECK-NOLSE-O0: ; %bb.0:
4167 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4168 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4169 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4170 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4171 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4172 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4173 ; CHECK-NOLSE-O0-NEXT: b LBB49_1
4174 ; CHECK-NOLSE-O0-NEXT: LBB49_1: ; %atomicrmw.start
4175 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4176 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB49_2 Depth 2
4177 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4178 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4179 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4180 ; CHECK-NOLSE-O0-NEXT: subs w12, w8, w9
4181 ; CHECK-NOLSE-O0-NEXT: LBB49_2: ; %atomicrmw.start
4182 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB49_1 Depth=1
4183 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4184 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4185 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4186 ; CHECK-NOLSE-O0-NEXT: b.ne LBB49_4
4187 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4188 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB49_2 Depth=2
4189 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4190 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB49_2
4191 ; CHECK-NOLSE-O0-NEXT: LBB49_4: ; %atomicrmw.start
4192 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB49_1 Depth=1
4193 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4194 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4195 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4196 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4197 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB49_1
4198 ; CHECK-NOLSE-O0-NEXT: b LBB49_5
4199 ; CHECK-NOLSE-O0-NEXT: LBB49_5: ; %atomicrmw.end
4200 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4201 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4202 ; CHECK-NOLSE-O0-NEXT: ret
4204 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_sub_i32:
4205 ; CHECK-OUTLINE-O0: ; %bb.0:
4206 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4207 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4208 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4209 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4210 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4211 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4212 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
4213 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4214 ; CHECK-OUTLINE-O0-NEXT: mov w8, wzr
4215 ; CHECK-OUTLINE-O0-NEXT: subs w0, w8, w9
4216 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd4_acq
4217 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4218 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4219 ; CHECK-OUTLINE-O0-NEXT: ret
4221 ; CHECK-LSE-O1-LABEL: atomicrmw_sub_i32:
4222 ; CHECK-LSE-O1: ; %bb.0:
4223 ; CHECK-LSE-O1-NEXT: neg w8, w1
4224 ; CHECK-LSE-O1-NEXT: ldadda w8, w0, [x0]
4225 ; CHECK-LSE-O1-NEXT: ret
4227 ; CHECK-LSE-O0-LABEL: atomicrmw_sub_i32:
4228 ; CHECK-LSE-O0: ; %bb.0:
4229 ; CHECK-LSE-O0-NEXT: neg w8, w1
4230 ; CHECK-LSE-O0-NEXT: ldadda w8, w0, [x0]
4231 ; CHECK-LSE-O0-NEXT: ret
4232 %res = atomicrmw sub ptr %ptr, i32 %rhs acquire
4236 define i32 @atomicrmw_and_i32(ptr %ptr, i32 %rhs) {
4237 ; CHECK-NOLSE-O1-LABEL: atomicrmw_and_i32:
4238 ; CHECK-NOLSE-O1: ; %bb.0:
4239 ; CHECK-NOLSE-O1-NEXT: LBB50_1: ; %atomicrmw.start
4240 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4241 ; CHECK-NOLSE-O1-NEXT: ldxr w8, [x0]
4242 ; CHECK-NOLSE-O1-NEXT: and w9, w8, w1
4243 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
4244 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB50_1
4245 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4246 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4247 ; CHECK-NOLSE-O1-NEXT: ret
4249 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_and_i32:
4250 ; CHECK-OUTLINE-O1: ; %bb.0:
4251 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4252 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4253 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4254 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4255 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4256 ; CHECK-OUTLINE-O1-NEXT: mvn w0, w1
4257 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4258 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr4_rel
4259 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4260 ; CHECK-OUTLINE-O1-NEXT: ret
4262 ; CHECK-NOLSE-O0-LABEL: atomicrmw_and_i32:
4263 ; CHECK-NOLSE-O0: ; %bb.0:
4264 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4265 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4266 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4267 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4268 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4269 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4270 ; CHECK-NOLSE-O0-NEXT: b LBB50_1
4271 ; CHECK-NOLSE-O0-NEXT: LBB50_1: ; %atomicrmw.start
4272 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4273 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB50_2 Depth 2
4274 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4275 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4276 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4277 ; CHECK-NOLSE-O0-NEXT: and w12, w8, w9
4278 ; CHECK-NOLSE-O0-NEXT: LBB50_2: ; %atomicrmw.start
4279 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB50_1 Depth=1
4280 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4281 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4282 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4283 ; CHECK-NOLSE-O0-NEXT: b.ne LBB50_4
4284 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4285 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB50_2 Depth=2
4286 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4287 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB50_2
4288 ; CHECK-NOLSE-O0-NEXT: LBB50_4: ; %atomicrmw.start
4289 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB50_1 Depth=1
4290 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4291 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4292 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4293 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4294 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB50_1
4295 ; CHECK-NOLSE-O0-NEXT: b LBB50_5
4296 ; CHECK-NOLSE-O0-NEXT: LBB50_5: ; %atomicrmw.end
4297 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4298 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4299 ; CHECK-NOLSE-O0-NEXT: ret
4301 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_and_i32:
4302 ; CHECK-OUTLINE-O0: ; %bb.0:
4303 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4304 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4305 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4306 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4307 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4308 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4309 ; CHECK-OUTLINE-O0-NEXT: mov w9, w1
4310 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4311 ; CHECK-OUTLINE-O0-NEXT: mov w8, #-1 ; =0xffffffff
4312 ; CHECK-OUTLINE-O0-NEXT: eor w0, w8, w9
4313 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldclr4_rel
4314 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4315 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4316 ; CHECK-OUTLINE-O0-NEXT: ret
4318 ; CHECK-LSE-O1-LABEL: atomicrmw_and_i32:
4319 ; CHECK-LSE-O1: ; %bb.0:
4320 ; CHECK-LSE-O1-NEXT: mvn w8, w1
4321 ; CHECK-LSE-O1-NEXT: ldclrl w8, w0, [x0]
4322 ; CHECK-LSE-O1-NEXT: ret
4324 ; CHECK-LSE-O0-LABEL: atomicrmw_and_i32:
4325 ; CHECK-LSE-O0: ; %bb.0:
4326 ; CHECK-LSE-O0-NEXT: mvn w8, w1
4327 ; CHECK-LSE-O0-NEXT: ldclrl w8, w0, [x0]
4328 ; CHECK-LSE-O0-NEXT: ret
4329 %res = atomicrmw and ptr %ptr, i32 %rhs release
4333 define i32 @atomicrmw_or_i32(ptr %ptr, i32 %rhs) {
4334 ; CHECK-NOLSE-O1-LABEL: atomicrmw_or_i32:
4335 ; CHECK-NOLSE-O1: ; %bb.0:
4336 ; CHECK-NOLSE-O1-NEXT: LBB51_1: ; %atomicrmw.start
4337 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4338 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
4339 ; CHECK-NOLSE-O1-NEXT: orr w9, w8, w1
4340 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
4341 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB51_1
4342 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4343 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4344 ; CHECK-NOLSE-O1-NEXT: ret
4346 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_or_i32:
4347 ; CHECK-OUTLINE-O1: ; %bb.0:
4348 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4349 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4350 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4351 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4352 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4353 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
4354 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4355 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldset4_acq_rel
4356 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4357 ; CHECK-OUTLINE-O1-NEXT: ret
4359 ; CHECK-NOLSE-O0-LABEL: atomicrmw_or_i32:
4360 ; CHECK-NOLSE-O0: ; %bb.0:
4361 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4362 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4363 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4364 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4365 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4366 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4367 ; CHECK-NOLSE-O0-NEXT: b LBB51_1
4368 ; CHECK-NOLSE-O0-NEXT: LBB51_1: ; %atomicrmw.start
4369 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4370 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB51_2 Depth 2
4371 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4372 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4373 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4374 ; CHECK-NOLSE-O0-NEXT: orr w12, w8, w9
4375 ; CHECK-NOLSE-O0-NEXT: LBB51_2: ; %atomicrmw.start
4376 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB51_1 Depth=1
4377 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4378 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4379 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4380 ; CHECK-NOLSE-O0-NEXT: b.ne LBB51_4
4381 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4382 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB51_2 Depth=2
4383 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4384 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB51_2
4385 ; CHECK-NOLSE-O0-NEXT: LBB51_4: ; %atomicrmw.start
4386 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB51_1 Depth=1
4387 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4388 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4389 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4390 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4391 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB51_1
4392 ; CHECK-NOLSE-O0-NEXT: b LBB51_5
4393 ; CHECK-NOLSE-O0-NEXT: LBB51_5: ; %atomicrmw.end
4394 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4395 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4396 ; CHECK-NOLSE-O0-NEXT: ret
4398 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_or_i32:
4399 ; CHECK-OUTLINE-O0: ; %bb.0:
4400 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4401 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4402 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4403 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4404 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4405 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4406 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
4407 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4408 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldset4_acq_rel
4409 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4410 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4411 ; CHECK-OUTLINE-O0-NEXT: ret
4413 ; CHECK-LSE-O1-LABEL: atomicrmw_or_i32:
4414 ; CHECK-LSE-O1: ; %bb.0:
4415 ; CHECK-LSE-O1-NEXT: ldsetal w1, w0, [x0]
4416 ; CHECK-LSE-O1-NEXT: ret
4418 ; CHECK-LSE-O0-LABEL: atomicrmw_or_i32:
4419 ; CHECK-LSE-O0: ; %bb.0:
4420 ; CHECK-LSE-O0-NEXT: ldsetal w1, w0, [x0]
4421 ; CHECK-LSE-O0-NEXT: ret
4422 %res = atomicrmw or ptr %ptr, i32 %rhs seq_cst
4426 define i32 @atomicrmw_xor_i32(ptr %ptr, i32 %rhs) {
4427 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xor_i32:
4428 ; CHECK-NOLSE-O1: ; %bb.0:
4429 ; CHECK-NOLSE-O1-NEXT: LBB52_1: ; %atomicrmw.start
4430 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4431 ; CHECK-NOLSE-O1-NEXT: ldxr w8, [x0]
4432 ; CHECK-NOLSE-O1-NEXT: eor w9, w8, w1
4433 ; CHECK-NOLSE-O1-NEXT: stxr w10, w9, [x0]
4434 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB52_1
4435 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4436 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4437 ; CHECK-NOLSE-O1-NEXT: ret
4439 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xor_i32:
4440 ; CHECK-OUTLINE-O1: ; %bb.0:
4441 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4442 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4443 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4444 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4445 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4446 ; CHECK-OUTLINE-O1-NEXT: mov w0, w1
4447 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4448 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldeor4_relax
4449 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4450 ; CHECK-OUTLINE-O1-NEXT: ret
4452 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xor_i32:
4453 ; CHECK-NOLSE-O0: ; %bb.0:
4454 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4455 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4456 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4457 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4458 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4459 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4460 ; CHECK-NOLSE-O0-NEXT: b LBB52_1
4461 ; CHECK-NOLSE-O0-NEXT: LBB52_1: ; %atomicrmw.start
4462 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4463 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB52_2 Depth 2
4464 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4465 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4466 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4467 ; CHECK-NOLSE-O0-NEXT: eor w12, w8, w9
4468 ; CHECK-NOLSE-O0-NEXT: LBB52_2: ; %atomicrmw.start
4469 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB52_1 Depth=1
4470 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4471 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4472 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4473 ; CHECK-NOLSE-O0-NEXT: b.ne LBB52_4
4474 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4475 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB52_2 Depth=2
4476 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4477 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB52_2
4478 ; CHECK-NOLSE-O0-NEXT: LBB52_4: ; %atomicrmw.start
4479 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB52_1 Depth=1
4480 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4481 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4482 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4483 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4484 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB52_1
4485 ; CHECK-NOLSE-O0-NEXT: b LBB52_5
4486 ; CHECK-NOLSE-O0-NEXT: LBB52_5: ; %atomicrmw.end
4487 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4488 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4489 ; CHECK-NOLSE-O0-NEXT: ret
4491 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xor_i32:
4492 ; CHECK-OUTLINE-O0: ; %bb.0:
4493 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
4494 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
4495 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
4496 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4497 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4498 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
4499 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
4500 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
4501 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldeor4_relax
4502 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
4503 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
4504 ; CHECK-OUTLINE-O0-NEXT: ret
4506 ; CHECK-LSE-O1-LABEL: atomicrmw_xor_i32:
4507 ; CHECK-LSE-O1: ; %bb.0:
4508 ; CHECK-LSE-O1-NEXT: ldeor w1, w0, [x0]
4509 ; CHECK-LSE-O1-NEXT: ret
4511 ; CHECK-LSE-O0-LABEL: atomicrmw_xor_i32:
4512 ; CHECK-LSE-O0: ; %bb.0:
4513 ; CHECK-LSE-O0-NEXT: ldeor w1, w0, [x0]
4514 ; CHECK-LSE-O0-NEXT: ret
4515 %res = atomicrmw xor ptr %ptr, i32 %rhs monotonic
4519 define i32 @atomicrmw_min_i32(ptr %ptr, i32 %rhs) {
4520 ; CHECK-NOLSE-O1-LABEL: atomicrmw_min_i32:
4521 ; CHECK-NOLSE-O1: ; %bb.0:
4522 ; CHECK-NOLSE-O1-NEXT: LBB53_1: ; %atomicrmw.start
4523 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4524 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
4525 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
4526 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, lt
4527 ; CHECK-NOLSE-O1-NEXT: stxr w10, w9, [x0]
4528 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB53_1
4529 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4530 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4531 ; CHECK-NOLSE-O1-NEXT: ret
4533 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_min_i32:
4534 ; CHECK-OUTLINE-O1: ; %bb.0:
4535 ; CHECK-OUTLINE-O1-NEXT: LBB53_1: ; %atomicrmw.start
4536 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4537 ; CHECK-OUTLINE-O1-NEXT: ldaxr w8, [x0]
4538 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w1
4539 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, lt
4540 ; CHECK-OUTLINE-O1-NEXT: stxr w10, w9, [x0]
4541 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB53_1
4542 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4543 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
4544 ; CHECK-OUTLINE-O1-NEXT: ret
4546 ; CHECK-NOLSE-O0-LABEL: atomicrmw_min_i32:
4547 ; CHECK-NOLSE-O0: ; %bb.0:
4548 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4549 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4550 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4551 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4552 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4553 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4554 ; CHECK-NOLSE-O0-NEXT: b LBB53_1
4555 ; CHECK-NOLSE-O0-NEXT: LBB53_1: ; %atomicrmw.start
4556 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4557 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB53_2 Depth 2
4558 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4559 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4560 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4561 ; CHECK-NOLSE-O0-NEXT: subs w10, w8, w9
4562 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, le
4563 ; CHECK-NOLSE-O0-NEXT: LBB53_2: ; %atomicrmw.start
4564 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB53_1 Depth=1
4565 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4566 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4567 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4568 ; CHECK-NOLSE-O0-NEXT: b.ne LBB53_4
4569 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4570 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB53_2 Depth=2
4571 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4572 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB53_2
4573 ; CHECK-NOLSE-O0-NEXT: LBB53_4: ; %atomicrmw.start
4574 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB53_1 Depth=1
4575 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4576 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4577 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4578 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4579 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB53_1
4580 ; CHECK-NOLSE-O0-NEXT: b LBB53_5
4581 ; CHECK-NOLSE-O0-NEXT: LBB53_5: ; %atomicrmw.end
4582 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4583 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4584 ; CHECK-NOLSE-O0-NEXT: ret
4586 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_min_i32:
4587 ; CHECK-OUTLINE-O0: ; %bb.0:
4588 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
4589 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
4590 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
4591 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4592 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4593 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4594 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4595 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [x0]
4596 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4597 ; CHECK-OUTLINE-O0-NEXT: b LBB53_1
4598 ; CHECK-OUTLINE-O0-NEXT: LBB53_1: ; %atomicrmw.start
4599 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
4600 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
4601 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
4602 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
4603 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
4604 ; CHECK-OUTLINE-O0-NEXT: subs w9, w0, w8
4605 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, le
4606 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_acq
4607 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
4608 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w8
4609 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
4610 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
4611 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4612 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB53_1
4613 ; CHECK-OUTLINE-O0-NEXT: b LBB53_2
4614 ; CHECK-OUTLINE-O0-NEXT: LBB53_2: ; %atomicrmw.end
4615 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4616 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
4617 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
4618 ; CHECK-OUTLINE-O0-NEXT: ret
4620 ; CHECK-LSE-O1-LABEL: atomicrmw_min_i32:
4621 ; CHECK-LSE-O1: ; %bb.0:
4622 ; CHECK-LSE-O1-NEXT: ldsmina w1, w0, [x0]
4623 ; CHECK-LSE-O1-NEXT: ret
4625 ; CHECK-LSE-O0-LABEL: atomicrmw_min_i32:
4626 ; CHECK-LSE-O0: ; %bb.0:
4627 ; CHECK-LSE-O0-NEXT: ldsmina w1, w0, [x0]
4628 ; CHECK-LSE-O0-NEXT: ret
4629 %res = atomicrmw min ptr %ptr, i32 %rhs acquire
4633 define i32 @atomicrmw_max_i32(ptr %ptr, i32 %rhs) {
4634 ; CHECK-NOLSE-O1-LABEL: atomicrmw_max_i32:
4635 ; CHECK-NOLSE-O1: ; %bb.0:
4636 ; CHECK-NOLSE-O1-NEXT: LBB54_1: ; %atomicrmw.start
4637 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4638 ; CHECK-NOLSE-O1-NEXT: ldxr w8, [x0]
4639 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
4640 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, gt
4641 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
4642 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB54_1
4643 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4644 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4645 ; CHECK-NOLSE-O1-NEXT: ret
4647 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_max_i32:
4648 ; CHECK-OUTLINE-O1: ; %bb.0:
4649 ; CHECK-OUTLINE-O1-NEXT: LBB54_1: ; %atomicrmw.start
4650 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4651 ; CHECK-OUTLINE-O1-NEXT: ldxr w8, [x0]
4652 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w1
4653 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, gt
4654 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, w9, [x0]
4655 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB54_1
4656 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4657 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
4658 ; CHECK-OUTLINE-O1-NEXT: ret
4660 ; CHECK-NOLSE-O0-LABEL: atomicrmw_max_i32:
4661 ; CHECK-NOLSE-O0: ; %bb.0:
4662 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4663 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4664 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4665 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4666 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4667 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4668 ; CHECK-NOLSE-O0-NEXT: b LBB54_1
4669 ; CHECK-NOLSE-O0-NEXT: LBB54_1: ; %atomicrmw.start
4670 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4671 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB54_2 Depth 2
4672 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4673 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4674 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4675 ; CHECK-NOLSE-O0-NEXT: subs w10, w8, w9
4676 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, gt
4677 ; CHECK-NOLSE-O0-NEXT: LBB54_2: ; %atomicrmw.start
4678 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB54_1 Depth=1
4679 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4680 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4681 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4682 ; CHECK-NOLSE-O0-NEXT: b.ne LBB54_4
4683 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4684 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB54_2 Depth=2
4685 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4686 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB54_2
4687 ; CHECK-NOLSE-O0-NEXT: LBB54_4: ; %atomicrmw.start
4688 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB54_1 Depth=1
4689 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4690 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4691 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4692 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4693 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB54_1
4694 ; CHECK-NOLSE-O0-NEXT: b LBB54_5
4695 ; CHECK-NOLSE-O0-NEXT: LBB54_5: ; %atomicrmw.end
4696 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4697 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4698 ; CHECK-NOLSE-O0-NEXT: ret
4700 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_max_i32:
4701 ; CHECK-OUTLINE-O0: ; %bb.0:
4702 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
4703 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
4704 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
4705 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4706 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4707 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4708 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4709 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [x0]
4710 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4711 ; CHECK-OUTLINE-O0-NEXT: b LBB54_1
4712 ; CHECK-OUTLINE-O0-NEXT: LBB54_1: ; %atomicrmw.start
4713 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
4714 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
4715 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
4716 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
4717 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
4718 ; CHECK-OUTLINE-O0-NEXT: subs w9, w0, w8
4719 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, gt
4720 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_rel
4721 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
4722 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w8
4723 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
4724 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
4725 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4726 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB54_1
4727 ; CHECK-OUTLINE-O0-NEXT: b LBB54_2
4728 ; CHECK-OUTLINE-O0-NEXT: LBB54_2: ; %atomicrmw.end
4729 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4730 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
4731 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
4732 ; CHECK-OUTLINE-O0-NEXT: ret
4734 ; CHECK-LSE-O1-LABEL: atomicrmw_max_i32:
4735 ; CHECK-LSE-O1: ; %bb.0:
4736 ; CHECK-LSE-O1-NEXT: ldsmaxl w1, w0, [x0]
4737 ; CHECK-LSE-O1-NEXT: ret
4739 ; CHECK-LSE-O0-LABEL: atomicrmw_max_i32:
4740 ; CHECK-LSE-O0: ; %bb.0:
4741 ; CHECK-LSE-O0-NEXT: ldsmaxl w1, w0, [x0]
4742 ; CHECK-LSE-O0-NEXT: ret
4743 %res = atomicrmw max ptr %ptr, i32 %rhs release
4747 define i32 @atomicrmw_umin_i32(ptr %ptr, i32 %rhs) {
4748 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umin_i32:
4749 ; CHECK-NOLSE-O1: ; %bb.0:
4750 ; CHECK-NOLSE-O1-NEXT: LBB55_1: ; %atomicrmw.start
4751 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4752 ; CHECK-NOLSE-O1-NEXT: ldaxr w8, [x0]
4753 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
4754 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, lo
4755 ; CHECK-NOLSE-O1-NEXT: stlxr w10, w9, [x0]
4756 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB55_1
4757 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4758 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4759 ; CHECK-NOLSE-O1-NEXT: ret
4761 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umin_i32:
4762 ; CHECK-OUTLINE-O1: ; %bb.0:
4763 ; CHECK-OUTLINE-O1-NEXT: LBB55_1: ; %atomicrmw.start
4764 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4765 ; CHECK-OUTLINE-O1-NEXT: ldaxr w8, [x0]
4766 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w1
4767 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, lo
4768 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, w9, [x0]
4769 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB55_1
4770 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4771 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
4772 ; CHECK-OUTLINE-O1-NEXT: ret
4774 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umin_i32:
4775 ; CHECK-NOLSE-O0: ; %bb.0:
4776 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4777 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4778 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4779 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4780 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4781 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4782 ; CHECK-NOLSE-O0-NEXT: b LBB55_1
4783 ; CHECK-NOLSE-O0-NEXT: LBB55_1: ; %atomicrmw.start
4784 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4785 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB55_2 Depth 2
4786 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4787 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4788 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4789 ; CHECK-NOLSE-O0-NEXT: subs w10, w8, w9
4790 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, ls
4791 ; CHECK-NOLSE-O0-NEXT: LBB55_2: ; %atomicrmw.start
4792 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB55_1 Depth=1
4793 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4794 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4795 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4796 ; CHECK-NOLSE-O0-NEXT: b.ne LBB55_4
4797 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4798 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB55_2 Depth=2
4799 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4800 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB55_2
4801 ; CHECK-NOLSE-O0-NEXT: LBB55_4: ; %atomicrmw.start
4802 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB55_1 Depth=1
4803 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4804 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4805 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4806 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4807 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB55_1
4808 ; CHECK-NOLSE-O0-NEXT: b LBB55_5
4809 ; CHECK-NOLSE-O0-NEXT: LBB55_5: ; %atomicrmw.end
4810 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4811 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4812 ; CHECK-NOLSE-O0-NEXT: ret
4814 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umin_i32:
4815 ; CHECK-OUTLINE-O0: ; %bb.0:
4816 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
4817 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
4818 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
4819 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4820 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4821 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4822 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4823 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [x0]
4824 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4825 ; CHECK-OUTLINE-O0-NEXT: b LBB55_1
4826 ; CHECK-OUTLINE-O0-NEXT: LBB55_1: ; %atomicrmw.start
4827 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
4828 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
4829 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
4830 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
4831 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
4832 ; CHECK-OUTLINE-O0-NEXT: subs w9, w0, w8
4833 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, ls
4834 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_acq_rel
4835 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
4836 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w8
4837 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
4838 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
4839 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4840 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB55_1
4841 ; CHECK-OUTLINE-O0-NEXT: b LBB55_2
4842 ; CHECK-OUTLINE-O0-NEXT: LBB55_2: ; %atomicrmw.end
4843 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4844 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
4845 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
4846 ; CHECK-OUTLINE-O0-NEXT: ret
4848 ; CHECK-LSE-O1-LABEL: atomicrmw_umin_i32:
4849 ; CHECK-LSE-O1: ; %bb.0:
4850 ; CHECK-LSE-O1-NEXT: lduminal w1, w0, [x0]
4851 ; CHECK-LSE-O1-NEXT: ret
4853 ; CHECK-LSE-O0-LABEL: atomicrmw_umin_i32:
4854 ; CHECK-LSE-O0: ; %bb.0:
4855 ; CHECK-LSE-O0-NEXT: lduminal w1, w0, [x0]
4856 ; CHECK-LSE-O0-NEXT: ret
4857 %res = atomicrmw umin ptr %ptr, i32 %rhs seq_cst
4861 define i32 @atomicrmw_umax_i32(ptr %ptr, i32 %rhs) {
4862 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umax_i32:
4863 ; CHECK-NOLSE-O1: ; %bb.0:
4864 ; CHECK-NOLSE-O1-NEXT: LBB56_1: ; %atomicrmw.start
4865 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4866 ; CHECK-NOLSE-O1-NEXT: ldxr w8, [x0]
4867 ; CHECK-NOLSE-O1-NEXT: cmp w8, w1
4868 ; CHECK-NOLSE-O1-NEXT: csel w9, w8, w1, hi
4869 ; CHECK-NOLSE-O1-NEXT: stxr w10, w9, [x0]
4870 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB56_1
4871 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4872 ; CHECK-NOLSE-O1-NEXT: mov w0, w8
4873 ; CHECK-NOLSE-O1-NEXT: ret
4875 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umax_i32:
4876 ; CHECK-OUTLINE-O1: ; %bb.0:
4877 ; CHECK-OUTLINE-O1-NEXT: LBB56_1: ; %atomicrmw.start
4878 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4879 ; CHECK-OUTLINE-O1-NEXT: ldxr w8, [x0]
4880 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w1
4881 ; CHECK-OUTLINE-O1-NEXT: csel w9, w8, w1, hi
4882 ; CHECK-OUTLINE-O1-NEXT: stxr w10, w9, [x0]
4883 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB56_1
4884 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4885 ; CHECK-OUTLINE-O1-NEXT: mov w0, w8
4886 ; CHECK-OUTLINE-O1-NEXT: ret
4888 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umax_i32:
4889 ; CHECK-NOLSE-O0: ; %bb.0:
4890 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
4891 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
4892 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4893 ; CHECK-NOLSE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4894 ; CHECK-NOLSE-O0-NEXT: ldr w8, [x0]
4895 ; CHECK-NOLSE-O0-NEXT: str w8, [sp, #28] ; 4-byte Folded Spill
4896 ; CHECK-NOLSE-O0-NEXT: b LBB56_1
4897 ; CHECK-NOLSE-O0-NEXT: LBB56_1: ; %atomicrmw.start
4898 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
4899 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB56_2 Depth 2
4900 ; CHECK-NOLSE-O0-NEXT: ldr w8, [sp, #28] ; 4-byte Folded Reload
4901 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #16] ; 8-byte Folded Reload
4902 ; CHECK-NOLSE-O0-NEXT: ldr w9, [sp, #24] ; 4-byte Folded Reload
4903 ; CHECK-NOLSE-O0-NEXT: subs w10, w8, w9
4904 ; CHECK-NOLSE-O0-NEXT: csel w12, w8, w9, hi
4905 ; CHECK-NOLSE-O0-NEXT: LBB56_2: ; %atomicrmw.start
4906 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB56_1 Depth=1
4907 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
4908 ; CHECK-NOLSE-O0-NEXT: ldaxr w9, [x11]
4909 ; CHECK-NOLSE-O0-NEXT: cmp w9, w8
4910 ; CHECK-NOLSE-O0-NEXT: b.ne LBB56_4
4911 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
4912 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB56_2 Depth=2
4913 ; CHECK-NOLSE-O0-NEXT: stlxr w10, w12, [x11]
4914 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB56_2
4915 ; CHECK-NOLSE-O0-NEXT: LBB56_4: ; %atomicrmw.start
4916 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB56_1 Depth=1
4917 ; CHECK-NOLSE-O0-NEXT: subs w8, w9, w8
4918 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
4919 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #12] ; 4-byte Folded Spill
4920 ; CHECK-NOLSE-O0-NEXT: str w9, [sp, #28] ; 4-byte Folded Spill
4921 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB56_1
4922 ; CHECK-NOLSE-O0-NEXT: b LBB56_5
4923 ; CHECK-NOLSE-O0-NEXT: LBB56_5: ; %atomicrmw.end
4924 ; CHECK-NOLSE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4925 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
4926 ; CHECK-NOLSE-O0-NEXT: ret
4928 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umax_i32:
4929 ; CHECK-OUTLINE-O0: ; %bb.0:
4930 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #48
4931 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #32] ; 16-byte Folded Spill
4932 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 48
4933 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
4934 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
4935 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
4936 ; CHECK-OUTLINE-O0-NEXT: str w1, [sp, #24] ; 4-byte Folded Spill
4937 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [x0]
4938 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4939 ; CHECK-OUTLINE-O0-NEXT: b LBB56_1
4940 ; CHECK-OUTLINE-O0-NEXT: LBB56_1: ; %atomicrmw.start
4941 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
4942 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #28] ; 4-byte Folded Reload
4943 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #16] ; 8-byte Folded Reload
4944 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #24] ; 4-byte Folded Reload
4945 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #8] ; 4-byte Folded Spill
4946 ; CHECK-OUTLINE-O0-NEXT: subs w9, w0, w8
4947 ; CHECK-OUTLINE-O0-NEXT: csel w1, w0, w8, hi
4948 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_relax
4949 ; CHECK-OUTLINE-O0-NEXT: ldr w8, [sp, #8] ; 4-byte Folded Reload
4950 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w8
4951 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
4952 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
4953 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #28] ; 4-byte Folded Spill
4954 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB56_1
4955 ; CHECK-OUTLINE-O0-NEXT: b LBB56_2
4956 ; CHECK-OUTLINE-O0-NEXT: LBB56_2: ; %atomicrmw.end
4957 ; CHECK-OUTLINE-O0-NEXT: ldr w0, [sp, #12] ; 4-byte Folded Reload
4958 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
4959 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #48
4960 ; CHECK-OUTLINE-O0-NEXT: ret
4962 ; CHECK-LSE-O1-LABEL: atomicrmw_umax_i32:
4963 ; CHECK-LSE-O1: ; %bb.0:
4964 ; CHECK-LSE-O1-NEXT: ldumax w1, w0, [x0]
4965 ; CHECK-LSE-O1-NEXT: ret
4967 ; CHECK-LSE-O0-LABEL: atomicrmw_umax_i32:
4968 ; CHECK-LSE-O0: ; %bb.0:
4969 ; CHECK-LSE-O0-NEXT: ldumax w1, w0, [x0]
4970 ; CHECK-LSE-O0-NEXT: ret
4971 %res = atomicrmw umax ptr %ptr, i32 %rhs monotonic
4975 define i64 @atomicrmw_add_i64(ptr %ptr, i64 %rhs) {
4976 ; CHECK-NOLSE-O1-LABEL: atomicrmw_add_i64:
4977 ; CHECK-NOLSE-O1: ; %bb.0:
4978 ; CHECK-NOLSE-O1-NEXT: LBB57_1: ; %atomicrmw.start
4979 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
4980 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
4981 ; CHECK-NOLSE-O1-NEXT: add x9, x8, x1
4982 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
4983 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB57_1
4984 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
4985 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
4986 ; CHECK-NOLSE-O1-NEXT: ret
4988 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_add_i64:
4989 ; CHECK-OUTLINE-O1: ; %bb.0:
4990 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
4991 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
4992 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
4993 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
4994 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
4995 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
4996 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
4997 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd8_acq_rel
4998 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
4999 ; CHECK-OUTLINE-O1-NEXT: ret
5001 ; CHECK-NOLSE-O0-LABEL: atomicrmw_add_i64:
5002 ; CHECK-NOLSE-O0: ; %bb.0:
5003 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5004 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5005 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5006 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5007 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5008 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5009 ; CHECK-NOLSE-O0-NEXT: b LBB57_1
5010 ; CHECK-NOLSE-O0-NEXT: LBB57_1: ; %atomicrmw.start
5011 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5012 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB57_2 Depth 2
5013 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5014 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5015 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5016 ; CHECK-NOLSE-O0-NEXT: add x12, x8, x9
5017 ; CHECK-NOLSE-O0-NEXT: LBB57_2: ; %atomicrmw.start
5018 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB57_1 Depth=1
5019 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5020 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5021 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5022 ; CHECK-NOLSE-O0-NEXT: b.ne LBB57_4
5023 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5024 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB57_2 Depth=2
5025 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5026 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB57_2
5027 ; CHECK-NOLSE-O0-NEXT: LBB57_4: ; %atomicrmw.start
5028 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB57_1 Depth=1
5029 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5030 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5031 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5032 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5033 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB57_1
5034 ; CHECK-NOLSE-O0-NEXT: b LBB57_5
5035 ; CHECK-NOLSE-O0-NEXT: LBB57_5: ; %atomicrmw.end
5036 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5037 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5038 ; CHECK-NOLSE-O0-NEXT: ret
5040 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_add_i64:
5041 ; CHECK-OUTLINE-O0: ; %bb.0:
5042 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5043 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5044 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5045 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5046 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5047 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5048 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
5049 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5050 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd8_acq_rel
5051 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5052 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5053 ; CHECK-OUTLINE-O0-NEXT: ret
5055 ; CHECK-LSE-O1-LABEL: atomicrmw_add_i64:
5056 ; CHECK-LSE-O1: ; %bb.0:
5057 ; CHECK-LSE-O1-NEXT: ldaddal x1, x0, [x0]
5058 ; CHECK-LSE-O1-NEXT: ret
5060 ; CHECK-LSE-O0-LABEL: atomicrmw_add_i64:
5061 ; CHECK-LSE-O0: ; %bb.0:
5062 ; CHECK-LSE-O0-NEXT: ldaddal x1, x0, [x0]
5063 ; CHECK-LSE-O0-NEXT: ret
5064 %res = atomicrmw add ptr %ptr, i64 %rhs seq_cst
5068 define i64 @atomicrmw_xchg_i64(ptr %ptr, i64 %rhs) {
5069 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xchg_i64:
5070 ; CHECK-NOLSE-O1: ; %bb.0:
5071 ; CHECK-NOLSE-O1-NEXT: LBB58_1: ; %atomicrmw.start
5072 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5073 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
5074 ; CHECK-NOLSE-O1-NEXT: stxr w9, x1, [x0]
5075 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB58_1
5076 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5077 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5078 ; CHECK-NOLSE-O1-NEXT: ret
5080 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xchg_i64:
5081 ; CHECK-OUTLINE-O1: ; %bb.0:
5082 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
5083 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
5084 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
5085 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
5086 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
5087 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
5088 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
5089 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_swp8_relax
5090 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
5091 ; CHECK-OUTLINE-O1-NEXT: ret
5093 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xchg_i64:
5094 ; CHECK-NOLSE-O0: ; %bb.0:
5095 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5096 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5097 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5098 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5099 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5100 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5101 ; CHECK-NOLSE-O0-NEXT: b LBB58_1
5102 ; CHECK-NOLSE-O0-NEXT: LBB58_1: ; %atomicrmw.start
5103 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5104 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB58_2 Depth 2
5105 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5106 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5107 ; CHECK-NOLSE-O0-NEXT: ldr x12, [sp, #16] ; 8-byte Folded Reload
5108 ; CHECK-NOLSE-O0-NEXT: LBB58_2: ; %atomicrmw.start
5109 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB58_1 Depth=1
5110 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5111 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5112 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5113 ; CHECK-NOLSE-O0-NEXT: b.ne LBB58_4
5114 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5115 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB58_2 Depth=2
5116 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5117 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB58_2
5118 ; CHECK-NOLSE-O0-NEXT: LBB58_4: ; %atomicrmw.start
5119 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB58_1 Depth=1
5120 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5121 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5122 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5123 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5124 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB58_1
5125 ; CHECK-NOLSE-O0-NEXT: b LBB58_5
5126 ; CHECK-NOLSE-O0-NEXT: LBB58_5: ; %atomicrmw.end
5127 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5128 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5129 ; CHECK-NOLSE-O0-NEXT: ret
5131 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xchg_i64:
5132 ; CHECK-OUTLINE-O0: ; %bb.0:
5133 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5134 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5135 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5136 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5137 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5138 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5139 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
5140 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5141 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_swp8_relax
5142 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5143 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5144 ; CHECK-OUTLINE-O0-NEXT: ret
5146 ; CHECK-LSE-O1-LABEL: atomicrmw_xchg_i64:
5147 ; CHECK-LSE-O1: ; %bb.0:
5148 ; CHECK-LSE-O1-NEXT: swp x1, x0, [x0]
5149 ; CHECK-LSE-O1-NEXT: ret
5151 ; CHECK-LSE-O0-LABEL: atomicrmw_xchg_i64:
5152 ; CHECK-LSE-O0: ; %bb.0:
5153 ; CHECK-LSE-O0-NEXT: swp x1, x0, [x0]
5154 ; CHECK-LSE-O0-NEXT: ret
5155 %res = atomicrmw xchg ptr %ptr, i64 %rhs monotonic
5159 define i64 @atomicrmw_sub_i64(ptr %ptr, i64 %rhs) {
5160 ; CHECK-NOLSE-O1-LABEL: atomicrmw_sub_i64:
5161 ; CHECK-NOLSE-O1: ; %bb.0:
5162 ; CHECK-NOLSE-O1-NEXT: LBB59_1: ; %atomicrmw.start
5163 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5164 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
5165 ; CHECK-NOLSE-O1-NEXT: sub x9, x8, x1
5166 ; CHECK-NOLSE-O1-NEXT: stxr w10, x9, [x0]
5167 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB59_1
5168 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5169 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5170 ; CHECK-NOLSE-O1-NEXT: ret
5172 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_sub_i64:
5173 ; CHECK-OUTLINE-O1: ; %bb.0:
5174 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
5175 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
5176 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
5177 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
5178 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
5179 ; CHECK-OUTLINE-O1-NEXT: neg x0, x1
5180 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
5181 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldadd8_acq
5182 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
5183 ; CHECK-OUTLINE-O1-NEXT: ret
5185 ; CHECK-NOLSE-O0-LABEL: atomicrmw_sub_i64:
5186 ; CHECK-NOLSE-O0: ; %bb.0:
5187 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5188 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5189 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5190 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5191 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5192 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5193 ; CHECK-NOLSE-O0-NEXT: b LBB59_1
5194 ; CHECK-NOLSE-O0-NEXT: LBB59_1: ; %atomicrmw.start
5195 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5196 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB59_2 Depth 2
5197 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5198 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5199 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5200 ; CHECK-NOLSE-O0-NEXT: subs x12, x8, x9
5201 ; CHECK-NOLSE-O0-NEXT: LBB59_2: ; %atomicrmw.start
5202 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB59_1 Depth=1
5203 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5204 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5205 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5206 ; CHECK-NOLSE-O0-NEXT: b.ne LBB59_4
5207 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5208 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB59_2 Depth=2
5209 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5210 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB59_2
5211 ; CHECK-NOLSE-O0-NEXT: LBB59_4: ; %atomicrmw.start
5212 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB59_1 Depth=1
5213 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5214 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5215 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5216 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5217 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB59_1
5218 ; CHECK-NOLSE-O0-NEXT: b LBB59_5
5219 ; CHECK-NOLSE-O0-NEXT: LBB59_5: ; %atomicrmw.end
5220 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5221 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5222 ; CHECK-NOLSE-O0-NEXT: ret
5224 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_sub_i64:
5225 ; CHECK-OUTLINE-O0: ; %bb.0:
5226 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5227 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5228 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5229 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5230 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5231 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5232 ; CHECK-OUTLINE-O0-NEXT: mov x9, x1
5233 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5234 ; CHECK-OUTLINE-O0-NEXT: mov x8, xzr
5235 ; CHECK-OUTLINE-O0-NEXT: subs x0, x8, x9
5236 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldadd8_acq
5237 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5238 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5239 ; CHECK-OUTLINE-O0-NEXT: ret
5241 ; CHECK-LSE-O1-LABEL: atomicrmw_sub_i64:
5242 ; CHECK-LSE-O1: ; %bb.0:
5243 ; CHECK-LSE-O1-NEXT: neg x8, x1
5244 ; CHECK-LSE-O1-NEXT: ldadda x8, x0, [x0]
5245 ; CHECK-LSE-O1-NEXT: ret
5247 ; CHECK-LSE-O0-LABEL: atomicrmw_sub_i64:
5248 ; CHECK-LSE-O0: ; %bb.0:
5249 ; CHECK-LSE-O0-NEXT: neg x8, x1
5250 ; CHECK-LSE-O0-NEXT: ldadda x8, x0, [x0]
5251 ; CHECK-LSE-O0-NEXT: ret
5252 %res = atomicrmw sub ptr %ptr, i64 %rhs acquire
5256 define i64 @atomicrmw_and_i64(ptr %ptr, i64 %rhs) {
5257 ; CHECK-NOLSE-O1-LABEL: atomicrmw_and_i64:
5258 ; CHECK-NOLSE-O1: ; %bb.0:
5259 ; CHECK-NOLSE-O1-NEXT: LBB60_1: ; %atomicrmw.start
5260 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5261 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
5262 ; CHECK-NOLSE-O1-NEXT: and x9, x8, x1
5263 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
5264 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB60_1
5265 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5266 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5267 ; CHECK-NOLSE-O1-NEXT: ret
5269 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_and_i64:
5270 ; CHECK-OUTLINE-O1: ; %bb.0:
5271 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
5272 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
5273 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
5274 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
5275 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
5276 ; CHECK-OUTLINE-O1-NEXT: mvn x0, x1
5277 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
5278 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldclr8_rel
5279 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
5280 ; CHECK-OUTLINE-O1-NEXT: ret
5282 ; CHECK-NOLSE-O0-LABEL: atomicrmw_and_i64:
5283 ; CHECK-NOLSE-O0: ; %bb.0:
5284 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5285 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5286 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5287 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5288 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5289 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5290 ; CHECK-NOLSE-O0-NEXT: b LBB60_1
5291 ; CHECK-NOLSE-O0-NEXT: LBB60_1: ; %atomicrmw.start
5292 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5293 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB60_2 Depth 2
5294 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5295 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5296 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5297 ; CHECK-NOLSE-O0-NEXT: and x12, x8, x9
5298 ; CHECK-NOLSE-O0-NEXT: LBB60_2: ; %atomicrmw.start
5299 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB60_1 Depth=1
5300 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5301 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5302 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5303 ; CHECK-NOLSE-O0-NEXT: b.ne LBB60_4
5304 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5305 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB60_2 Depth=2
5306 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5307 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB60_2
5308 ; CHECK-NOLSE-O0-NEXT: LBB60_4: ; %atomicrmw.start
5309 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB60_1 Depth=1
5310 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5311 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5312 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5313 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5314 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB60_1
5315 ; CHECK-NOLSE-O0-NEXT: b LBB60_5
5316 ; CHECK-NOLSE-O0-NEXT: LBB60_5: ; %atomicrmw.end
5317 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5318 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5319 ; CHECK-NOLSE-O0-NEXT: ret
5321 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_and_i64:
5322 ; CHECK-OUTLINE-O0: ; %bb.0:
5323 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5324 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5325 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5326 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5327 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5328 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5329 ; CHECK-OUTLINE-O0-NEXT: mov x9, x1
5330 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5331 ; CHECK-OUTLINE-O0-NEXT: mov x8, #-1 ; =0xffffffffffffffff
5332 ; CHECK-OUTLINE-O0-NEXT: eor x0, x8, x9
5333 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldclr8_rel
5334 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5335 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5336 ; CHECK-OUTLINE-O0-NEXT: ret
5338 ; CHECK-LSE-O1-LABEL: atomicrmw_and_i64:
5339 ; CHECK-LSE-O1: ; %bb.0:
5340 ; CHECK-LSE-O1-NEXT: mvn x8, x1
5341 ; CHECK-LSE-O1-NEXT: ldclrl x8, x0, [x0]
5342 ; CHECK-LSE-O1-NEXT: ret
5344 ; CHECK-LSE-O0-LABEL: atomicrmw_and_i64:
5345 ; CHECK-LSE-O0: ; %bb.0:
5346 ; CHECK-LSE-O0-NEXT: mvn x8, x1
5347 ; CHECK-LSE-O0-NEXT: ldclrl x8, x0, [x0]
5348 ; CHECK-LSE-O0-NEXT: ret
5349 %res = atomicrmw and ptr %ptr, i64 %rhs release
5353 define i64 @atomicrmw_or_i64(ptr %ptr, i64 %rhs) {
5354 ; CHECK-NOLSE-O1-LABEL: atomicrmw_or_i64:
5355 ; CHECK-NOLSE-O1: ; %bb.0:
5356 ; CHECK-NOLSE-O1-NEXT: LBB61_1: ; %atomicrmw.start
5357 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5358 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
5359 ; CHECK-NOLSE-O1-NEXT: orr x9, x8, x1
5360 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
5361 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB61_1
5362 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5363 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5364 ; CHECK-NOLSE-O1-NEXT: ret
5366 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_or_i64:
5367 ; CHECK-OUTLINE-O1: ; %bb.0:
5368 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
5369 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
5370 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
5371 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
5372 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
5373 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
5374 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
5375 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldset8_acq_rel
5376 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
5377 ; CHECK-OUTLINE-O1-NEXT: ret
5379 ; CHECK-NOLSE-O0-LABEL: atomicrmw_or_i64:
5380 ; CHECK-NOLSE-O0: ; %bb.0:
5381 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5382 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5383 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5384 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5385 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5386 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5387 ; CHECK-NOLSE-O0-NEXT: b LBB61_1
5388 ; CHECK-NOLSE-O0-NEXT: LBB61_1: ; %atomicrmw.start
5389 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5390 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB61_2 Depth 2
5391 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5392 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5393 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5394 ; CHECK-NOLSE-O0-NEXT: orr x12, x8, x9
5395 ; CHECK-NOLSE-O0-NEXT: LBB61_2: ; %atomicrmw.start
5396 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB61_1 Depth=1
5397 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5398 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5399 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5400 ; CHECK-NOLSE-O0-NEXT: b.ne LBB61_4
5401 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5402 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB61_2 Depth=2
5403 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5404 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB61_2
5405 ; CHECK-NOLSE-O0-NEXT: LBB61_4: ; %atomicrmw.start
5406 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB61_1 Depth=1
5407 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5408 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5409 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5410 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5411 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB61_1
5412 ; CHECK-NOLSE-O0-NEXT: b LBB61_5
5413 ; CHECK-NOLSE-O0-NEXT: LBB61_5: ; %atomicrmw.end
5414 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5415 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5416 ; CHECK-NOLSE-O0-NEXT: ret
5418 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_or_i64:
5419 ; CHECK-OUTLINE-O0: ; %bb.0:
5420 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5421 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5422 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5423 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5424 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5425 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5426 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
5427 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5428 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldset8_acq_rel
5429 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5430 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5431 ; CHECK-OUTLINE-O0-NEXT: ret
5433 ; CHECK-LSE-O1-LABEL: atomicrmw_or_i64:
5434 ; CHECK-LSE-O1: ; %bb.0:
5435 ; CHECK-LSE-O1-NEXT: ldsetal x1, x0, [x0]
5436 ; CHECK-LSE-O1-NEXT: ret
5438 ; CHECK-LSE-O0-LABEL: atomicrmw_or_i64:
5439 ; CHECK-LSE-O0: ; %bb.0:
5440 ; CHECK-LSE-O0-NEXT: ldsetal x1, x0, [x0]
5441 ; CHECK-LSE-O0-NEXT: ret
5442 %res = atomicrmw or ptr %ptr, i64 %rhs seq_cst
5446 define i64 @atomicrmw_xor_i64(ptr %ptr, i64 %rhs) {
5447 ; CHECK-NOLSE-O1-LABEL: atomicrmw_xor_i64:
5448 ; CHECK-NOLSE-O1: ; %bb.0:
5449 ; CHECK-NOLSE-O1-NEXT: LBB62_1: ; %atomicrmw.start
5450 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5451 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
5452 ; CHECK-NOLSE-O1-NEXT: eor x9, x8, x1
5453 ; CHECK-NOLSE-O1-NEXT: stxr w10, x9, [x0]
5454 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB62_1
5455 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5456 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5457 ; CHECK-NOLSE-O1-NEXT: ret
5459 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_xor_i64:
5460 ; CHECK-OUTLINE-O1: ; %bb.0:
5461 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
5462 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 16
5463 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
5464 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
5465 ; CHECK-OUTLINE-O1-NEXT: mov x2, x0
5466 ; CHECK-OUTLINE-O1-NEXT: mov x0, x1
5467 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
5468 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_ldeor8_relax
5469 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
5470 ; CHECK-OUTLINE-O1-NEXT: ret
5472 ; CHECK-NOLSE-O0-LABEL: atomicrmw_xor_i64:
5473 ; CHECK-NOLSE-O0: ; %bb.0:
5474 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5475 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5476 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5477 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5478 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5479 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5480 ; CHECK-NOLSE-O0-NEXT: b LBB62_1
5481 ; CHECK-NOLSE-O0-NEXT: LBB62_1: ; %atomicrmw.start
5482 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5483 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB62_2 Depth 2
5484 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5485 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5486 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5487 ; CHECK-NOLSE-O0-NEXT: eor x12, x8, x9
5488 ; CHECK-NOLSE-O0-NEXT: LBB62_2: ; %atomicrmw.start
5489 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB62_1 Depth=1
5490 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5491 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5492 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5493 ; CHECK-NOLSE-O0-NEXT: b.ne LBB62_4
5494 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5495 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB62_2 Depth=2
5496 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5497 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB62_2
5498 ; CHECK-NOLSE-O0-NEXT: LBB62_4: ; %atomicrmw.start
5499 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB62_1 Depth=1
5500 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5501 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5502 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5503 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5504 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB62_1
5505 ; CHECK-NOLSE-O0-NEXT: b LBB62_5
5506 ; CHECK-NOLSE-O0-NEXT: LBB62_5: ; %atomicrmw.end
5507 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5508 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5509 ; CHECK-NOLSE-O0-NEXT: ret
5511 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_xor_i64:
5512 ; CHECK-OUTLINE-O0: ; %bb.0:
5513 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
5514 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
5515 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
5516 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5517 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5518 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5519 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
5520 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
5521 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_ldeor8_relax
5522 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
5523 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
5524 ; CHECK-OUTLINE-O0-NEXT: ret
5526 ; CHECK-LSE-O1-LABEL: atomicrmw_xor_i64:
5527 ; CHECK-LSE-O1: ; %bb.0:
5528 ; CHECK-LSE-O1-NEXT: ldeor x1, x0, [x0]
5529 ; CHECK-LSE-O1-NEXT: ret
5531 ; CHECK-LSE-O0-LABEL: atomicrmw_xor_i64:
5532 ; CHECK-LSE-O0: ; %bb.0:
5533 ; CHECK-LSE-O0-NEXT: ldeor x1, x0, [x0]
5534 ; CHECK-LSE-O0-NEXT: ret
5535 %res = atomicrmw xor ptr %ptr, i64 %rhs monotonic
5539 define i64 @atomicrmw_min_i64(ptr %ptr, i64 %rhs) {
5540 ; CHECK-NOLSE-O1-LABEL: atomicrmw_min_i64:
5541 ; CHECK-NOLSE-O1: ; %bb.0:
5542 ; CHECK-NOLSE-O1-NEXT: LBB63_1: ; %atomicrmw.start
5543 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5544 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
5545 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
5546 ; CHECK-NOLSE-O1-NEXT: csel x9, x8, x1, lt
5547 ; CHECK-NOLSE-O1-NEXT: stxr w10, x9, [x0]
5548 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB63_1
5549 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5550 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5551 ; CHECK-NOLSE-O1-NEXT: ret
5553 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_min_i64:
5554 ; CHECK-OUTLINE-O1: ; %bb.0:
5555 ; CHECK-OUTLINE-O1-NEXT: LBB63_1: ; %atomicrmw.start
5556 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5557 ; CHECK-OUTLINE-O1-NEXT: ldaxr x8, [x0]
5558 ; CHECK-OUTLINE-O1-NEXT: cmp x8, x1
5559 ; CHECK-OUTLINE-O1-NEXT: csel x9, x8, x1, lt
5560 ; CHECK-OUTLINE-O1-NEXT: stxr w10, x9, [x0]
5561 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB63_1
5562 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5563 ; CHECK-OUTLINE-O1-NEXT: mov x0, x8
5564 ; CHECK-OUTLINE-O1-NEXT: ret
5566 ; CHECK-NOLSE-O0-LABEL: atomicrmw_min_i64:
5567 ; CHECK-NOLSE-O0: ; %bb.0:
5568 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5569 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5570 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5571 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5572 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5573 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5574 ; CHECK-NOLSE-O0-NEXT: b LBB63_1
5575 ; CHECK-NOLSE-O0-NEXT: LBB63_1: ; %atomicrmw.start
5576 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5577 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB63_2 Depth 2
5578 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5579 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5580 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5581 ; CHECK-NOLSE-O0-NEXT: subs x10, x8, x9
5582 ; CHECK-NOLSE-O0-NEXT: csel x12, x8, x9, le
5583 ; CHECK-NOLSE-O0-NEXT: LBB63_2: ; %atomicrmw.start
5584 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB63_1 Depth=1
5585 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5586 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5587 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5588 ; CHECK-NOLSE-O0-NEXT: b.ne LBB63_4
5589 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5590 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB63_2 Depth=2
5591 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5592 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB63_2
5593 ; CHECK-NOLSE-O0-NEXT: LBB63_4: ; %atomicrmw.start
5594 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB63_1 Depth=1
5595 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5596 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5597 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5598 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5599 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB63_1
5600 ; CHECK-NOLSE-O0-NEXT: b LBB63_5
5601 ; CHECK-NOLSE-O0-NEXT: LBB63_5: ; %atomicrmw.end
5602 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5603 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5604 ; CHECK-NOLSE-O0-NEXT: ret
5606 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_min_i64:
5607 ; CHECK-OUTLINE-O0: ; %bb.0:
5608 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #64
5609 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
5610 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 64
5611 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5612 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5613 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
5614 ; CHECK-OUTLINE-O0-NEXT: str x1, [sp, #32] ; 8-byte Folded Spill
5615 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [x0]
5616 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5617 ; CHECK-OUTLINE-O0-NEXT: b LBB63_1
5618 ; CHECK-OUTLINE-O0-NEXT: LBB63_1: ; %atomicrmw.start
5619 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
5620 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #40] ; 8-byte Folded Reload
5621 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #24] ; 8-byte Folded Reload
5622 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #32] ; 8-byte Folded Reload
5623 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5624 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, x8
5625 ; CHECK-OUTLINE-O0-NEXT: csel x1, x0, x8, le
5626 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_acq
5627 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #8] ; 8-byte Folded Reload
5628 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x8
5629 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
5630 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
5631 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5632 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB63_1
5633 ; CHECK-OUTLINE-O0-NEXT: b LBB63_2
5634 ; CHECK-OUTLINE-O0-NEXT: LBB63_2: ; %atomicrmw.end
5635 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #16] ; 8-byte Folded Reload
5636 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
5637 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #64
5638 ; CHECK-OUTLINE-O0-NEXT: ret
5640 ; CHECK-LSE-O1-LABEL: atomicrmw_min_i64:
5641 ; CHECK-LSE-O1: ; %bb.0:
5642 ; CHECK-LSE-O1-NEXT: ldsmina x1, x0, [x0]
5643 ; CHECK-LSE-O1-NEXT: ret
5645 ; CHECK-LSE-O0-LABEL: atomicrmw_min_i64:
5646 ; CHECK-LSE-O0: ; %bb.0:
5647 ; CHECK-LSE-O0-NEXT: ldsmina x1, x0, [x0]
5648 ; CHECK-LSE-O0-NEXT: ret
5649 %res = atomicrmw min ptr %ptr, i64 %rhs acquire
5653 define i64 @atomicrmw_max_i64(ptr %ptr, i64 %rhs) {
5654 ; CHECK-NOLSE-O1-LABEL: atomicrmw_max_i64:
5655 ; CHECK-NOLSE-O1: ; %bb.0:
5656 ; CHECK-NOLSE-O1-NEXT: LBB64_1: ; %atomicrmw.start
5657 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5658 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
5659 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
5660 ; CHECK-NOLSE-O1-NEXT: csel x9, x8, x1, gt
5661 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
5662 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB64_1
5663 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5664 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5665 ; CHECK-NOLSE-O1-NEXT: ret
5667 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_max_i64:
5668 ; CHECK-OUTLINE-O1: ; %bb.0:
5669 ; CHECK-OUTLINE-O1-NEXT: LBB64_1: ; %atomicrmw.start
5670 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5671 ; CHECK-OUTLINE-O1-NEXT: ldxr x8, [x0]
5672 ; CHECK-OUTLINE-O1-NEXT: cmp x8, x1
5673 ; CHECK-OUTLINE-O1-NEXT: csel x9, x8, x1, gt
5674 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, x9, [x0]
5675 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB64_1
5676 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5677 ; CHECK-OUTLINE-O1-NEXT: mov x0, x8
5678 ; CHECK-OUTLINE-O1-NEXT: ret
5680 ; CHECK-NOLSE-O0-LABEL: atomicrmw_max_i64:
5681 ; CHECK-NOLSE-O0: ; %bb.0:
5682 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5683 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5684 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5685 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5686 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5687 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5688 ; CHECK-NOLSE-O0-NEXT: b LBB64_1
5689 ; CHECK-NOLSE-O0-NEXT: LBB64_1: ; %atomicrmw.start
5690 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5691 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB64_2 Depth 2
5692 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5693 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5694 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5695 ; CHECK-NOLSE-O0-NEXT: subs x10, x8, x9
5696 ; CHECK-NOLSE-O0-NEXT: csel x12, x8, x9, gt
5697 ; CHECK-NOLSE-O0-NEXT: LBB64_2: ; %atomicrmw.start
5698 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB64_1 Depth=1
5699 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5700 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5701 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5702 ; CHECK-NOLSE-O0-NEXT: b.ne LBB64_4
5703 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5704 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB64_2 Depth=2
5705 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5706 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB64_2
5707 ; CHECK-NOLSE-O0-NEXT: LBB64_4: ; %atomicrmw.start
5708 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB64_1 Depth=1
5709 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5710 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5711 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5712 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5713 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB64_1
5714 ; CHECK-NOLSE-O0-NEXT: b LBB64_5
5715 ; CHECK-NOLSE-O0-NEXT: LBB64_5: ; %atomicrmw.end
5716 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5717 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5718 ; CHECK-NOLSE-O0-NEXT: ret
5720 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_max_i64:
5721 ; CHECK-OUTLINE-O0: ; %bb.0:
5722 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #64
5723 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
5724 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 64
5725 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5726 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5727 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
5728 ; CHECK-OUTLINE-O0-NEXT: str x1, [sp, #32] ; 8-byte Folded Spill
5729 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [x0]
5730 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5731 ; CHECK-OUTLINE-O0-NEXT: b LBB64_1
5732 ; CHECK-OUTLINE-O0-NEXT: LBB64_1: ; %atomicrmw.start
5733 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
5734 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #40] ; 8-byte Folded Reload
5735 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #24] ; 8-byte Folded Reload
5736 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #32] ; 8-byte Folded Reload
5737 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5738 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, x8
5739 ; CHECK-OUTLINE-O0-NEXT: csel x1, x0, x8, gt
5740 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_rel
5741 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #8] ; 8-byte Folded Reload
5742 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x8
5743 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
5744 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
5745 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5746 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB64_1
5747 ; CHECK-OUTLINE-O0-NEXT: b LBB64_2
5748 ; CHECK-OUTLINE-O0-NEXT: LBB64_2: ; %atomicrmw.end
5749 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #16] ; 8-byte Folded Reload
5750 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
5751 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #64
5752 ; CHECK-OUTLINE-O0-NEXT: ret
5754 ; CHECK-LSE-O1-LABEL: atomicrmw_max_i64:
5755 ; CHECK-LSE-O1: ; %bb.0:
5756 ; CHECK-LSE-O1-NEXT: ldsmaxl x1, x0, [x0]
5757 ; CHECK-LSE-O1-NEXT: ret
5759 ; CHECK-LSE-O0-LABEL: atomicrmw_max_i64:
5760 ; CHECK-LSE-O0: ; %bb.0:
5761 ; CHECK-LSE-O0-NEXT: ldsmaxl x1, x0, [x0]
5762 ; CHECK-LSE-O0-NEXT: ret
5763 %res = atomicrmw max ptr %ptr, i64 %rhs release
5767 define i64 @atomicrmw_umin_i64(ptr %ptr, i64 %rhs) {
5768 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umin_i64:
5769 ; CHECK-NOLSE-O1: ; %bb.0:
5770 ; CHECK-NOLSE-O1-NEXT: LBB65_1: ; %atomicrmw.start
5771 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5772 ; CHECK-NOLSE-O1-NEXT: ldaxr x8, [x0]
5773 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
5774 ; CHECK-NOLSE-O1-NEXT: csel x9, x8, x1, lo
5775 ; CHECK-NOLSE-O1-NEXT: stlxr w10, x9, [x0]
5776 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB65_1
5777 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5778 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5779 ; CHECK-NOLSE-O1-NEXT: ret
5781 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umin_i64:
5782 ; CHECK-OUTLINE-O1: ; %bb.0:
5783 ; CHECK-OUTLINE-O1-NEXT: LBB65_1: ; %atomicrmw.start
5784 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5785 ; CHECK-OUTLINE-O1-NEXT: ldaxr x8, [x0]
5786 ; CHECK-OUTLINE-O1-NEXT: cmp x8, x1
5787 ; CHECK-OUTLINE-O1-NEXT: csel x9, x8, x1, lo
5788 ; CHECK-OUTLINE-O1-NEXT: stlxr w10, x9, [x0]
5789 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB65_1
5790 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5791 ; CHECK-OUTLINE-O1-NEXT: mov x0, x8
5792 ; CHECK-OUTLINE-O1-NEXT: ret
5794 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umin_i64:
5795 ; CHECK-NOLSE-O0: ; %bb.0:
5796 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5797 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5798 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5799 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5800 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5801 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5802 ; CHECK-NOLSE-O0-NEXT: b LBB65_1
5803 ; CHECK-NOLSE-O0-NEXT: LBB65_1: ; %atomicrmw.start
5804 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5805 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB65_2 Depth 2
5806 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5807 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5808 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5809 ; CHECK-NOLSE-O0-NEXT: subs x10, x8, x9
5810 ; CHECK-NOLSE-O0-NEXT: csel x12, x8, x9, ls
5811 ; CHECK-NOLSE-O0-NEXT: LBB65_2: ; %atomicrmw.start
5812 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB65_1 Depth=1
5813 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5814 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5815 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5816 ; CHECK-NOLSE-O0-NEXT: b.ne LBB65_4
5817 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5818 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB65_2 Depth=2
5819 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5820 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB65_2
5821 ; CHECK-NOLSE-O0-NEXT: LBB65_4: ; %atomicrmw.start
5822 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB65_1 Depth=1
5823 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5824 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5825 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5826 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5827 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB65_1
5828 ; CHECK-NOLSE-O0-NEXT: b LBB65_5
5829 ; CHECK-NOLSE-O0-NEXT: LBB65_5: ; %atomicrmw.end
5830 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5831 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5832 ; CHECK-NOLSE-O0-NEXT: ret
5834 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umin_i64:
5835 ; CHECK-OUTLINE-O0: ; %bb.0:
5836 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #64
5837 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
5838 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 64
5839 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5840 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5841 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
5842 ; CHECK-OUTLINE-O0-NEXT: str x1, [sp, #32] ; 8-byte Folded Spill
5843 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [x0]
5844 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5845 ; CHECK-OUTLINE-O0-NEXT: b LBB65_1
5846 ; CHECK-OUTLINE-O0-NEXT: LBB65_1: ; %atomicrmw.start
5847 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
5848 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #40] ; 8-byte Folded Reload
5849 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #24] ; 8-byte Folded Reload
5850 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #32] ; 8-byte Folded Reload
5851 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5852 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, x8
5853 ; CHECK-OUTLINE-O0-NEXT: csel x1, x0, x8, ls
5854 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_acq_rel
5855 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #8] ; 8-byte Folded Reload
5856 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x8
5857 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
5858 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
5859 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5860 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB65_1
5861 ; CHECK-OUTLINE-O0-NEXT: b LBB65_2
5862 ; CHECK-OUTLINE-O0-NEXT: LBB65_2: ; %atomicrmw.end
5863 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #16] ; 8-byte Folded Reload
5864 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
5865 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #64
5866 ; CHECK-OUTLINE-O0-NEXT: ret
5868 ; CHECK-LSE-O1-LABEL: atomicrmw_umin_i64:
5869 ; CHECK-LSE-O1: ; %bb.0:
5870 ; CHECK-LSE-O1-NEXT: lduminal x1, x0, [x0]
5871 ; CHECK-LSE-O1-NEXT: ret
5873 ; CHECK-LSE-O0-LABEL: atomicrmw_umin_i64:
5874 ; CHECK-LSE-O0: ; %bb.0:
5875 ; CHECK-LSE-O0-NEXT: lduminal x1, x0, [x0]
5876 ; CHECK-LSE-O0-NEXT: ret
5877 %res = atomicrmw umin ptr %ptr, i64 %rhs seq_cst
5881 define i64 @atomicrmw_umax_i64(ptr %ptr, i64 %rhs) {
5882 ; CHECK-NOLSE-O1-LABEL: atomicrmw_umax_i64:
5883 ; CHECK-NOLSE-O1: ; %bb.0:
5884 ; CHECK-NOLSE-O1-NEXT: LBB66_1: ; %atomicrmw.start
5885 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5886 ; CHECK-NOLSE-O1-NEXT: ldxr x8, [x0]
5887 ; CHECK-NOLSE-O1-NEXT: cmp x8, x1
5888 ; CHECK-NOLSE-O1-NEXT: csel x9, x8, x1, hi
5889 ; CHECK-NOLSE-O1-NEXT: stxr w10, x9, [x0]
5890 ; CHECK-NOLSE-O1-NEXT: cbnz w10, LBB66_1
5891 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5892 ; CHECK-NOLSE-O1-NEXT: mov x0, x8
5893 ; CHECK-NOLSE-O1-NEXT: ret
5895 ; CHECK-OUTLINE-O1-LABEL: atomicrmw_umax_i64:
5896 ; CHECK-OUTLINE-O1: ; %bb.0:
5897 ; CHECK-OUTLINE-O1-NEXT: LBB66_1: ; %atomicrmw.start
5898 ; CHECK-OUTLINE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
5899 ; CHECK-OUTLINE-O1-NEXT: ldxr x8, [x0]
5900 ; CHECK-OUTLINE-O1-NEXT: cmp x8, x1
5901 ; CHECK-OUTLINE-O1-NEXT: csel x9, x8, x1, hi
5902 ; CHECK-OUTLINE-O1-NEXT: stxr w10, x9, [x0]
5903 ; CHECK-OUTLINE-O1-NEXT: cbnz w10, LBB66_1
5904 ; CHECK-OUTLINE-O1-NEXT: ; %bb.2: ; %atomicrmw.end
5905 ; CHECK-OUTLINE-O1-NEXT: mov x0, x8
5906 ; CHECK-OUTLINE-O1-NEXT: ret
5908 ; CHECK-NOLSE-O0-LABEL: atomicrmw_umax_i64:
5909 ; CHECK-NOLSE-O0: ; %bb.0:
5910 ; CHECK-NOLSE-O0-NEXT: sub sp, sp, #32
5911 ; CHECK-NOLSE-O0-NEXT: .cfi_def_cfa_offset 32
5912 ; CHECK-NOLSE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5913 ; CHECK-NOLSE-O0-NEXT: str x1, [sp, #16] ; 8-byte Folded Spill
5914 ; CHECK-NOLSE-O0-NEXT: ldr x8, [x0]
5915 ; CHECK-NOLSE-O0-NEXT: str x8, [sp, #24] ; 8-byte Folded Spill
5916 ; CHECK-NOLSE-O0-NEXT: b LBB66_1
5917 ; CHECK-NOLSE-O0-NEXT: LBB66_1: ; %atomicrmw.start
5918 ; CHECK-NOLSE-O0-NEXT: ; =>This Loop Header: Depth=1
5919 ; CHECK-NOLSE-O0-NEXT: ; Child Loop BB66_2 Depth 2
5920 ; CHECK-NOLSE-O0-NEXT: ldr x8, [sp, #24] ; 8-byte Folded Reload
5921 ; CHECK-NOLSE-O0-NEXT: ldr x11, [sp, #8] ; 8-byte Folded Reload
5922 ; CHECK-NOLSE-O0-NEXT: ldr x9, [sp, #16] ; 8-byte Folded Reload
5923 ; CHECK-NOLSE-O0-NEXT: subs x10, x8, x9
5924 ; CHECK-NOLSE-O0-NEXT: csel x12, x8, x9, hi
5925 ; CHECK-NOLSE-O0-NEXT: LBB66_2: ; %atomicrmw.start
5926 ; CHECK-NOLSE-O0-NEXT: ; Parent Loop BB66_1 Depth=1
5927 ; CHECK-NOLSE-O0-NEXT: ; => This Inner Loop Header: Depth=2
5928 ; CHECK-NOLSE-O0-NEXT: ldaxr x9, [x11]
5929 ; CHECK-NOLSE-O0-NEXT: cmp x9, x8
5930 ; CHECK-NOLSE-O0-NEXT: b.ne LBB66_4
5931 ; CHECK-NOLSE-O0-NEXT: ; %bb.3: ; %atomicrmw.start
5932 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB66_2 Depth=2
5933 ; CHECK-NOLSE-O0-NEXT: stlxr w10, x12, [x11]
5934 ; CHECK-NOLSE-O0-NEXT: cbnz w10, LBB66_2
5935 ; CHECK-NOLSE-O0-NEXT: LBB66_4: ; %atomicrmw.start
5936 ; CHECK-NOLSE-O0-NEXT: ; in Loop: Header=BB66_1 Depth=1
5937 ; CHECK-NOLSE-O0-NEXT: subs x8, x9, x8
5938 ; CHECK-NOLSE-O0-NEXT: cset w8, eq
5939 ; CHECK-NOLSE-O0-NEXT: str x9, [sp] ; 8-byte Folded Spill
5940 ; CHECK-NOLSE-O0-NEXT: str x9, [sp, #24] ; 8-byte Folded Spill
5941 ; CHECK-NOLSE-O0-NEXT: tbz w8, #0, LBB66_1
5942 ; CHECK-NOLSE-O0-NEXT: b LBB66_5
5943 ; CHECK-NOLSE-O0-NEXT: LBB66_5: ; %atomicrmw.end
5944 ; CHECK-NOLSE-O0-NEXT: ldr x0, [sp] ; 8-byte Folded Reload
5945 ; CHECK-NOLSE-O0-NEXT: add sp, sp, #32
5946 ; CHECK-NOLSE-O0-NEXT: ret
5948 ; CHECK-OUTLINE-O0-LABEL: atomicrmw_umax_i64:
5949 ; CHECK-OUTLINE-O0: ; %bb.0:
5950 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #64
5951 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
5952 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 64
5953 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
5954 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
5955 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #24] ; 8-byte Folded Spill
5956 ; CHECK-OUTLINE-O0-NEXT: str x1, [sp, #32] ; 8-byte Folded Spill
5957 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [x0]
5958 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5959 ; CHECK-OUTLINE-O0-NEXT: b LBB66_1
5960 ; CHECK-OUTLINE-O0-NEXT: LBB66_1: ; %atomicrmw.start
5961 ; CHECK-OUTLINE-O0-NEXT: ; =>This Inner Loop Header: Depth=1
5962 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #40] ; 8-byte Folded Reload
5963 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp, #24] ; 8-byte Folded Reload
5964 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #32] ; 8-byte Folded Reload
5965 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
5966 ; CHECK-OUTLINE-O0-NEXT: subs x9, x0, x8
5967 ; CHECK-OUTLINE-O0-NEXT: csel x1, x0, x8, hi
5968 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_relax
5969 ; CHECK-OUTLINE-O0-NEXT: ldr x8, [sp, #8] ; 8-byte Folded Reload
5970 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x8
5971 ; CHECK-OUTLINE-O0-NEXT: cset w8, eq
5972 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #16] ; 8-byte Folded Spill
5973 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #40] ; 8-byte Folded Spill
5974 ; CHECK-OUTLINE-O0-NEXT: tbz w8, #0, LBB66_1
5975 ; CHECK-OUTLINE-O0-NEXT: b LBB66_2
5976 ; CHECK-OUTLINE-O0-NEXT: LBB66_2: ; %atomicrmw.end
5977 ; CHECK-OUTLINE-O0-NEXT: ldr x0, [sp, #16] ; 8-byte Folded Reload
5978 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
5979 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #64
5980 ; CHECK-OUTLINE-O0-NEXT: ret
5982 ; CHECK-LSE-O1-LABEL: atomicrmw_umax_i64:
5983 ; CHECK-LSE-O1: ; %bb.0:
5984 ; CHECK-LSE-O1-NEXT: ldumax x1, x0, [x0]
5985 ; CHECK-LSE-O1-NEXT: ret
5987 ; CHECK-LSE-O0-LABEL: atomicrmw_umax_i64:
5988 ; CHECK-LSE-O0: ; %bb.0:
5989 ; CHECK-LSE-O0-NEXT: ldumax x1, x0, [x0]
5990 ; CHECK-LSE-O0-NEXT: ret
5991 %res = atomicrmw umax ptr %ptr, i64 %rhs monotonic
5995 define { i8, i1 } @cmpxchg_i8(ptr %ptr, i8 %desired, i8 %new) {
5996 ; CHECK-NOLSE-O1-LABEL: cmpxchg_i8:
5997 ; CHECK-NOLSE-O1: ; %bb.0:
5998 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
5999 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w2 killed $w2 def $x2
6000 ; CHECK-NOLSE-O1-NEXT: LBB67_1: ; %cmpxchg.start
6001 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
6002 ; CHECK-NOLSE-O1-NEXT: ldxrb w0, [x8]
6003 ; CHECK-NOLSE-O1-NEXT: and w9, w0, #0xff
6004 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, uxtb
6005 ; CHECK-NOLSE-O1-NEXT: b.ne LBB67_4
6006 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
6007 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB67_1 Depth=1
6008 ; CHECK-NOLSE-O1-NEXT: stxrb w9, w2, [x8]
6009 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB67_1
6010 ; CHECK-NOLSE-O1-NEXT: ; %bb.3:
6011 ; CHECK-NOLSE-O1-NEXT: mov w1, #1 ; =0x1
6012 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6013 ; CHECK-NOLSE-O1-NEXT: ret
6014 ; CHECK-NOLSE-O1-NEXT: LBB67_4: ; %cmpxchg.nostore
6015 ; CHECK-NOLSE-O1-NEXT: mov w1, wzr
6016 ; CHECK-NOLSE-O1-NEXT: clrex
6017 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6018 ; CHECK-NOLSE-O1-NEXT: ret
6020 ; CHECK-OUTLINE-O1-LABEL: cmpxchg_i8:
6021 ; CHECK-OUTLINE-O1: ; %bb.0:
6022 ; CHECK-OUTLINE-O1-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
6023 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6024 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 32
6025 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
6026 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
6027 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w19, -24
6028 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w20, -32
6029 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
6030 ; CHECK-OUTLINE-O1-NEXT: mov w19, w1
6031 ; CHECK-OUTLINE-O1-NEXT: mov w1, w2
6032 ; CHECK-OUTLINE-O1-NEXT: mov w0, w19
6033 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
6034 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas1_relax
6035 ; CHECK-OUTLINE-O1-NEXT: and w8, w0, #0xff
6036 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6037 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w19, uxtb
6038 ; CHECK-OUTLINE-O1-NEXT: cset w1, eq
6039 ; CHECK-OUTLINE-O1-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
6040 ; CHECK-OUTLINE-O1-NEXT: ret
6042 ; CHECK-NOLSE-O0-LABEL: cmpxchg_i8:
6043 ; CHECK-NOLSE-O0: ; %bb.0:
6044 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
6045 ; CHECK-NOLSE-O0-NEXT: LBB67_1: ; =>This Inner Loop Header: Depth=1
6046 ; CHECK-NOLSE-O0-NEXT: ldaxrb w0, [x9]
6047 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1, uxtb
6048 ; CHECK-NOLSE-O0-NEXT: b.ne LBB67_3
6049 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB67_1 Depth=1
6050 ; CHECK-NOLSE-O0-NEXT: stlxrb w8, w2, [x9]
6051 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB67_1
6052 ; CHECK-NOLSE-O0-NEXT: LBB67_3:
6053 ; CHECK-NOLSE-O0-NEXT: and w8, w0, #0xff
6054 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w1, uxtb
6055 ; CHECK-NOLSE-O0-NEXT: cset w1, eq
6056 ; CHECK-NOLSE-O0-NEXT: ret
6058 ; CHECK-OUTLINE-O0-LABEL: cmpxchg_i8:
6059 ; CHECK-OUTLINE-O0: ; %bb.0:
6060 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
6061 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6062 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
6063 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
6064 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
6065 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
6066 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
6067 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
6068 ; CHECK-OUTLINE-O0-NEXT: mov w1, w2
6069 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp] ; 8-byte Folded Reload
6070 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas1_relax
6071 ; CHECK-OUTLINE-O0-NEXT: ldr w1, [sp, #12] ; 4-byte Folded Reload
6072 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xff
6073 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w1, uxtb
6074 ; CHECK-OUTLINE-O0-NEXT: cset w1, eq
6075 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6076 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
6077 ; CHECK-OUTLINE-O0-NEXT: ret
6079 ; CHECK-LSE-O1-LABEL: cmpxchg_i8:
6080 ; CHECK-LSE-O1: ; %bb.0:
6081 ; CHECK-LSE-O1-NEXT: mov x8, x1
6082 ; CHECK-LSE-O1-NEXT: casb w8, w2, [x0]
6083 ; CHECK-LSE-O1-NEXT: and w9, w8, #0xff
6084 ; CHECK-LSE-O1-NEXT: cmp w9, w1, uxtb
6085 ; CHECK-LSE-O1-NEXT: cset w1, eq
6086 ; CHECK-LSE-O1-NEXT: mov x0, x8
6087 ; CHECK-LSE-O1-NEXT: ret
6089 ; CHECK-LSE-O0-LABEL: cmpxchg_i8:
6090 ; CHECK-LSE-O0: ; %bb.0:
6091 ; CHECK-LSE-O0-NEXT: mov x8, x0
6092 ; CHECK-LSE-O0-NEXT: mov x0, x1
6093 ; CHECK-LSE-O0-NEXT: casb w0, w2, [x8]
6094 ; CHECK-LSE-O0-NEXT: and w8, w0, #0xff
6095 ; CHECK-LSE-O0-NEXT: subs w8, w8, w1, uxtb
6096 ; CHECK-LSE-O0-NEXT: cset w1, eq
6097 ; CHECK-LSE-O0-NEXT: ret
6098 %res = cmpxchg ptr %ptr, i8 %desired, i8 %new monotonic monotonic
6102 define { i16, i1 } @cmpxchg_i16(ptr %ptr, i16 %desired, i16 %new) {
6103 ; CHECK-NOLSE-O1-LABEL: cmpxchg_i16:
6104 ; CHECK-NOLSE-O1: ; %bb.0:
6105 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
6106 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w2 killed $w2 def $x2
6107 ; CHECK-NOLSE-O1-NEXT: LBB68_1: ; %cmpxchg.start
6108 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
6109 ; CHECK-NOLSE-O1-NEXT: ldxrh w0, [x8]
6110 ; CHECK-NOLSE-O1-NEXT: and w9, w0, #0xffff
6111 ; CHECK-NOLSE-O1-NEXT: cmp w9, w1, uxth
6112 ; CHECK-NOLSE-O1-NEXT: b.ne LBB68_4
6113 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
6114 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB68_1 Depth=1
6115 ; CHECK-NOLSE-O1-NEXT: stxrh w9, w2, [x8]
6116 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB68_1
6117 ; CHECK-NOLSE-O1-NEXT: ; %bb.3:
6118 ; CHECK-NOLSE-O1-NEXT: mov w1, #1 ; =0x1
6119 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6120 ; CHECK-NOLSE-O1-NEXT: ret
6121 ; CHECK-NOLSE-O1-NEXT: LBB68_4: ; %cmpxchg.nostore
6122 ; CHECK-NOLSE-O1-NEXT: mov w1, wzr
6123 ; CHECK-NOLSE-O1-NEXT: clrex
6124 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6125 ; CHECK-NOLSE-O1-NEXT: ret
6127 ; CHECK-OUTLINE-O1-LABEL: cmpxchg_i16:
6128 ; CHECK-OUTLINE-O1: ; %bb.0:
6129 ; CHECK-OUTLINE-O1-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
6130 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6131 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 32
6132 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
6133 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
6134 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w19, -24
6135 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w20, -32
6136 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
6137 ; CHECK-OUTLINE-O1-NEXT: mov w19, w1
6138 ; CHECK-OUTLINE-O1-NEXT: mov w1, w2
6139 ; CHECK-OUTLINE-O1-NEXT: mov w0, w19
6140 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
6141 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas2_relax
6142 ; CHECK-OUTLINE-O1-NEXT: and w8, w0, #0xffff
6143 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6144 ; CHECK-OUTLINE-O1-NEXT: cmp w8, w19, uxth
6145 ; CHECK-OUTLINE-O1-NEXT: cset w1, eq
6146 ; CHECK-OUTLINE-O1-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
6147 ; CHECK-OUTLINE-O1-NEXT: ret
6149 ; CHECK-NOLSE-O0-LABEL: cmpxchg_i16:
6150 ; CHECK-NOLSE-O0: ; %bb.0:
6151 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
6152 ; CHECK-NOLSE-O0-NEXT: LBB68_1: ; =>This Inner Loop Header: Depth=1
6153 ; CHECK-NOLSE-O0-NEXT: ldaxrh w0, [x9]
6154 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1, uxth
6155 ; CHECK-NOLSE-O0-NEXT: b.ne LBB68_3
6156 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB68_1 Depth=1
6157 ; CHECK-NOLSE-O0-NEXT: stlxrh w8, w2, [x9]
6158 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB68_1
6159 ; CHECK-NOLSE-O0-NEXT: LBB68_3:
6160 ; CHECK-NOLSE-O0-NEXT: and w8, w0, #0xffff
6161 ; CHECK-NOLSE-O0-NEXT: subs w8, w8, w1, uxth
6162 ; CHECK-NOLSE-O0-NEXT: cset w1, eq
6163 ; CHECK-NOLSE-O0-NEXT: ret
6165 ; CHECK-OUTLINE-O0-LABEL: cmpxchg_i16:
6166 ; CHECK-OUTLINE-O0: ; %bb.0:
6167 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
6168 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6169 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
6170 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
6171 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
6172 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
6173 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
6174 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
6175 ; CHECK-OUTLINE-O0-NEXT: mov w1, w2
6176 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp] ; 8-byte Folded Reload
6177 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas2_relax
6178 ; CHECK-OUTLINE-O0-NEXT: ldr w1, [sp, #12] ; 4-byte Folded Reload
6179 ; CHECK-OUTLINE-O0-NEXT: and w8, w0, #0xffff
6180 ; CHECK-OUTLINE-O0-NEXT: subs w8, w8, w1, uxth
6181 ; CHECK-OUTLINE-O0-NEXT: cset w1, eq
6182 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6183 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
6184 ; CHECK-OUTLINE-O0-NEXT: ret
6186 ; CHECK-LSE-O1-LABEL: cmpxchg_i16:
6187 ; CHECK-LSE-O1: ; %bb.0:
6188 ; CHECK-LSE-O1-NEXT: mov x8, x1
6189 ; CHECK-LSE-O1-NEXT: cash w8, w2, [x0]
6190 ; CHECK-LSE-O1-NEXT: and w9, w8, #0xffff
6191 ; CHECK-LSE-O1-NEXT: cmp w9, w1, uxth
6192 ; CHECK-LSE-O1-NEXT: cset w1, eq
6193 ; CHECK-LSE-O1-NEXT: mov x0, x8
6194 ; CHECK-LSE-O1-NEXT: ret
6196 ; CHECK-LSE-O0-LABEL: cmpxchg_i16:
6197 ; CHECK-LSE-O0: ; %bb.0:
6198 ; CHECK-LSE-O0-NEXT: mov x8, x0
6199 ; CHECK-LSE-O0-NEXT: mov x0, x1
6200 ; CHECK-LSE-O0-NEXT: cash w0, w2, [x8]
6201 ; CHECK-LSE-O0-NEXT: and w8, w0, #0xffff
6202 ; CHECK-LSE-O0-NEXT: subs w8, w8, w1, uxth
6203 ; CHECK-LSE-O0-NEXT: cset w1, eq
6204 ; CHECK-LSE-O0-NEXT: ret
6205 %res = cmpxchg ptr %ptr, i16 %desired, i16 %new monotonic monotonic
6206 ret { i16, i1 } %res
6209 define { i32, i1 } @cmpxchg_i32(ptr %ptr, i32 %desired, i32 %new) {
6210 ; CHECK-NOLSE-O1-LABEL: cmpxchg_i32:
6211 ; CHECK-NOLSE-O1: ; %bb.0:
6212 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
6213 ; CHECK-NOLSE-O1-NEXT: LBB69_1: ; %cmpxchg.start
6214 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
6215 ; CHECK-NOLSE-O1-NEXT: ldxr w0, [x8]
6216 ; CHECK-NOLSE-O1-NEXT: cmp w0, w1
6217 ; CHECK-NOLSE-O1-NEXT: b.ne LBB69_4
6218 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
6219 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB69_1 Depth=1
6220 ; CHECK-NOLSE-O1-NEXT: stxr w9, w2, [x8]
6221 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB69_1
6222 ; CHECK-NOLSE-O1-NEXT: ; %bb.3:
6223 ; CHECK-NOLSE-O1-NEXT: mov w1, #1 ; =0x1
6224 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6225 ; CHECK-NOLSE-O1-NEXT: ret
6226 ; CHECK-NOLSE-O1-NEXT: LBB69_4: ; %cmpxchg.nostore
6227 ; CHECK-NOLSE-O1-NEXT: mov w1, wzr
6228 ; CHECK-NOLSE-O1-NEXT: clrex
6229 ; CHECK-NOLSE-O1-NEXT: ; kill: def $w0 killed $w0 killed $x0
6230 ; CHECK-NOLSE-O1-NEXT: ret
6232 ; CHECK-OUTLINE-O1-LABEL: cmpxchg_i32:
6233 ; CHECK-OUTLINE-O1: ; %bb.0:
6234 ; CHECK-OUTLINE-O1-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
6235 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6236 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 32
6237 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
6238 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
6239 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w19, -24
6240 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w20, -32
6241 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
6242 ; CHECK-OUTLINE-O1-NEXT: mov w19, w1
6243 ; CHECK-OUTLINE-O1-NEXT: mov w1, w2
6244 ; CHECK-OUTLINE-O1-NEXT: mov w0, w19
6245 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
6246 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas4_relax
6247 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6248 ; CHECK-OUTLINE-O1-NEXT: cmp w0, w19
6249 ; CHECK-OUTLINE-O1-NEXT: cset w1, eq
6250 ; CHECK-OUTLINE-O1-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
6251 ; CHECK-OUTLINE-O1-NEXT: ret
6253 ; CHECK-NOLSE-O0-LABEL: cmpxchg_i32:
6254 ; CHECK-NOLSE-O0: ; %bb.0:
6255 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
6256 ; CHECK-NOLSE-O0-NEXT: LBB69_1: ; =>This Inner Loop Header: Depth=1
6257 ; CHECK-NOLSE-O0-NEXT: ldaxr w0, [x9]
6258 ; CHECK-NOLSE-O0-NEXT: cmp w0, w1
6259 ; CHECK-NOLSE-O0-NEXT: b.ne LBB69_3
6260 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB69_1 Depth=1
6261 ; CHECK-NOLSE-O0-NEXT: stlxr w8, w2, [x9]
6262 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB69_1
6263 ; CHECK-NOLSE-O0-NEXT: LBB69_3:
6264 ; CHECK-NOLSE-O0-NEXT: subs w8, w0, w1
6265 ; CHECK-NOLSE-O0-NEXT: cset w1, eq
6266 ; CHECK-NOLSE-O0-NEXT: ret
6268 ; CHECK-OUTLINE-O0-LABEL: cmpxchg_i32:
6269 ; CHECK-OUTLINE-O0: ; %bb.0:
6270 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
6271 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6272 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
6273 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
6274 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
6275 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
6276 ; CHECK-OUTLINE-O0-NEXT: mov w0, w1
6277 ; CHECK-OUTLINE-O0-NEXT: str w0, [sp, #12] ; 4-byte Folded Spill
6278 ; CHECK-OUTLINE-O0-NEXT: mov w1, w2
6279 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp] ; 8-byte Folded Reload
6280 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas4_relax
6281 ; CHECK-OUTLINE-O0-NEXT: ldr w1, [sp, #12] ; 4-byte Folded Reload
6282 ; CHECK-OUTLINE-O0-NEXT: subs w8, w0, w1
6283 ; CHECK-OUTLINE-O0-NEXT: cset w1, eq
6284 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6285 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
6286 ; CHECK-OUTLINE-O0-NEXT: ret
6288 ; CHECK-LSE-O1-LABEL: cmpxchg_i32:
6289 ; CHECK-LSE-O1: ; %bb.0:
6290 ; CHECK-LSE-O1-NEXT: mov x8, x1
6291 ; CHECK-LSE-O1-NEXT: cas w8, w2, [x0]
6292 ; CHECK-LSE-O1-NEXT: cmp w8, w1
6293 ; CHECK-LSE-O1-NEXT: cset w1, eq
6294 ; CHECK-LSE-O1-NEXT: mov x0, x8
6295 ; CHECK-LSE-O1-NEXT: ret
6297 ; CHECK-LSE-O0-LABEL: cmpxchg_i32:
6298 ; CHECK-LSE-O0: ; %bb.0:
6299 ; CHECK-LSE-O0-NEXT: mov x8, x0
6300 ; CHECK-LSE-O0-NEXT: mov x0, x1
6301 ; CHECK-LSE-O0-NEXT: cas w0, w2, [x8]
6302 ; CHECK-LSE-O0-NEXT: subs w8, w0, w1
6303 ; CHECK-LSE-O0-NEXT: cset w1, eq
6304 ; CHECK-LSE-O0-NEXT: ret
6305 %res = cmpxchg ptr %ptr, i32 %desired, i32 %new monotonic monotonic
6306 ret { i32, i1 } %res
6309 define { i64, i1 } @cmpxchg_i64(ptr %ptr, i64 %desired, i64 %new) {
6310 ; CHECK-NOLSE-O1-LABEL: cmpxchg_i64:
6311 ; CHECK-NOLSE-O1: ; %bb.0:
6312 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
6313 ; CHECK-NOLSE-O1-NEXT: LBB70_1: ; %cmpxchg.start
6314 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
6315 ; CHECK-NOLSE-O1-NEXT: ldxr x0, [x8]
6316 ; CHECK-NOLSE-O1-NEXT: cmp x0, x1
6317 ; CHECK-NOLSE-O1-NEXT: b.ne LBB70_4
6318 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
6319 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB70_1 Depth=1
6320 ; CHECK-NOLSE-O1-NEXT: stxr w9, x2, [x8]
6321 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB70_1
6322 ; CHECK-NOLSE-O1-NEXT: ; %bb.3:
6323 ; CHECK-NOLSE-O1-NEXT: mov w1, #1 ; =0x1
6324 ; CHECK-NOLSE-O1-NEXT: ret
6325 ; CHECK-NOLSE-O1-NEXT: LBB70_4: ; %cmpxchg.nostore
6326 ; CHECK-NOLSE-O1-NEXT: mov w1, wzr
6327 ; CHECK-NOLSE-O1-NEXT: clrex
6328 ; CHECK-NOLSE-O1-NEXT: ret
6330 ; CHECK-OUTLINE-O1-LABEL: cmpxchg_i64:
6331 ; CHECK-OUTLINE-O1: ; %bb.0:
6332 ; CHECK-OUTLINE-O1-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
6333 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6334 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 32
6335 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
6336 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
6337 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w19, -24
6338 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w20, -32
6339 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
6340 ; CHECK-OUTLINE-O1-NEXT: mov x19, x1
6341 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
6342 ; CHECK-OUTLINE-O1-NEXT: mov x0, x19
6343 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
6344 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas8_relax
6345 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6346 ; CHECK-OUTLINE-O1-NEXT: cmp x0, x19
6347 ; CHECK-OUTLINE-O1-NEXT: cset w1, eq
6348 ; CHECK-OUTLINE-O1-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
6349 ; CHECK-OUTLINE-O1-NEXT: ret
6351 ; CHECK-NOLSE-O0-LABEL: cmpxchg_i64:
6352 ; CHECK-NOLSE-O0: ; %bb.0:
6353 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
6354 ; CHECK-NOLSE-O0-NEXT: LBB70_1: ; =>This Inner Loop Header: Depth=1
6355 ; CHECK-NOLSE-O0-NEXT: ldaxr x0, [x9]
6356 ; CHECK-NOLSE-O0-NEXT: cmp x0, x1
6357 ; CHECK-NOLSE-O0-NEXT: b.ne LBB70_3
6358 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB70_1 Depth=1
6359 ; CHECK-NOLSE-O0-NEXT: stlxr w8, x2, [x9]
6360 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB70_1
6361 ; CHECK-NOLSE-O0-NEXT: LBB70_3:
6362 ; CHECK-NOLSE-O0-NEXT: subs x8, x0, x1
6363 ; CHECK-NOLSE-O0-NEXT: cset w1, eq
6364 ; CHECK-NOLSE-O0-NEXT: ret
6366 ; CHECK-OUTLINE-O0-LABEL: cmpxchg_i64:
6367 ; CHECK-OUTLINE-O0: ; %bb.0:
6368 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
6369 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6370 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
6371 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
6372 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
6373 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
6374 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
6375 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
6376 ; CHECK-OUTLINE-O0-NEXT: mov x1, x2
6377 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp] ; 8-byte Folded Reload
6378 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_relax
6379 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
6380 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x1
6381 ; CHECK-OUTLINE-O0-NEXT: cset w1, eq
6382 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6383 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
6384 ; CHECK-OUTLINE-O0-NEXT: ret
6386 ; CHECK-LSE-O1-LABEL: cmpxchg_i64:
6387 ; CHECK-LSE-O1: ; %bb.0:
6388 ; CHECK-LSE-O1-NEXT: mov x8, x1
6389 ; CHECK-LSE-O1-NEXT: cas x8, x2, [x0]
6390 ; CHECK-LSE-O1-NEXT: cmp x8, x1
6391 ; CHECK-LSE-O1-NEXT: cset w1, eq
6392 ; CHECK-LSE-O1-NEXT: mov x0, x8
6393 ; CHECK-LSE-O1-NEXT: ret
6395 ; CHECK-LSE-O0-LABEL: cmpxchg_i64:
6396 ; CHECK-LSE-O0: ; %bb.0:
6397 ; CHECK-LSE-O0-NEXT: mov x8, x0
6398 ; CHECK-LSE-O0-NEXT: mov x0, x1
6399 ; CHECK-LSE-O0-NEXT: cas x0, x2, [x8]
6400 ; CHECK-LSE-O0-NEXT: subs x8, x0, x1
6401 ; CHECK-LSE-O0-NEXT: cset w1, eq
6402 ; CHECK-LSE-O0-NEXT: ret
6403 %res = cmpxchg ptr %ptr, i64 %desired, i64 %new monotonic monotonic
6404 ret { i64, i1 } %res
6407 define { ptr, i1 } @cmpxchg_ptr(ptr %ptr, ptr %desired, ptr %new) {
6408 ; CHECK-NOLSE-O1-LABEL: cmpxchg_ptr:
6409 ; CHECK-NOLSE-O1: ; %bb.0:
6410 ; CHECK-NOLSE-O1-NEXT: mov x8, x0
6411 ; CHECK-NOLSE-O1-NEXT: LBB71_1: ; %cmpxchg.start
6412 ; CHECK-NOLSE-O1-NEXT: ; =>This Inner Loop Header: Depth=1
6413 ; CHECK-NOLSE-O1-NEXT: ldxr x0, [x8]
6414 ; CHECK-NOLSE-O1-NEXT: cmp x0, x1
6415 ; CHECK-NOLSE-O1-NEXT: b.ne LBB71_4
6416 ; CHECK-NOLSE-O1-NEXT: ; %bb.2: ; %cmpxchg.trystore
6417 ; CHECK-NOLSE-O1-NEXT: ; in Loop: Header=BB71_1 Depth=1
6418 ; CHECK-NOLSE-O1-NEXT: stxr w9, x2, [x8]
6419 ; CHECK-NOLSE-O1-NEXT: cbnz w9, LBB71_1
6420 ; CHECK-NOLSE-O1-NEXT: ; %bb.3:
6421 ; CHECK-NOLSE-O1-NEXT: mov w1, #1 ; =0x1
6422 ; CHECK-NOLSE-O1-NEXT: ret
6423 ; CHECK-NOLSE-O1-NEXT: LBB71_4: ; %cmpxchg.nostore
6424 ; CHECK-NOLSE-O1-NEXT: mov w1, wzr
6425 ; CHECK-NOLSE-O1-NEXT: clrex
6426 ; CHECK-NOLSE-O1-NEXT: ret
6428 ; CHECK-OUTLINE-O1-LABEL: cmpxchg_ptr:
6429 ; CHECK-OUTLINE-O1: ; %bb.0:
6430 ; CHECK-OUTLINE-O1-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
6431 ; CHECK-OUTLINE-O1-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6432 ; CHECK-OUTLINE-O1-NEXT: .cfi_def_cfa_offset 32
6433 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w30, -8
6434 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w29, -16
6435 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w19, -24
6436 ; CHECK-OUTLINE-O1-NEXT: .cfi_offset w20, -32
6437 ; CHECK-OUTLINE-O1-NEXT: mov x3, x0
6438 ; CHECK-OUTLINE-O1-NEXT: mov x19, x1
6439 ; CHECK-OUTLINE-O1-NEXT: mov x1, x2
6440 ; CHECK-OUTLINE-O1-NEXT: mov x0, x19
6441 ; CHECK-OUTLINE-O1-NEXT: mov x2, x3
6442 ; CHECK-OUTLINE-O1-NEXT: bl ___aarch64_cas8_relax
6443 ; CHECK-OUTLINE-O1-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6444 ; CHECK-OUTLINE-O1-NEXT: cmp x0, x19
6445 ; CHECK-OUTLINE-O1-NEXT: cset w1, eq
6446 ; CHECK-OUTLINE-O1-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
6447 ; CHECK-OUTLINE-O1-NEXT: ret
6449 ; CHECK-NOLSE-O0-LABEL: cmpxchg_ptr:
6450 ; CHECK-NOLSE-O0: ; %bb.0:
6451 ; CHECK-NOLSE-O0-NEXT: mov x9, x0
6452 ; CHECK-NOLSE-O0-NEXT: LBB71_1: ; =>This Inner Loop Header: Depth=1
6453 ; CHECK-NOLSE-O0-NEXT: ldaxr x0, [x9]
6454 ; CHECK-NOLSE-O0-NEXT: cmp x0, x1
6455 ; CHECK-NOLSE-O0-NEXT: b.ne LBB71_3
6456 ; CHECK-NOLSE-O0-NEXT: ; %bb.2: ; in Loop: Header=BB71_1 Depth=1
6457 ; CHECK-NOLSE-O0-NEXT: stlxr w8, x2, [x9]
6458 ; CHECK-NOLSE-O0-NEXT: cbnz w8, LBB71_1
6459 ; CHECK-NOLSE-O0-NEXT: LBB71_3:
6460 ; CHECK-NOLSE-O0-NEXT: subs x8, x0, x1
6461 ; CHECK-NOLSE-O0-NEXT: cset w1, eq
6462 ; CHECK-NOLSE-O0-NEXT: ret
6464 ; CHECK-OUTLINE-O0-LABEL: cmpxchg_ptr:
6465 ; CHECK-OUTLINE-O0: ; %bb.0:
6466 ; CHECK-OUTLINE-O0-NEXT: sub sp, sp, #32
6467 ; CHECK-OUTLINE-O0-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
6468 ; CHECK-OUTLINE-O0-NEXT: .cfi_def_cfa_offset 32
6469 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w30, -8
6470 ; CHECK-OUTLINE-O0-NEXT: .cfi_offset w29, -16
6471 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp] ; 8-byte Folded Spill
6472 ; CHECK-OUTLINE-O0-NEXT: mov x0, x1
6473 ; CHECK-OUTLINE-O0-NEXT: str x0, [sp, #8] ; 8-byte Folded Spill
6474 ; CHECK-OUTLINE-O0-NEXT: mov x1, x2
6475 ; CHECK-OUTLINE-O0-NEXT: ldr x2, [sp] ; 8-byte Folded Reload
6476 ; CHECK-OUTLINE-O0-NEXT: bl ___aarch64_cas8_relax
6477 ; CHECK-OUTLINE-O0-NEXT: ldr x1, [sp, #8] ; 8-byte Folded Reload
6478 ; CHECK-OUTLINE-O0-NEXT: subs x8, x0, x1
6479 ; CHECK-OUTLINE-O0-NEXT: cset w1, eq
6480 ; CHECK-OUTLINE-O0-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
6481 ; CHECK-OUTLINE-O0-NEXT: add sp, sp, #32
6482 ; CHECK-OUTLINE-O0-NEXT: ret
6484 ; CHECK-LSE-O1-LABEL: cmpxchg_ptr:
6485 ; CHECK-LSE-O1: ; %bb.0:
6486 ; CHECK-LSE-O1-NEXT: mov x8, x1
6487 ; CHECK-LSE-O1-NEXT: cas x8, x2, [x0]
6488 ; CHECK-LSE-O1-NEXT: cmp x8, x1
6489 ; CHECK-LSE-O1-NEXT: cset w1, eq
6490 ; CHECK-LSE-O1-NEXT: mov x0, x8
6491 ; CHECK-LSE-O1-NEXT: ret
6493 ; CHECK-LSE-O0-LABEL: cmpxchg_ptr:
6494 ; CHECK-LSE-O0: ; %bb.0:
6495 ; CHECK-LSE-O0-NEXT: mov x8, x0
6496 ; CHECK-LSE-O0-NEXT: mov x0, x1
6497 ; CHECK-LSE-O0-NEXT: cas x0, x2, [x8]
6498 ; CHECK-LSE-O0-NEXT: subs x8, x0, x1
6499 ; CHECK-LSE-O0-NEXT: cset w1, eq
6500 ; CHECK-LSE-O0-NEXT: ret
6501 %res = cmpxchg ptr %ptr, ptr %desired, ptr %new monotonic monotonic
6502 ret { ptr, i1 } %res
6505 define internal double @bitcast_to_double(ptr %ptr) {
6506 ; CHECK-NOLSE-LABEL: bitcast_to_double:
6507 ; CHECK-NOLSE: ; %bb.0:
6508 ; CHECK-NOLSE-NEXT: ldar x8, [x0]
6509 ; CHECK-NOLSE-NEXT: fmov d0, x8
6510 ; CHECK-NOLSE-NEXT: ret
6512 ; CHECK-OUTLINE-LABEL: bitcast_to_double:
6513 ; CHECK-OUTLINE: ; %bb.0:
6514 ; CHECK-OUTLINE-NEXT: ldar x8, [x0]
6515 ; CHECK-OUTLINE-NEXT: fmov d0, x8
6516 ; CHECK-OUTLINE-NEXT: ret
6518 ; CHECK-LSE-O1-LABEL: bitcast_to_double:
6519 ; CHECK-LSE-O1: ; %bb.0:
6520 ; CHECK-LSE-O1-NEXT: ldar x8, [x0]
6521 ; CHECK-LSE-O1-NEXT: fmov d0, x8
6522 ; CHECK-LSE-O1-NEXT: ret
6524 ; CHECK-LSE-O0-LABEL: bitcast_to_double:
6525 ; CHECK-LSE-O0: ; %bb.0:
6526 ; CHECK-LSE-O0-NEXT: ldar x8, [x0]
6527 ; CHECK-LSE-O0-NEXT: fmov d0, x8
6528 ; CHECK-LSE-O0-NEXT: ret
6529 %load = load atomic i64, ptr %ptr seq_cst, align 8
6530 %bitcast = bitcast i64 %load to double
6534 define internal float @bitcast_to_float(ptr %ptr) {
6535 ; CHECK-NOLSE-LABEL: bitcast_to_float:
6536 ; CHECK-NOLSE: ; %bb.0:
6537 ; CHECK-NOLSE-NEXT: ldar w8, [x0]
6538 ; CHECK-NOLSE-NEXT: fmov s0, w8
6539 ; CHECK-NOLSE-NEXT: ret
6541 ; CHECK-OUTLINE-LABEL: bitcast_to_float:
6542 ; CHECK-OUTLINE: ; %bb.0:
6543 ; CHECK-OUTLINE-NEXT: ldar w8, [x0]
6544 ; CHECK-OUTLINE-NEXT: fmov s0, w8
6545 ; CHECK-OUTLINE-NEXT: ret
6547 ; CHECK-LSE-O1-LABEL: bitcast_to_float:
6548 ; CHECK-LSE-O1: ; %bb.0:
6549 ; CHECK-LSE-O1-NEXT: ldar w8, [x0]
6550 ; CHECK-LSE-O1-NEXT: fmov s0, w8
6551 ; CHECK-LSE-O1-NEXT: ret
6553 ; CHECK-LSE-O0-LABEL: bitcast_to_float:
6554 ; CHECK-LSE-O0: ; %bb.0:
6555 ; CHECK-LSE-O0-NEXT: ldar w8, [x0]
6556 ; CHECK-LSE-O0-NEXT: fmov s0, w8
6557 ; CHECK-LSE-O0-NEXT: ret
6558 %load = load atomic i32, ptr %ptr seq_cst, align 8
6559 %bitcast = bitcast i32 %load to float
6563 define internal half @bitcast_to_half(ptr %ptr) {
6564 ; CHECK-NOLSE-LABEL: bitcast_to_half:
6565 ; CHECK-NOLSE: ; %bb.0:
6566 ; CHECK-NOLSE-NEXT: ldarh w8, [x0]
6567 ; CHECK-NOLSE-NEXT: fmov s0, w8
6568 ; CHECK-NOLSE-NEXT: ; kill: def $h0 killed $h0 killed $s0
6569 ; CHECK-NOLSE-NEXT: ret
6571 ; CHECK-OUTLINE-LABEL: bitcast_to_half:
6572 ; CHECK-OUTLINE: ; %bb.0:
6573 ; CHECK-OUTLINE-NEXT: ldarh w8, [x0]
6574 ; CHECK-OUTLINE-NEXT: fmov s0, w8
6575 ; CHECK-OUTLINE-NEXT: ; kill: def $h0 killed $h0 killed $s0
6576 ; CHECK-OUTLINE-NEXT: ret
6578 ; CHECK-LSE-O1-LABEL: bitcast_to_half:
6579 ; CHECK-LSE-O1: ; %bb.0:
6580 ; CHECK-LSE-O1-NEXT: ldarh w8, [x0]
6581 ; CHECK-LSE-O1-NEXT: fmov s0, w8
6582 ; CHECK-LSE-O1-NEXT: ; kill: def $h0 killed $h0 killed $s0
6583 ; CHECK-LSE-O1-NEXT: ret
6585 ; CHECK-LSE-O0-LABEL: bitcast_to_half:
6586 ; CHECK-LSE-O0: ; %bb.0:
6587 ; CHECK-LSE-O0-NEXT: ldarh w8, [x0]
6588 ; CHECK-LSE-O0-NEXT: fmov s0, w8
6589 ; CHECK-LSE-O0-NEXT: ; kill: def $h0 killed $h0 killed $s0
6590 ; CHECK-LSE-O0-NEXT: ret
6591 %load = load atomic i16, ptr %ptr seq_cst, align 8
6592 %bitcast = bitcast i16 %load to half
6596 define internal ptr @inttoptr(ptr %ptr) {
6597 ; CHECK-NOLSE-LABEL: inttoptr:
6598 ; CHECK-NOLSE: ; %bb.0:
6599 ; CHECK-NOLSE-NEXT: ldar x0, [x0]
6600 ; CHECK-NOLSE-NEXT: ret
6602 ; CHECK-OUTLINE-LABEL: inttoptr:
6603 ; CHECK-OUTLINE: ; %bb.0:
6604 ; CHECK-OUTLINE-NEXT: ldar x0, [x0]
6605 ; CHECK-OUTLINE-NEXT: ret
6607 ; CHECK-LSE-O1-LABEL: inttoptr:
6608 ; CHECK-LSE-O1: ; %bb.0:
6609 ; CHECK-LSE-O1-NEXT: ldar x0, [x0]
6610 ; CHECK-LSE-O1-NEXT: ret
6612 ; CHECK-LSE-O0-LABEL: inttoptr:
6613 ; CHECK-LSE-O0: ; %bb.0:
6614 ; CHECK-LSE-O0-NEXT: ldar x0, [x0]
6615 ; CHECK-LSE-O0-NEXT: ret
6616 %load = load atomic i64, ptr %ptr seq_cst, align 8
6617 %bitcast = inttoptr i64 %load to ptr
6621 define internal ptr @load_ptr(ptr %ptr) {
6622 ; CHECK-NOLSE-LABEL: load_ptr:
6623 ; CHECK-NOLSE: ; %bb.0:
6624 ; CHECK-NOLSE-NEXT: ldar x0, [x0]
6625 ; CHECK-NOLSE-NEXT: ret
6627 ; CHECK-OUTLINE-LABEL: load_ptr:
6628 ; CHECK-OUTLINE: ; %bb.0:
6629 ; CHECK-OUTLINE-NEXT: ldar x0, [x0]
6630 ; CHECK-OUTLINE-NEXT: ret
6632 ; CHECK-LSE-O1-LABEL: load_ptr:
6633 ; CHECK-LSE-O1: ; %bb.0:
6634 ; CHECK-LSE-O1-NEXT: ldar x0, [x0]
6635 ; CHECK-LSE-O1-NEXT: ret
6637 ; CHECK-LSE-O0-LABEL: load_ptr:
6638 ; CHECK-LSE-O0: ; %bb.0:
6639 ; CHECK-LSE-O0-NEXT: ldar x0, [x0]
6640 ; CHECK-LSE-O0-NEXT: ret
6641 %load = load atomic ptr, ptr %ptr seq_cst, align 8
6645 attributes #0 = { nounwind }