1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "(?!^\s*lda.*\bsp\b)^\s*.*\bsp\b" --filter "^\s*(ld|st[^r]|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
2 ; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=true -global-isel-abort=2 -O0 | FileCheck %s --check-prefixes=CHECK,GISEL
3 ; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=false -O1 | FileCheck %s --check-prefixes=CHECK,SDAG
5 define i8 @load_atomic_i8_aligned_unordered(ptr %ptr) {
6 ; CHECK-LABEL: load_atomic_i8_aligned_unordered:
7 ; CHECK: ldrb w0, [x0, #4]
8 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
9 %r = load atomic i8, ptr %gep unordered, align 1
13 define i8 @load_atomic_i8_aligned_unordered_const(ptr readonly %ptr) {
14 ; CHECK-LABEL: load_atomic_i8_aligned_unordered_const:
15 ; CHECK: ldrb w0, [x0, #4]
16 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
17 %r = load atomic i8, ptr %gep unordered, align 1
21 define i8 @load_atomic_i8_aligned_monotonic(ptr %ptr) {
22 ; CHECK-LABEL: load_atomic_i8_aligned_monotonic:
23 ; CHECK: ldrb w0, [x0, #4]
24 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
25 %r = load atomic i8, ptr %gep monotonic, align 1
29 define i8 @load_atomic_i8_aligned_monotonic_const(ptr readonly %ptr) {
30 ; CHECK-LABEL: load_atomic_i8_aligned_monotonic_const:
31 ; CHECK: ldrb w0, [x0, #4]
32 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
33 %r = load atomic i8, ptr %gep monotonic, align 1
37 define i8 @load_atomic_i8_aligned_acquire(ptr %ptr) {
38 ; GISEL-LABEL: load_atomic_i8_aligned_acquire:
39 ; GISEL: add x8, x0, #4
40 ; GISEL: ldaprb w0, [x8]
42 ; SDAG-LABEL: load_atomic_i8_aligned_acquire:
43 ; SDAG: ldapurb w0, [x0, #4]
44 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
45 %r = load atomic i8, ptr %gep acquire, align 1
49 define i8 @load_atomic_i8_aligned_acquire_const(ptr readonly %ptr) {
50 ; GISEL-LABEL: load_atomic_i8_aligned_acquire_const:
51 ; GISEL: add x8, x0, #4
52 ; GISEL: ldaprb w0, [x8]
54 ; SDAG-LABEL: load_atomic_i8_aligned_acquire_const:
55 ; SDAG: ldapurb w0, [x0, #4]
56 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
57 %r = load atomic i8, ptr %gep acquire, align 1
61 define i8 @load_atomic_i8_aligned_seq_cst(ptr %ptr) {
62 ; CHECK-LABEL: load_atomic_i8_aligned_seq_cst:
63 ; CHECK: add x8, x0, #4
64 ; CHECK: ldarb w0, [x8]
65 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
66 %r = load atomic i8, ptr %gep seq_cst, align 1
70 define i8 @load_atomic_i8_aligned_seq_cst_const(ptr readonly %ptr) {
71 ; CHECK-LABEL: load_atomic_i8_aligned_seq_cst_const:
72 ; CHECK: add x8, x0, #4
73 ; CHECK: ldarb w0, [x8]
74 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
75 %r = load atomic i8, ptr %gep seq_cst, align 1
79 define i16 @load_atomic_i16_aligned_unordered(ptr %ptr) {
80 ; CHECK-LABEL: load_atomic_i16_aligned_unordered:
81 ; CHECK: ldrh w0, [x0, #8]
82 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
83 %r = load atomic i16, ptr %gep unordered, align 2
87 define i16 @load_atomic_i16_aligned_unordered_const(ptr readonly %ptr) {
88 ; CHECK-LABEL: load_atomic_i16_aligned_unordered_const:
89 ; CHECK: ldrh w0, [x0, #8]
90 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
91 %r = load atomic i16, ptr %gep unordered, align 2
95 define i16 @load_atomic_i16_aligned_monotonic(ptr %ptr) {
96 ; CHECK-LABEL: load_atomic_i16_aligned_monotonic:
97 ; CHECK: ldrh w0, [x0, #8]
98 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
99 %r = load atomic i16, ptr %gep monotonic, align 2
103 define i16 @load_atomic_i16_aligned_monotonic_const(ptr readonly %ptr) {
104 ; CHECK-LABEL: load_atomic_i16_aligned_monotonic_const:
105 ; CHECK: ldrh w0, [x0, #8]
106 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
107 %r = load atomic i16, ptr %gep monotonic, align 2
111 define i16 @load_atomic_i16_aligned_acquire(ptr %ptr) {
112 ; GISEL-LABEL: load_atomic_i16_aligned_acquire:
113 ; GISEL: add x8, x0, #8
114 ; GISEL: ldaprh w0, [x8]
116 ; SDAG-LABEL: load_atomic_i16_aligned_acquire:
117 ; SDAG: ldapurh w0, [x0, #8]
118 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
119 %r = load atomic i16, ptr %gep acquire, align 2
123 define i16 @load_atomic_i16_aligned_acquire_const(ptr readonly %ptr) {
124 ; GISEL-LABEL: load_atomic_i16_aligned_acquire_const:
125 ; GISEL: add x8, x0, #8
126 ; GISEL: ldaprh w0, [x8]
128 ; SDAG-LABEL: load_atomic_i16_aligned_acquire_const:
129 ; SDAG: ldapurh w0, [x0, #8]
130 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
131 %r = load atomic i16, ptr %gep acquire, align 2
135 define i16 @load_atomic_i16_aligned_seq_cst(ptr %ptr) {
136 ; CHECK-LABEL: load_atomic_i16_aligned_seq_cst:
137 ; CHECK: add x8, x0, #8
138 ; CHECK: ldarh w0, [x8]
139 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
140 %r = load atomic i16, ptr %gep seq_cst, align 2
144 define i16 @load_atomic_i16_aligned_seq_cst_const(ptr readonly %ptr) {
145 ; CHECK-LABEL: load_atomic_i16_aligned_seq_cst_const:
146 ; CHECK: add x8, x0, #8
147 ; CHECK: ldarh w0, [x8]
148 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
149 %r = load atomic i16, ptr %gep seq_cst, align 2
153 define i32 @load_atomic_i32_aligned_unordered(ptr %ptr) {
154 ; CHECK-LABEL: load_atomic_i32_aligned_unordered:
155 ; CHECK: ldr w0, [x0, #16]
156 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
157 %r = load atomic i32, ptr %gep unordered, align 4
161 define i32 @load_atomic_i32_aligned_unordered_const(ptr readonly %ptr) {
162 ; CHECK-LABEL: load_atomic_i32_aligned_unordered_const:
163 ; CHECK: ldr w0, [x0, #16]
164 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
165 %r = load atomic i32, ptr %gep unordered, align 4
169 define i32 @load_atomic_i32_aligned_monotonic(ptr %ptr) {
170 ; CHECK-LABEL: load_atomic_i32_aligned_monotonic:
171 ; CHECK: ldr w0, [x0, #16]
172 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
173 %r = load atomic i32, ptr %gep monotonic, align 4
177 define i32 @load_atomic_i32_aligned_monotonic_const(ptr readonly %ptr) {
178 ; CHECK-LABEL: load_atomic_i32_aligned_monotonic_const:
179 ; CHECK: ldr w0, [x0, #16]
180 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
181 %r = load atomic i32, ptr %gep monotonic, align 4
185 define i32 @load_atomic_i32_aligned_acquire(ptr %ptr) {
186 ; CHECK-LABEL: load_atomic_i32_aligned_acquire:
187 ; CHECK: ldapur w0, [x0, #16]
188 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
189 %r = load atomic i32, ptr %gep acquire, align 4
193 define i32 @load_atomic_i32_aligned_acquire_const(ptr readonly %ptr) {
194 ; CHECK-LABEL: load_atomic_i32_aligned_acquire_const:
195 ; CHECK: ldapur w0, [x0, #16]
196 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
197 %r = load atomic i32, ptr %gep acquire, align 4
201 define i32 @load_atomic_i32_aligned_seq_cst(ptr %ptr) {
202 ; CHECK-LABEL: load_atomic_i32_aligned_seq_cst:
203 ; CHECK: add x8, x0, #16
204 ; CHECK: ldar w0, [x8]
205 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
206 %r = load atomic i32, ptr %gep seq_cst, align 4
210 define i32 @load_atomic_i32_aligned_seq_cst_const(ptr readonly %ptr) {
211 ; CHECK-LABEL: load_atomic_i32_aligned_seq_cst_const:
212 ; CHECK: add x8, x0, #16
213 ; CHECK: ldar w0, [x8]
214 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
215 %r = load atomic i32, ptr %gep seq_cst, align 4
219 define i64 @load_atomic_i64_aligned_unordered(ptr %ptr) {
220 ; CHECK-LABEL: load_atomic_i64_aligned_unordered:
221 ; CHECK: ldr x0, [x0, #32]
222 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
223 %r = load atomic i64, ptr %gep unordered, align 8
227 define i64 @load_atomic_i64_aligned_unordered_const(ptr readonly %ptr) {
228 ; CHECK-LABEL: load_atomic_i64_aligned_unordered_const:
229 ; CHECK: ldr x0, [x0, #32]
230 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
231 %r = load atomic i64, ptr %gep unordered, align 8
235 define i64 @load_atomic_i64_aligned_monotonic(ptr %ptr) {
236 ; CHECK-LABEL: load_atomic_i64_aligned_monotonic:
237 ; CHECK: ldr x0, [x0, #32]
238 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
239 %r = load atomic i64, ptr %gep monotonic, align 8
243 define i64 @load_atomic_i64_aligned_monotonic_const(ptr readonly %ptr) {
244 ; CHECK-LABEL: load_atomic_i64_aligned_monotonic_const:
245 ; CHECK: ldr x0, [x0, #32]
246 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
247 %r = load atomic i64, ptr %gep monotonic, align 8
251 define i64 @load_atomic_i64_aligned_acquire(ptr %ptr) {
252 ; CHECK-LABEL: load_atomic_i64_aligned_acquire:
253 ; CHECK: ldapur x0, [x0, #32]
254 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
255 %r = load atomic i64, ptr %gep acquire, align 8
259 define i64 @load_atomic_i64_aligned_acquire_const(ptr readonly %ptr) {
260 ; CHECK-LABEL: load_atomic_i64_aligned_acquire_const:
261 ; CHECK: ldapur x0, [x0, #32]
262 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
263 %r = load atomic i64, ptr %gep acquire, align 8
267 define i64 @load_atomic_i64_aligned_seq_cst(ptr %ptr) {
268 ; CHECK-LABEL: load_atomic_i64_aligned_seq_cst:
269 ; CHECK: add x8, x0, #32
270 ; CHECK: ldar x0, [x8]
271 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
272 %r = load atomic i64, ptr %gep seq_cst, align 8
276 define i64 @load_atomic_i64_aligned_seq_cst_const(ptr readonly %ptr) {
277 ; CHECK-LABEL: load_atomic_i64_aligned_seq_cst_const:
278 ; CHECK: add x8, x0, #32
279 ; CHECK: ldar x0, [x8]
280 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
281 %r = load atomic i64, ptr %gep seq_cst, align 8
285 define i128 @load_atomic_i128_aligned_unordered(ptr %ptr) {
286 ; CHECK-LABEL: load_atomic_i128_aligned_unordered:
287 ; CHECK: ldp x0, x1, [x0, #64]
288 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
289 %r = load atomic i128, ptr %gep unordered, align 16
293 define i128 @load_atomic_i128_aligned_unordered_const(ptr readonly %ptr) {
294 ; CHECK-LABEL: load_atomic_i128_aligned_unordered_const:
295 ; CHECK: ldp x0, x1, [x0, #64]
296 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
297 %r = load atomic i128, ptr %gep unordered, align 16
301 define i128 @load_atomic_i128_aligned_monotonic(ptr %ptr) {
302 ; CHECK-LABEL: load_atomic_i128_aligned_monotonic:
303 ; CHECK: ldp x0, x1, [x0, #64]
304 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
305 %r = load atomic i128, ptr %gep monotonic, align 16
309 define i128 @load_atomic_i128_aligned_monotonic_const(ptr readonly %ptr) {
310 ; CHECK-LABEL: load_atomic_i128_aligned_monotonic_const:
311 ; CHECK: ldp x0, x1, [x0, #64]
312 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
313 %r = load atomic i128, ptr %gep monotonic, align 16
317 define i128 @load_atomic_i128_aligned_acquire(ptr %ptr) {
318 ; CHECK-LABEL: load_atomic_i128_aligned_acquire:
319 ; CHECK: ldp x0, x1, [x0, #64]
321 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
322 %r = load atomic i128, ptr %gep acquire, align 16
326 define i128 @load_atomic_i128_aligned_acquire_const(ptr readonly %ptr) {
327 ; CHECK-LABEL: load_atomic_i128_aligned_acquire_const:
328 ; CHECK: ldp x0, x1, [x0, #64]
330 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
331 %r = load atomic i128, ptr %gep acquire, align 16
335 define i128 @load_atomic_i128_aligned_seq_cst(ptr %ptr) {
336 ; CHECK-LABEL: load_atomic_i128_aligned_seq_cst:
337 ; CHECK: ldp x0, x1, [x0, #64]
339 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
340 %r = load atomic i128, ptr %gep seq_cst, align 16
344 define i128 @load_atomic_i128_aligned_seq_cst_const(ptr readonly %ptr) {
345 ; CHECK-LABEL: load_atomic_i128_aligned_seq_cst_const:
346 ; CHECK: ldp x0, x1, [x0, #64]
348 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
349 %r = load atomic i128, ptr %gep seq_cst, align 16
353 define i8 @load_atomic_i8_unaligned_unordered(ptr %ptr) {
354 ; CHECK-LABEL: load_atomic_i8_unaligned_unordered:
355 ; CHECK: ldrb w0, [x0, #4]
356 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
357 %r = load atomic i8, ptr %gep unordered, align 1
361 define i8 @load_atomic_i8_unaligned_unordered_const(ptr readonly %ptr) {
362 ; CHECK-LABEL: load_atomic_i8_unaligned_unordered_const:
363 ; CHECK: ldrb w0, [x0, #4]
364 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
365 %r = load atomic i8, ptr %gep unordered, align 1
369 define i8 @load_atomic_i8_unaligned_monotonic(ptr %ptr) {
370 ; CHECK-LABEL: load_atomic_i8_unaligned_monotonic:
371 ; CHECK: ldrb w0, [x0, #4]
372 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
373 %r = load atomic i8, ptr %gep monotonic, align 1
377 define i8 @load_atomic_i8_unaligned_monotonic_const(ptr readonly %ptr) {
378 ; CHECK-LABEL: load_atomic_i8_unaligned_monotonic_const:
379 ; CHECK: ldrb w0, [x0, #4]
380 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
381 %r = load atomic i8, ptr %gep monotonic, align 1
385 define i8 @load_atomic_i8_unaligned_acquire(ptr %ptr) {
386 ; GISEL-LABEL: load_atomic_i8_unaligned_acquire:
387 ; GISEL: add x8, x0, #4
388 ; GISEL: ldaprb w0, [x8]
390 ; SDAG-LABEL: load_atomic_i8_unaligned_acquire:
391 ; SDAG: ldapurb w0, [x0, #4]
392 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
393 %r = load atomic i8, ptr %gep acquire, align 1
397 define i8 @load_atomic_i8_unaligned_acquire_const(ptr readonly %ptr) {
398 ; GISEL-LABEL: load_atomic_i8_unaligned_acquire_const:
399 ; GISEL: add x8, x0, #4
400 ; GISEL: ldaprb w0, [x8]
402 ; SDAG-LABEL: load_atomic_i8_unaligned_acquire_const:
403 ; SDAG: ldapurb w0, [x0, #4]
404 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
405 %r = load atomic i8, ptr %gep acquire, align 1
409 define i8 @load_atomic_i8_unaligned_seq_cst(ptr %ptr) {
410 ; CHECK-LABEL: load_atomic_i8_unaligned_seq_cst:
411 ; CHECK: add x8, x0, #4
412 ; CHECK: ldarb w0, [x8]
413 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
414 %r = load atomic i8, ptr %gep seq_cst, align 1
418 define i8 @load_atomic_i8_unaligned_seq_cst_const(ptr readonly %ptr) {
419 ; CHECK-LABEL: load_atomic_i8_unaligned_seq_cst_const:
420 ; CHECK: add x8, x0, #4
421 ; CHECK: ldarb w0, [x8]
422 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
423 %r = load atomic i8, ptr %gep seq_cst, align 1
427 define i16 @load_atomic_i16_unaligned_unordered(ptr %ptr) {
428 ; GISEL-LABEL: load_atomic_i16_unaligned_unordered:
429 ; GISEL: add x1, x8, #4
430 ; GISEL: bl __atomic_load
432 ; SDAG-LABEL: load_atomic_i16_unaligned_unordered:
433 ; SDAG: add x1, x0, #4
434 ; SDAG: bl __atomic_load
435 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
436 %r = load atomic i16, ptr %gep unordered, align 1
440 define i16 @load_atomic_i16_unaligned_unordered_const(ptr readonly %ptr) {
441 ; GISEL-LABEL: load_atomic_i16_unaligned_unordered_const:
442 ; GISEL: add x1, x8, #4
443 ; GISEL: bl __atomic_load
445 ; SDAG-LABEL: load_atomic_i16_unaligned_unordered_const:
446 ; SDAG: add x1, x0, #4
447 ; SDAG: bl __atomic_load
448 %gep = getelementptr inbounds i8, ptr %ptr, i32 4
449 %r = load atomic i16, ptr %gep unordered, align 1
453 define i16 @load_atomic_i16_unaligned_monotonic(ptr %ptr) {
454 ; GISEL-LABEL: load_atomic_i16_unaligned_monotonic:
455 ; GISEL: add x1, x8, #8
456 ; GISEL: bl __atomic_load
458 ; SDAG-LABEL: load_atomic_i16_unaligned_monotonic:
459 ; SDAG: add x1, x0, #8
460 ; SDAG: bl __atomic_load
461 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
462 %r = load atomic i16, ptr %gep monotonic, align 1
466 define i16 @load_atomic_i16_unaligned_monotonic_const(ptr readonly %ptr) {
467 ; GISEL-LABEL: load_atomic_i16_unaligned_monotonic_const:
468 ; GISEL: add x1, x8, #8
469 ; GISEL: bl __atomic_load
471 ; SDAG-LABEL: load_atomic_i16_unaligned_monotonic_const:
472 ; SDAG: add x1, x0, #8
473 ; SDAG: bl __atomic_load
474 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
475 %r = load atomic i16, ptr %gep monotonic, align 1
479 define i16 @load_atomic_i16_unaligned_acquire(ptr %ptr) {
480 ; GISEL-LABEL: load_atomic_i16_unaligned_acquire:
481 ; GISEL: add x1, x8, #8
482 ; GISEL: bl __atomic_load
484 ; SDAG-LABEL: load_atomic_i16_unaligned_acquire:
485 ; SDAG: add x1, x0, #8
486 ; SDAG: bl __atomic_load
487 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
488 %r = load atomic i16, ptr %gep acquire, align 1
492 define i16 @load_atomic_i16_unaligned_acquire_const(ptr readonly %ptr) {
493 ; GISEL-LABEL: load_atomic_i16_unaligned_acquire_const:
494 ; GISEL: add x1, x8, #8
495 ; GISEL: bl __atomic_load
497 ; SDAG-LABEL: load_atomic_i16_unaligned_acquire_const:
498 ; SDAG: add x1, x0, #8
499 ; SDAG: bl __atomic_load
500 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
501 %r = load atomic i16, ptr %gep acquire, align 1
505 define i16 @load_atomic_i16_unaligned_seq_cst(ptr %ptr) {
506 ; GISEL-LABEL: load_atomic_i16_unaligned_seq_cst:
507 ; GISEL: add x1, x8, #8
508 ; GISEL: bl __atomic_load
510 ; SDAG-LABEL: load_atomic_i16_unaligned_seq_cst:
511 ; SDAG: add x1, x0, #8
512 ; SDAG: bl __atomic_load
513 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
514 %r = load atomic i16, ptr %gep seq_cst, align 1
518 define i16 @load_atomic_i16_unaligned_seq_cst_const(ptr readonly %ptr) {
519 ; GISEL-LABEL: load_atomic_i16_unaligned_seq_cst_const:
520 ; GISEL: add x1, x8, #8
521 ; GISEL: bl __atomic_load
523 ; SDAG-LABEL: load_atomic_i16_unaligned_seq_cst_const:
524 ; SDAG: add x1, x0, #8
525 ; SDAG: bl __atomic_load
526 %gep = getelementptr inbounds i16, ptr %ptr, i32 4
527 %r = load atomic i16, ptr %gep seq_cst, align 1
531 define i32 @load_atomic_i32_unaligned_unordered(ptr %ptr) {
532 ; GISEL-LABEL: load_atomic_i32_unaligned_unordered:
533 ; GISEL: add x1, x8, #16
534 ; GISEL: bl __atomic_load
536 ; SDAG-LABEL: load_atomic_i32_unaligned_unordered:
537 ; SDAG: add x1, x0, #16
538 ; SDAG: bl __atomic_load
539 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
540 %r = load atomic i32, ptr %gep unordered, align 1
544 define i32 @load_atomic_i32_unaligned_unordered_const(ptr readonly %ptr) {
545 ; GISEL-LABEL: load_atomic_i32_unaligned_unordered_const:
546 ; GISEL: add x1, x8, #16
547 ; GISEL: bl __atomic_load
549 ; SDAG-LABEL: load_atomic_i32_unaligned_unordered_const:
550 ; SDAG: add x1, x0, #16
551 ; SDAG: bl __atomic_load
552 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
553 %r = load atomic i32, ptr %gep unordered, align 1
557 define i32 @load_atomic_i32_unaligned_monotonic(ptr %ptr) {
558 ; GISEL-LABEL: load_atomic_i32_unaligned_monotonic:
559 ; GISEL: add x1, x8, #16
560 ; GISEL: bl __atomic_load
562 ; SDAG-LABEL: load_atomic_i32_unaligned_monotonic:
563 ; SDAG: add x1, x0, #16
564 ; SDAG: bl __atomic_load
565 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
566 %r = load atomic i32, ptr %gep monotonic, align 1
570 define i32 @load_atomic_i32_unaligned_monotonic_const(ptr readonly %ptr) {
571 ; GISEL-LABEL: load_atomic_i32_unaligned_monotonic_const:
572 ; GISEL: add x1, x8, #16
573 ; GISEL: bl __atomic_load
575 ; SDAG-LABEL: load_atomic_i32_unaligned_monotonic_const:
576 ; SDAG: add x1, x0, #16
577 ; SDAG: bl __atomic_load
578 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
579 %r = load atomic i32, ptr %gep monotonic, align 1
583 define i32 @load_atomic_i32_unaligned_acquire(ptr %ptr) {
584 ; GISEL-LABEL: load_atomic_i32_unaligned_acquire:
585 ; GISEL: add x1, x8, #16
586 ; GISEL: bl __atomic_load
588 ; SDAG-LABEL: load_atomic_i32_unaligned_acquire:
589 ; SDAG: add x1, x0, #16
590 ; SDAG: bl __atomic_load
591 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
592 %r = load atomic i32, ptr %gep acquire, align 1
596 define i32 @load_atomic_i32_unaligned_acquire_const(ptr readonly %ptr) {
597 ; GISEL-LABEL: load_atomic_i32_unaligned_acquire_const:
598 ; GISEL: add x1, x8, #16
599 ; GISEL: bl __atomic_load
601 ; SDAG-LABEL: load_atomic_i32_unaligned_acquire_const:
602 ; SDAG: add x1, x0, #16
603 ; SDAG: bl __atomic_load
604 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
605 %r = load atomic i32, ptr %gep acquire, align 1
609 define i32 @load_atomic_i32_unaligned_seq_cst(ptr %ptr) {
610 ; GISEL-LABEL: load_atomic_i32_unaligned_seq_cst:
611 ; GISEL: add x1, x8, #16
612 ; GISEL: bl __atomic_load
614 ; SDAG-LABEL: load_atomic_i32_unaligned_seq_cst:
615 ; SDAG: add x1, x0, #16
616 ; SDAG: bl __atomic_load
617 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
618 %r = load atomic i32, ptr %gep seq_cst, align 1
622 define i32 @load_atomic_i32_unaligned_seq_cst_const(ptr readonly %ptr) {
623 ; GISEL-LABEL: load_atomic_i32_unaligned_seq_cst_const:
624 ; GISEL: add x1, x8, #16
625 ; GISEL: bl __atomic_load
627 ; SDAG-LABEL: load_atomic_i32_unaligned_seq_cst_const:
628 ; SDAG: add x1, x0, #16
629 ; SDAG: bl __atomic_load
630 %gep = getelementptr inbounds i32, ptr %ptr, i32 4
631 %r = load atomic i32, ptr %gep seq_cst, align 1
635 define i64 @load_atomic_i64_unaligned_unordered(ptr %ptr) {
636 ; GISEL-LABEL: load_atomic_i64_unaligned_unordered:
637 ; GISEL: add x1, x8, #32
638 ; GISEL: bl __atomic_load
640 ; SDAG-LABEL: load_atomic_i64_unaligned_unordered:
641 ; SDAG: add x1, x0, #32
642 ; SDAG: bl __atomic_load
643 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
644 %r = load atomic i64, ptr %gep unordered, align 1
648 define i64 @load_atomic_i64_unaligned_unordered_const(ptr readonly %ptr) {
649 ; GISEL-LABEL: load_atomic_i64_unaligned_unordered_const:
650 ; GISEL: add x1, x8, #32
651 ; GISEL: bl __atomic_load
653 ; SDAG-LABEL: load_atomic_i64_unaligned_unordered_const:
654 ; SDAG: add x1, x0, #32
655 ; SDAG: bl __atomic_load
656 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
657 %r = load atomic i64, ptr %gep unordered, align 1
661 define i64 @load_atomic_i64_unaligned_monotonic(ptr %ptr) {
662 ; GISEL-LABEL: load_atomic_i64_unaligned_monotonic:
663 ; GISEL: add x1, x8, #32
664 ; GISEL: bl __atomic_load
666 ; SDAG-LABEL: load_atomic_i64_unaligned_monotonic:
667 ; SDAG: add x1, x0, #32
668 ; SDAG: bl __atomic_load
669 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
670 %r = load atomic i64, ptr %gep monotonic, align 1
674 define i64 @load_atomic_i64_unaligned_monotonic_const(ptr readonly %ptr) {
675 ; GISEL-LABEL: load_atomic_i64_unaligned_monotonic_const:
676 ; GISEL: add x1, x8, #32
677 ; GISEL: bl __atomic_load
679 ; SDAG-LABEL: load_atomic_i64_unaligned_monotonic_const:
680 ; SDAG: add x1, x0, #32
681 ; SDAG: bl __atomic_load
682 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
683 %r = load atomic i64, ptr %gep monotonic, align 1
687 define i64 @load_atomic_i64_unaligned_acquire(ptr %ptr) {
688 ; GISEL-LABEL: load_atomic_i64_unaligned_acquire:
689 ; GISEL: add x1, x8, #32
690 ; GISEL: bl __atomic_load
692 ; SDAG-LABEL: load_atomic_i64_unaligned_acquire:
693 ; SDAG: add x1, x0, #32
694 ; SDAG: bl __atomic_load
695 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
696 %r = load atomic i64, ptr %gep acquire, align 1
700 define i64 @load_atomic_i64_unaligned_acquire_const(ptr readonly %ptr) {
701 ; GISEL-LABEL: load_atomic_i64_unaligned_acquire_const:
702 ; GISEL: add x1, x8, #32
703 ; GISEL: bl __atomic_load
705 ; SDAG-LABEL: load_atomic_i64_unaligned_acquire_const:
706 ; SDAG: add x1, x0, #32
707 ; SDAG: bl __atomic_load
708 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
709 %r = load atomic i64, ptr %gep acquire, align 1
713 define i64 @load_atomic_i64_unaligned_seq_cst(ptr %ptr) {
714 ; GISEL-LABEL: load_atomic_i64_unaligned_seq_cst:
715 ; GISEL: add x1, x8, #32
716 ; GISEL: bl __atomic_load
718 ; SDAG-LABEL: load_atomic_i64_unaligned_seq_cst:
719 ; SDAG: add x1, x0, #32
720 ; SDAG: bl __atomic_load
721 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
722 %r = load atomic i64, ptr %gep seq_cst, align 1
726 define i64 @load_atomic_i64_unaligned_seq_cst_const(ptr readonly %ptr) {
727 ; GISEL-LABEL: load_atomic_i64_unaligned_seq_cst_const:
728 ; GISEL: add x1, x8, #32
729 ; GISEL: bl __atomic_load
731 ; SDAG-LABEL: load_atomic_i64_unaligned_seq_cst_const:
732 ; SDAG: add x1, x0, #32
733 ; SDAG: bl __atomic_load
734 %gep = getelementptr inbounds i64, ptr %ptr, i32 4
735 %r = load atomic i64, ptr %gep seq_cst, align 1
739 define i128 @load_atomic_i128_unaligned_unordered(ptr %ptr) {
740 ; GISEL-LABEL: load_atomic_i128_unaligned_unordered:
741 ; GISEL: add x1, x8, #64
742 ; GISEL: bl __atomic_load
744 ; SDAG-LABEL: load_atomic_i128_unaligned_unordered:
745 ; SDAG: add x1, x0, #64
746 ; SDAG: bl __atomic_load
747 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
748 %r = load atomic i128, ptr %gep unordered, align 1
752 define i128 @load_atomic_i128_unaligned_unordered_const(ptr readonly %ptr) {
753 ; GISEL-LABEL: load_atomic_i128_unaligned_unordered_const:
754 ; GISEL: add x1, x8, #64
755 ; GISEL: bl __atomic_load
757 ; SDAG-LABEL: load_atomic_i128_unaligned_unordered_const:
758 ; SDAG: add x1, x0, #64
759 ; SDAG: bl __atomic_load
760 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
761 %r = load atomic i128, ptr %gep unordered, align 1
765 define i128 @load_atomic_i128_unaligned_monotonic(ptr %ptr) {
766 ; GISEL-LABEL: load_atomic_i128_unaligned_monotonic:
767 ; GISEL: add x1, x8, #64
768 ; GISEL: bl __atomic_load
770 ; SDAG-LABEL: load_atomic_i128_unaligned_monotonic:
771 ; SDAG: add x1, x0, #64
772 ; SDAG: bl __atomic_load
773 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
774 %r = load atomic i128, ptr %gep monotonic, align 1
778 define i128 @load_atomic_i128_unaligned_monotonic_const(ptr readonly %ptr) {
779 ; GISEL-LABEL: load_atomic_i128_unaligned_monotonic_const:
780 ; GISEL: add x1, x8, #64
781 ; GISEL: bl __atomic_load
783 ; SDAG-LABEL: load_atomic_i128_unaligned_monotonic_const:
784 ; SDAG: add x1, x0, #64
785 ; SDAG: bl __atomic_load
786 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
787 %r = load atomic i128, ptr %gep monotonic, align 1
791 define i128 @load_atomic_i128_unaligned_acquire(ptr %ptr) {
792 ; GISEL-LABEL: load_atomic_i128_unaligned_acquire:
793 ; GISEL: add x1, x8, #64
794 ; GISEL: bl __atomic_load
796 ; SDAG-LABEL: load_atomic_i128_unaligned_acquire:
797 ; SDAG: add x1, x0, #64
798 ; SDAG: bl __atomic_load
799 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
800 %r = load atomic i128, ptr %gep acquire, align 1
804 define i128 @load_atomic_i128_unaligned_acquire_const(ptr readonly %ptr) {
805 ; GISEL-LABEL: load_atomic_i128_unaligned_acquire_const:
806 ; GISEL: add x1, x8, #64
807 ; GISEL: bl __atomic_load
809 ; SDAG-LABEL: load_atomic_i128_unaligned_acquire_const:
810 ; SDAG: add x1, x0, #64
811 ; SDAG: bl __atomic_load
812 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
813 %r = load atomic i128, ptr %gep acquire, align 1
817 define i128 @load_atomic_i128_unaligned_seq_cst(ptr %ptr) {
818 ; GISEL-LABEL: load_atomic_i128_unaligned_seq_cst:
819 ; GISEL: add x1, x8, #64
820 ; GISEL: bl __atomic_load
822 ; SDAG-LABEL: load_atomic_i128_unaligned_seq_cst:
823 ; SDAG: add x1, x0, #64
824 ; SDAG: bl __atomic_load
825 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
826 %r = load atomic i128, ptr %gep seq_cst, align 1
830 define i128 @load_atomic_i128_unaligned_seq_cst_const(ptr readonly %ptr) {
831 ; GISEL-LABEL: load_atomic_i128_unaligned_seq_cst_const:
832 ; GISEL: add x1, x8, #64
833 ; GISEL: bl __atomic_load
835 ; SDAG-LABEL: load_atomic_i128_unaligned_seq_cst_const:
836 ; SDAG: add x1, x0, #64
837 ; SDAG: bl __atomic_load
838 %gep = getelementptr inbounds i128, ptr %ptr, i32 4
839 %r = load atomic i128, ptr %gep seq_cst, align 1
843 define i8 @load_atomic_i8_from_gep() {
844 ; GISEL-LABEL: load_atomic_i8_from_gep:
846 ; GISEL: add x8, x8, #1
847 ; GISEL: ldaprb w0, [x8]
849 ; SDAG-LABEL: load_atomic_i8_from_gep:
851 ; SDAG: ldapurb w0, [sp, #13]
853 call void @init(ptr %a)
854 %arrayidx = getelementptr [3 x i8], ptr %a, i64 0, i64 1
855 %l = load atomic i8, ptr %arrayidx acquire, align 8
859 define i16 @load_atomic_i16_from_gep() {
860 ; GISEL-LABEL: load_atomic_i16_from_gep:
862 ; GISEL: add x8, x8, #2
863 ; GISEL: ldaprh w0, [x8]
865 ; SDAG-LABEL: load_atomic_i16_from_gep:
867 ; SDAG: ldapurh w0, [sp, #10]
868 %a = alloca [3 x i16]
869 call void @init(ptr %a)
870 %arrayidx = getelementptr [3 x i16], ptr %a, i64 0, i64 1
871 %l = load atomic i16, ptr %arrayidx acquire, align 8
875 define i32 @load_atomic_i32_from_gep() {
876 ; GISEL-LABEL: load_atomic_i32_from_gep:
878 ; GISEL: ldapur w0, [x8, #4]
880 ; SDAG-LABEL: load_atomic_i32_from_gep:
882 ; SDAG: ldapur w0, [sp, #8]
883 %a = alloca [3 x i32]
884 call void @init(ptr %a)
885 %arrayidx = getelementptr [3 x i32], ptr %a, i64 0, i64 1
886 %l = load atomic i32, ptr %arrayidx acquire, align 8
890 define i64 @load_atomic_i64_from_gep() {
891 ; GISEL-LABEL: load_atomic_i64_from_gep:
893 ; GISEL: ldapur x0, [x8, #8]
895 ; SDAG-LABEL: load_atomic_i64_from_gep:
897 ; SDAG: ldapur x0, [sp, #16]
898 %a = alloca [3 x i64]
899 call void @init(ptr %a)
900 %arrayidx = getelementptr [3 x i64], ptr %a, i64 0, i64 1
901 %l = load atomic i64, ptr %arrayidx acquire, align 8
905 define i128 @load_atomic_i128_from_gep() {
906 ; GISEL-LABEL: load_atomic_i128_from_gep:
908 ; GISEL: ldp x0, x1, [x8, #16]
911 ; SDAG-LABEL: load_atomic_i128_from_gep:
914 %a = alloca [3 x i128]
915 call void @init(ptr %a)
916 %arrayidx = getelementptr [3 x i128], ptr %a, i64 0, i64 1
917 %l = load atomic i128, ptr %arrayidx acquire, align 16
921 declare void @init(ptr)