1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 define i8 @load_acquire_i8(ptr %ptr) {
6 ; LA32-LABEL: load_acquire_i8:
8 ; LA32-NEXT: ld.b $a0, $a0, 0
12 ; LA64-LABEL: load_acquire_i8:
14 ; LA64-NEXT: ld.b $a0, $a0, 0
17 %val = load atomic i8, ptr %ptr acquire, align 1
21 define i16 @load_acquire_i16(ptr %ptr) {
22 ; LA32-LABEL: load_acquire_i16:
24 ; LA32-NEXT: ld.h $a0, $a0, 0
28 ; LA64-LABEL: load_acquire_i16:
30 ; LA64-NEXT: ld.h $a0, $a0, 0
33 %val = load atomic i16, ptr %ptr acquire, align 2
37 define i32 @load_acquire_i32(ptr %ptr) {
38 ; LA32-LABEL: load_acquire_i32:
40 ; LA32-NEXT: ld.w $a0, $a0, 0
44 ; LA64-LABEL: load_acquire_i32:
46 ; LA64-NEXT: ld.w $a0, $a0, 0
49 %val = load atomic i32, ptr %ptr acquire, align 4
53 define i64 @load_acquire_i64(ptr %ptr) {
54 ; LA32-LABEL: load_acquire_i64:
56 ; LA32-NEXT: addi.w $sp, $sp, -16
57 ; LA32-NEXT: .cfi_def_cfa_offset 16
58 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
59 ; LA32-NEXT: .cfi_offset 1, -4
60 ; LA32-NEXT: ori $a1, $zero, 2
61 ; LA32-NEXT: bl %plt(__atomic_load_8)
62 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
63 ; LA32-NEXT: addi.w $sp, $sp, 16
66 ; LA64-LABEL: load_acquire_i64:
68 ; LA64-NEXT: ld.d $a0, $a0, 0
71 %val = load atomic i64, ptr %ptr acquire, align 8
75 define ptr @load_acquire_ptr(ptr %ptr) {
76 ; LA32-LABEL: load_acquire_ptr:
78 ; LA32-NEXT: ld.w $a0, $a0, 0
82 ; LA64-LABEL: load_acquire_ptr:
84 ; LA64-NEXT: ld.d $a0, $a0, 0
87 %val = load atomic ptr, ptr %ptr acquire, align 8
91 define float @load_acquire_float(ptr %ptr) {
92 ; LA32-LABEL: load_acquire_float:
94 ; LA32-NEXT: ld.w $a0, $a0, 0
95 ; LA32-NEXT: movgr2fr.w $fa0, $a0
99 ; LA64-LABEL: load_acquire_float:
101 ; LA64-NEXT: ld.w $a0, $a0, 0
102 ; LA64-NEXT: movgr2fr.w $fa0, $a0
105 %val = load atomic float, ptr %ptr acquire, align 8
109 define double @load_acquire_double(ptr %ptr) {
110 ; LA32-LABEL: load_acquire_double:
112 ; LA32-NEXT: addi.w $sp, $sp, -16
113 ; LA32-NEXT: .cfi_def_cfa_offset 16
114 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
115 ; LA32-NEXT: .cfi_offset 1, -4
116 ; LA32-NEXT: ori $a1, $zero, 2
117 ; LA32-NEXT: bl %plt(__atomic_load_8)
118 ; LA32-NEXT: st.w $a1, $sp, 4
119 ; LA32-NEXT: st.w $a0, $sp, 0
120 ; LA32-NEXT: fld.d $fa0, $sp, 0
121 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
122 ; LA32-NEXT: addi.w $sp, $sp, 16
125 ; LA64-LABEL: load_acquire_double:
127 ; LA64-NEXT: ld.d $a0, $a0, 0
128 ; LA64-NEXT: movgr2fr.d $fa0, $a0
131 %val = load atomic double, ptr %ptr acquire, align 8
135 define i8 @load_unordered_i8(ptr %ptr) {
136 ; LA32-LABEL: load_unordered_i8:
138 ; LA32-NEXT: ld.b $a0, $a0, 0
141 ; LA64-LABEL: load_unordered_i8:
143 ; LA64-NEXT: ld.b $a0, $a0, 0
145 %val = load atomic i8, ptr %ptr unordered, align 1
149 define i16 @load_unordered_i16(ptr %ptr) {
150 ; LA32-LABEL: load_unordered_i16:
152 ; LA32-NEXT: ld.h $a0, $a0, 0
155 ; LA64-LABEL: load_unordered_i16:
157 ; LA64-NEXT: ld.h $a0, $a0, 0
159 %val = load atomic i16, ptr %ptr unordered, align 2
163 define i32 @load_unordered_i32(ptr %ptr) {
164 ; LA32-LABEL: load_unordered_i32:
166 ; LA32-NEXT: ld.w $a0, $a0, 0
169 ; LA64-LABEL: load_unordered_i32:
171 ; LA64-NEXT: ld.w $a0, $a0, 0
173 %val = load atomic i32, ptr %ptr unordered, align 4
177 define i64 @load_unordered_i64(ptr %ptr) {
178 ; LA32-LABEL: load_unordered_i64:
180 ; LA32-NEXT: addi.w $sp, $sp, -16
181 ; LA32-NEXT: .cfi_def_cfa_offset 16
182 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
183 ; LA32-NEXT: .cfi_offset 1, -4
184 ; LA32-NEXT: move $a1, $zero
185 ; LA32-NEXT: bl %plt(__atomic_load_8)
186 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
187 ; LA32-NEXT: addi.w $sp, $sp, 16
190 ; LA64-LABEL: load_unordered_i64:
192 ; LA64-NEXT: ld.d $a0, $a0, 0
194 %val = load atomic i64, ptr %ptr unordered, align 8
198 define ptr @load_unordered_ptr(ptr %ptr) {
199 ; LA32-LABEL: load_unordered_ptr:
201 ; LA32-NEXT: ld.w $a0, $a0, 0
204 ; LA64-LABEL: load_unordered_ptr:
206 ; LA64-NEXT: ld.d $a0, $a0, 0
208 %val = load atomic ptr, ptr %ptr unordered, align 8
212 define float @load_unordered_float(ptr %ptr) {
213 ; LA32-LABEL: load_unordered_float:
215 ; LA32-NEXT: ld.w $a0, $a0, 0
216 ; LA32-NEXT: movgr2fr.w $fa0, $a0
219 ; LA64-LABEL: load_unordered_float:
221 ; LA64-NEXT: ld.w $a0, $a0, 0
222 ; LA64-NEXT: movgr2fr.w $fa0, $a0
224 %val = load atomic float, ptr %ptr unordered, align 8
228 define double @load_unordered_double(ptr %ptr) {
229 ; LA32-LABEL: load_unordered_double:
231 ; LA32-NEXT: addi.w $sp, $sp, -16
232 ; LA32-NEXT: .cfi_def_cfa_offset 16
233 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
234 ; LA32-NEXT: .cfi_offset 1, -4
235 ; LA32-NEXT: move $a1, $zero
236 ; LA32-NEXT: bl %plt(__atomic_load_8)
237 ; LA32-NEXT: st.w $a1, $sp, 4
238 ; LA32-NEXT: st.w $a0, $sp, 0
239 ; LA32-NEXT: fld.d $fa0, $sp, 0
240 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
241 ; LA32-NEXT: addi.w $sp, $sp, 16
244 ; LA64-LABEL: load_unordered_double:
246 ; LA64-NEXT: ld.d $a0, $a0, 0
247 ; LA64-NEXT: movgr2fr.d $fa0, $a0
249 %val = load atomic double, ptr %ptr unordered, align 8
253 define i8 @load_monotonic_i8(ptr %ptr) {
254 ; LA32-LABEL: load_monotonic_i8:
256 ; LA32-NEXT: ld.b $a0, $a0, 0
259 ; LA64-LABEL: load_monotonic_i8:
261 ; LA64-NEXT: ld.b $a0, $a0, 0
263 %val = load atomic i8, ptr %ptr monotonic, align 1
267 define i16 @load_monotonic_i16(ptr %ptr) {
268 ; LA32-LABEL: load_monotonic_i16:
270 ; LA32-NEXT: ld.h $a0, $a0, 0
273 ; LA64-LABEL: load_monotonic_i16:
275 ; LA64-NEXT: ld.h $a0, $a0, 0
277 %val = load atomic i16, ptr %ptr monotonic, align 2
281 define i32 @load_monotonic_i32(ptr %ptr) {
282 ; LA32-LABEL: load_monotonic_i32:
284 ; LA32-NEXT: ld.w $a0, $a0, 0
287 ; LA64-LABEL: load_monotonic_i32:
289 ; LA64-NEXT: ld.w $a0, $a0, 0
291 %val = load atomic i32, ptr %ptr monotonic, align 4
295 define i64 @load_monotonic_i64(ptr %ptr) {
296 ; LA32-LABEL: load_monotonic_i64:
298 ; LA32-NEXT: addi.w $sp, $sp, -16
299 ; LA32-NEXT: .cfi_def_cfa_offset 16
300 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
301 ; LA32-NEXT: .cfi_offset 1, -4
302 ; LA32-NEXT: move $a1, $zero
303 ; LA32-NEXT: bl %plt(__atomic_load_8)
304 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
305 ; LA32-NEXT: addi.w $sp, $sp, 16
308 ; LA64-LABEL: load_monotonic_i64:
310 ; LA64-NEXT: ld.d $a0, $a0, 0
312 %val = load atomic i64, ptr %ptr monotonic, align 8
316 define ptr @load_monotonic_ptr(ptr %ptr) {
317 ; LA32-LABEL: load_monotonic_ptr:
319 ; LA32-NEXT: ld.w $a0, $a0, 0
322 ; LA64-LABEL: load_monotonic_ptr:
324 ; LA64-NEXT: ld.d $a0, $a0, 0
326 %val = load atomic ptr, ptr %ptr monotonic, align 8
330 define float @load_monotonic_float(ptr %ptr) {
331 ; LA32-LABEL: load_monotonic_float:
333 ; LA32-NEXT: ld.w $a0, $a0, 0
334 ; LA32-NEXT: movgr2fr.w $fa0, $a0
337 ; LA64-LABEL: load_monotonic_float:
339 ; LA64-NEXT: ld.w $a0, $a0, 0
340 ; LA64-NEXT: movgr2fr.w $fa0, $a0
342 %val = load atomic float, ptr %ptr monotonic, align 8
346 define double @load_monotonic_double(ptr %ptr) {
347 ; LA32-LABEL: load_monotonic_double:
349 ; LA32-NEXT: addi.w $sp, $sp, -16
350 ; LA32-NEXT: .cfi_def_cfa_offset 16
351 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
352 ; LA32-NEXT: .cfi_offset 1, -4
353 ; LA32-NEXT: move $a1, $zero
354 ; LA32-NEXT: bl %plt(__atomic_load_8)
355 ; LA32-NEXT: st.w $a1, $sp, 4
356 ; LA32-NEXT: st.w $a0, $sp, 0
357 ; LA32-NEXT: fld.d $fa0, $sp, 0
358 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
359 ; LA32-NEXT: addi.w $sp, $sp, 16
362 ; LA64-LABEL: load_monotonic_double:
364 ; LA64-NEXT: ld.d $a0, $a0, 0
365 ; LA64-NEXT: movgr2fr.d $fa0, $a0
367 %val = load atomic double, ptr %ptr monotonic, align 8
371 define i8 @load_seq_cst_i8(ptr %ptr) {
372 ; LA32-LABEL: load_seq_cst_i8:
374 ; LA32-NEXT: ld.b $a0, $a0, 0
378 ; LA64-LABEL: load_seq_cst_i8:
380 ; LA64-NEXT: ld.b $a0, $a0, 0
383 %val = load atomic i8, ptr %ptr seq_cst, align 1
387 define i16 @load_seq_cst_i16(ptr %ptr) {
388 ; LA32-LABEL: load_seq_cst_i16:
390 ; LA32-NEXT: ld.h $a0, $a0, 0
394 ; LA64-LABEL: load_seq_cst_i16:
396 ; LA64-NEXT: ld.h $a0, $a0, 0
399 %val = load atomic i16, ptr %ptr seq_cst, align 2
403 define i32 @load_seq_cst_i32(ptr %ptr) {
404 ; LA32-LABEL: load_seq_cst_i32:
406 ; LA32-NEXT: ld.w $a0, $a0, 0
410 ; LA64-LABEL: load_seq_cst_i32:
412 ; LA64-NEXT: ld.w $a0, $a0, 0
415 %val = load atomic i32, ptr %ptr seq_cst, align 4
419 define i64 @load_seq_cst_i64(ptr %ptr) {
420 ; LA32-LABEL: load_seq_cst_i64:
422 ; LA32-NEXT: addi.w $sp, $sp, -16
423 ; LA32-NEXT: .cfi_def_cfa_offset 16
424 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
425 ; LA32-NEXT: .cfi_offset 1, -4
426 ; LA32-NEXT: ori $a1, $zero, 5
427 ; LA32-NEXT: bl %plt(__atomic_load_8)
428 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
429 ; LA32-NEXT: addi.w $sp, $sp, 16
432 ; LA64-LABEL: load_seq_cst_i64:
434 ; LA64-NEXT: ld.d $a0, $a0, 0
437 %val = load atomic i64, ptr %ptr seq_cst, align 8
441 define ptr @load_seq_cst_ptr(ptr %ptr) {
442 ; LA32-LABEL: load_seq_cst_ptr:
444 ; LA32-NEXT: ld.w $a0, $a0, 0
448 ; LA64-LABEL: load_seq_cst_ptr:
450 ; LA64-NEXT: ld.d $a0, $a0, 0
453 %val = load atomic ptr, ptr %ptr seq_cst, align 8
457 define float @load_seq_cst_float(ptr %ptr) {
458 ; LA32-LABEL: load_seq_cst_float:
460 ; LA32-NEXT: ld.w $a0, $a0, 0
461 ; LA32-NEXT: movgr2fr.w $fa0, $a0
465 ; LA64-LABEL: load_seq_cst_float:
467 ; LA64-NEXT: ld.w $a0, $a0, 0
468 ; LA64-NEXT: movgr2fr.w $fa0, $a0
471 %val = load atomic float, ptr %ptr seq_cst, align 8
475 define double @load_seq_cst_double(ptr %ptr) {
476 ; LA32-LABEL: load_seq_cst_double:
478 ; LA32-NEXT: addi.w $sp, $sp, -16
479 ; LA32-NEXT: .cfi_def_cfa_offset 16
480 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
481 ; LA32-NEXT: .cfi_offset 1, -4
482 ; LA32-NEXT: ori $a1, $zero, 5
483 ; LA32-NEXT: bl %plt(__atomic_load_8)
484 ; LA32-NEXT: st.w $a1, $sp, 4
485 ; LA32-NEXT: st.w $a0, $sp, 0
486 ; LA32-NEXT: fld.d $fa0, $sp, 0
487 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
488 ; LA32-NEXT: addi.w $sp, $sp, 16
491 ; LA64-LABEL: load_seq_cst_double:
493 ; LA64-NEXT: ld.d $a0, $a0, 0
494 ; LA64-NEXT: movgr2fr.d $fa0, $a0
497 %val = load atomic double, ptr %ptr seq_cst, align 8
501 define void @store_release_i8(ptr %ptr, i8 signext %v) {
502 ; LA32-LABEL: store_release_i8:
505 ; LA32-NEXT: st.b $a1, $a0, 0
508 ; LA64-LABEL: store_release_i8:
511 ; LA64-NEXT: st.b $a1, $a0, 0
513 store atomic i8 %v, ptr %ptr release, align 1
517 define void @store_release_i16(ptr %ptr, i16 signext %v) {
518 ; LA32-LABEL: store_release_i16:
521 ; LA32-NEXT: st.h $a1, $a0, 0
524 ; LA64-LABEL: store_release_i16:
527 ; LA64-NEXT: st.h $a1, $a0, 0
529 store atomic i16 %v, ptr %ptr release, align 2
533 define void @store_release_i32(ptr %ptr, i32 signext %v) {
534 ; LA32-LABEL: store_release_i32:
537 ; LA32-NEXT: st.w $a1, $a0, 0
540 ; LA64-LABEL: store_release_i32:
542 ; LA64-NEXT: amswap_db.w $zero, $a1, $a0
544 store atomic i32 %v, ptr %ptr release, align 4
548 define void @store_release_i64(ptr %ptr, i64 %v) {
549 ; LA32-LABEL: store_release_i64:
551 ; LA32-NEXT: addi.w $sp, $sp, -16
552 ; LA32-NEXT: .cfi_def_cfa_offset 16
553 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
554 ; LA32-NEXT: .cfi_offset 1, -4
555 ; LA32-NEXT: ori $a3, $zero, 3
556 ; LA32-NEXT: bl %plt(__atomic_store_8)
557 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
558 ; LA32-NEXT: addi.w $sp, $sp, 16
561 ; LA64-LABEL: store_release_i64:
563 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
565 store atomic i64 %v, ptr %ptr release, align 8
569 define void @store_release_ptr(ptr %ptr, ptr %v) {
570 ; LA32-LABEL: store_release_ptr:
573 ; LA32-NEXT: st.w $a1, $a0, 0
576 ; LA64-LABEL: store_release_ptr:
578 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
580 store atomic ptr %v, ptr %ptr release, align 8
584 define void @store_release_float(ptr %ptr, float %v) {
585 ; LA32-LABEL: store_release_float:
587 ; LA32-NEXT: movfr2gr.s $a1, $fa0
589 ; LA32-NEXT: st.w $a1, $a0, 0
592 ; LA64-LABEL: store_release_float:
594 ; LA64-NEXT: movfr2gr.s $a1, $fa0
595 ; LA64-NEXT: amswap_db.w $zero, $a1, $a0
597 store atomic float %v, ptr %ptr release, align 8
601 define void @store_release_double(ptr %ptr, double %v) {
602 ; LA32-LABEL: store_release_double:
604 ; LA32-NEXT: addi.w $sp, $sp, -16
605 ; LA32-NEXT: .cfi_def_cfa_offset 16
606 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
607 ; LA32-NEXT: .cfi_offset 1, -4
608 ; LA32-NEXT: fst.d $fa0, $sp, 0
609 ; LA32-NEXT: ld.w $a1, $sp, 0
610 ; LA32-NEXT: ld.w $a2, $sp, 4
611 ; LA32-NEXT: ori $a3, $zero, 3
612 ; LA32-NEXT: bl %plt(__atomic_store_8)
613 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
614 ; LA32-NEXT: addi.w $sp, $sp, 16
617 ; LA64-LABEL: store_release_double:
619 ; LA64-NEXT: movfr2gr.d $a1, $fa0
620 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
622 store atomic double %v, ptr %ptr release, align 8
626 define void @store_unordered_i8(ptr %ptr, i8 signext %v) {
627 ; LA32-LABEL: store_unordered_i8:
629 ; LA32-NEXT: st.b $a1, $a0, 0
632 ; LA64-LABEL: store_unordered_i8:
634 ; LA64-NEXT: st.b $a1, $a0, 0
636 store atomic i8 %v, ptr %ptr unordered, align 1
640 define void @store_unordered_i16(ptr %ptr, i16 signext %v) {
641 ; LA32-LABEL: store_unordered_i16:
643 ; LA32-NEXT: st.h $a1, $a0, 0
646 ; LA64-LABEL: store_unordered_i16:
648 ; LA64-NEXT: st.h $a1, $a0, 0
650 store atomic i16 %v, ptr %ptr unordered, align 2
654 define void @store_unordered_i32(ptr %ptr, i32 signext %v) {
655 ; LA32-LABEL: store_unordered_i32:
657 ; LA32-NEXT: st.w $a1, $a0, 0
660 ; LA64-LABEL: store_unordered_i32:
662 ; LA64-NEXT: st.w $a1, $a0, 0
664 store atomic i32 %v, ptr %ptr unordered, align 4
668 define void @store_unordered_i64(ptr %ptr, i64 %v) {
669 ; LA32-LABEL: store_unordered_i64:
671 ; LA32-NEXT: addi.w $sp, $sp, -16
672 ; LA32-NEXT: .cfi_def_cfa_offset 16
673 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
674 ; LA32-NEXT: .cfi_offset 1, -4
675 ; LA32-NEXT: move $a3, $zero
676 ; LA32-NEXT: bl %plt(__atomic_store_8)
677 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
678 ; LA32-NEXT: addi.w $sp, $sp, 16
681 ; LA64-LABEL: store_unordered_i64:
683 ; LA64-NEXT: st.d $a1, $a0, 0
685 store atomic i64 %v, ptr %ptr unordered, align 8
689 define void @store_unordered_ptr(ptr %ptr, ptr %v) {
690 ; LA32-LABEL: store_unordered_ptr:
692 ; LA32-NEXT: st.w $a1, $a0, 0
695 ; LA64-LABEL: store_unordered_ptr:
697 ; LA64-NEXT: st.d $a1, $a0, 0
699 store atomic ptr %v, ptr %ptr unordered, align 8
703 define void @store_unordered_float(ptr %ptr, float %v) {
704 ; LA32-LABEL: store_unordered_float:
706 ; LA32-NEXT: movfr2gr.s $a1, $fa0
707 ; LA32-NEXT: st.w $a1, $a0, 0
710 ; LA64-LABEL: store_unordered_float:
712 ; LA64-NEXT: movfr2gr.s $a1, $fa0
713 ; LA64-NEXT: st.w $a1, $a0, 0
715 store atomic float %v, ptr %ptr unordered, align 8
719 define void @store_unordered_double(ptr %ptr, double %v) {
720 ; LA32-LABEL: store_unordered_double:
722 ; LA32-NEXT: addi.w $sp, $sp, -16
723 ; LA32-NEXT: .cfi_def_cfa_offset 16
724 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
725 ; LA32-NEXT: .cfi_offset 1, -4
726 ; LA32-NEXT: fst.d $fa0, $sp, 0
727 ; LA32-NEXT: ld.w $a1, $sp, 0
728 ; LA32-NEXT: ld.w $a2, $sp, 4
729 ; LA32-NEXT: move $a3, $zero
730 ; LA32-NEXT: bl %plt(__atomic_store_8)
731 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
732 ; LA32-NEXT: addi.w $sp, $sp, 16
735 ; LA64-LABEL: store_unordered_double:
737 ; LA64-NEXT: movfr2gr.d $a1, $fa0
738 ; LA64-NEXT: st.d $a1, $a0, 0
740 store atomic double %v, ptr %ptr unordered, align 8
744 define void @store_monotonic_i8(ptr %ptr, i8 signext %v) {
745 ; LA32-LABEL: store_monotonic_i8:
747 ; LA32-NEXT: st.b $a1, $a0, 0
750 ; LA64-LABEL: store_monotonic_i8:
752 ; LA64-NEXT: st.b $a1, $a0, 0
754 store atomic i8 %v, ptr %ptr monotonic, align 1
758 define void @store_monotonic_i16(ptr %ptr, i16 signext %v) {
759 ; LA32-LABEL: store_monotonic_i16:
761 ; LA32-NEXT: st.h $a1, $a0, 0
764 ; LA64-LABEL: store_monotonic_i16:
766 ; LA64-NEXT: st.h $a1, $a0, 0
768 store atomic i16 %v, ptr %ptr monotonic, align 2
772 define void @store_monotonic_i32(ptr %ptr, i32 signext %v) {
773 ; LA32-LABEL: store_monotonic_i32:
775 ; LA32-NEXT: st.w $a1, $a0, 0
778 ; LA64-LABEL: store_monotonic_i32:
780 ; LA64-NEXT: st.w $a1, $a0, 0
782 store atomic i32 %v, ptr %ptr monotonic, align 4
786 define void @store_monotonic_i64(ptr %ptr, i64 %v) {
787 ; LA32-LABEL: store_monotonic_i64:
789 ; LA32-NEXT: addi.w $sp, $sp, -16
790 ; LA32-NEXT: .cfi_def_cfa_offset 16
791 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
792 ; LA32-NEXT: .cfi_offset 1, -4
793 ; LA32-NEXT: move $a3, $zero
794 ; LA32-NEXT: bl %plt(__atomic_store_8)
795 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
796 ; LA32-NEXT: addi.w $sp, $sp, 16
799 ; LA64-LABEL: store_monotonic_i64:
801 ; LA64-NEXT: st.d $a1, $a0, 0
803 store atomic i64 %v, ptr %ptr monotonic, align 8
807 define void @store_monotonic_ptr(ptr %ptr, ptr %v) {
808 ; LA32-LABEL: store_monotonic_ptr:
810 ; LA32-NEXT: st.w $a1, $a0, 0
813 ; LA64-LABEL: store_monotonic_ptr:
815 ; LA64-NEXT: st.d $a1, $a0, 0
817 store atomic ptr %v, ptr %ptr monotonic, align 8
821 define void @store_monotonic_float(ptr %ptr, float %v) {
822 ; LA32-LABEL: store_monotonic_float:
824 ; LA32-NEXT: movfr2gr.s $a1, $fa0
825 ; LA32-NEXT: st.w $a1, $a0, 0
828 ; LA64-LABEL: store_monotonic_float:
830 ; LA64-NEXT: movfr2gr.s $a1, $fa0
831 ; LA64-NEXT: st.w $a1, $a0, 0
833 store atomic float %v, ptr %ptr monotonic, align 8
837 define void @store_monotonic_double(ptr %ptr, double %v) {
838 ; LA32-LABEL: store_monotonic_double:
840 ; LA32-NEXT: addi.w $sp, $sp, -16
841 ; LA32-NEXT: .cfi_def_cfa_offset 16
842 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
843 ; LA32-NEXT: .cfi_offset 1, -4
844 ; LA32-NEXT: fst.d $fa0, $sp, 0
845 ; LA32-NEXT: ld.w $a1, $sp, 0
846 ; LA32-NEXT: ld.w $a2, $sp, 4
847 ; LA32-NEXT: move $a3, $zero
848 ; LA32-NEXT: bl %plt(__atomic_store_8)
849 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
850 ; LA32-NEXT: addi.w $sp, $sp, 16
853 ; LA64-LABEL: store_monotonic_double:
855 ; LA64-NEXT: movfr2gr.d $a1, $fa0
856 ; LA64-NEXT: st.d $a1, $a0, 0
858 store atomic double %v, ptr %ptr monotonic, align 8
862 define void @store_seq_cst_i8(ptr %ptr, i8 signext %v) {
863 ; LA32-LABEL: store_seq_cst_i8:
866 ; LA32-NEXT: st.b $a1, $a0, 0
870 ; LA64-LABEL: store_seq_cst_i8:
873 ; LA64-NEXT: st.b $a1, $a0, 0
876 store atomic i8 %v, ptr %ptr seq_cst, align 1
880 define void @store_seq_cst_i16(ptr %ptr, i16 signext %v) {
881 ; LA32-LABEL: store_seq_cst_i16:
884 ; LA32-NEXT: st.h $a1, $a0, 0
888 ; LA64-LABEL: store_seq_cst_i16:
891 ; LA64-NEXT: st.h $a1, $a0, 0
894 store atomic i16 %v, ptr %ptr seq_cst, align 2
898 define void @store_seq_cst_i32(ptr %ptr, i32 signext %v) {
899 ; LA32-LABEL: store_seq_cst_i32:
902 ; LA32-NEXT: st.w $a1, $a0, 0
906 ; LA64-LABEL: store_seq_cst_i32:
908 ; LA64-NEXT: amswap_db.w $zero, $a1, $a0
910 store atomic i32 %v, ptr %ptr seq_cst, align 4
914 define void @store_seq_cst_i64(ptr %ptr, i64 %v) {
915 ; LA32-LABEL: store_seq_cst_i64:
917 ; LA32-NEXT: addi.w $sp, $sp, -16
918 ; LA32-NEXT: .cfi_def_cfa_offset 16
919 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
920 ; LA32-NEXT: .cfi_offset 1, -4
921 ; LA32-NEXT: ori $a3, $zero, 5
922 ; LA32-NEXT: bl %plt(__atomic_store_8)
923 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
924 ; LA32-NEXT: addi.w $sp, $sp, 16
927 ; LA64-LABEL: store_seq_cst_i64:
929 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
931 store atomic i64 %v, ptr %ptr seq_cst, align 8
935 define void @store_seq_cst_ptr(ptr %ptr, ptr %v) {
936 ; LA32-LABEL: store_seq_cst_ptr:
939 ; LA32-NEXT: st.w $a1, $a0, 0
943 ; LA64-LABEL: store_seq_cst_ptr:
945 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
947 store atomic ptr %v, ptr %ptr seq_cst, align 8
951 define void @store_seq_cst_float(ptr %ptr, float %v) {
952 ; LA32-LABEL: store_seq_cst_float:
954 ; LA32-NEXT: movfr2gr.s $a1, $fa0
956 ; LA32-NEXT: st.w $a1, $a0, 0
960 ; LA64-LABEL: store_seq_cst_float:
962 ; LA64-NEXT: movfr2gr.s $a1, $fa0
963 ; LA64-NEXT: amswap_db.w $zero, $a1, $a0
965 store atomic float %v, ptr %ptr seq_cst, align 8
969 define void @store_seq_cst_double(ptr %ptr, double %v) {
970 ; LA32-LABEL: store_seq_cst_double:
972 ; LA32-NEXT: addi.w $sp, $sp, -16
973 ; LA32-NEXT: .cfi_def_cfa_offset 16
974 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
975 ; LA32-NEXT: .cfi_offset 1, -4
976 ; LA32-NEXT: fst.d $fa0, $sp, 0
977 ; LA32-NEXT: ld.w $a1, $sp, 0
978 ; LA32-NEXT: ld.w $a2, $sp, 4
979 ; LA32-NEXT: ori $a3, $zero, 5
980 ; LA32-NEXT: bl %plt(__atomic_store_8)
981 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
982 ; LA32-NEXT: addi.w $sp, $sp, 16
985 ; LA64-LABEL: store_seq_cst_double:
987 ; LA64-NEXT: movfr2gr.d $a1, $fa0
988 ; LA64-NEXT: amswap_db.d $zero, $a1, $a0
990 store atomic double %v, ptr %ptr seq_cst, align 8