1 ; RUN: llc < %s -march=sparcv9 -verify-machineinstrs | FileCheck %s
3 ; CHECK-LABEL: test_atomic_i32
9 ; CHECK: st {{.+}}, [%o2]
10 define i32 @test_atomic_i32(i32* %ptr1, i32* %ptr2, i32* %ptr3) {
12 %0 = load atomic i32* %ptr1 acquire, align 8
13 %1 = load atomic i32* %ptr2 acquire, align 8
15 store atomic i32 %2, i32* %ptr3 release, align 8
19 ; CHECK-LABEL: test_atomic_i64
25 ; CHECK: stx {{.+}}, [%o2]
26 define i64 @test_atomic_i64(i64* %ptr1, i64* %ptr2, i64* %ptr3) {
28 %0 = load atomic i64* %ptr1 acquire, align 8
29 %1 = load atomic i64* %ptr2 acquire, align 8
31 store atomic i64 %2, i64* %ptr3 release, align 8
35 ; CHECK-LABEL: test_cmpxchg_i32
36 ; CHECK: or %g0, 123, [[R:%[gilo][0-7]]]
37 ; CHECK: cas [%o1], %o0, [[R]]
39 define i32 @test_cmpxchg_i32(i32 %a, i32* %ptr) {
41 %b = cmpxchg i32* %ptr, i32 %a, i32 123 monotonic monotonic
45 ; CHECK-LABEL: test_cmpxchg_i64
46 ; CHECK: or %g0, 123, [[R:%[gilo][0-7]]]
47 ; CHECK: casx [%o1], %o0, [[R]]
49 define i64 @test_cmpxchg_i64(i64 %a, i64* %ptr) {
51 %b = cmpxchg i64* %ptr, i64 %a, i64 123 monotonic monotonic
55 ; CHECK-LABEL: test_swap_i32
56 ; CHECK: or %g0, 42, [[R:%[gilo][0-7]]]
57 ; CHECK: swap [%o1], [[R]]
59 define i32 @test_swap_i32(i32 %a, i32* %ptr) {
61 %b = atomicrmw xchg i32* %ptr, i32 42 monotonic
65 ; CHECK-LABEL: test_swap_i64
68 define i64 @test_swap_i64(i64 %a, i64* %ptr) {
70 %b = atomicrmw xchg i64* %ptr, i64 42 monotonic
74 ; CHECK-LABEL: test_load_add_32
76 ; CHECK: add [[V:%[gilo][0-7]]], %o1, [[U:%[gilo][0-7]]]
77 ; CHECK: cas [%o0], [[V]], [[U]]
79 define zeroext i32 @test_load_add_32(i32* %p, i32 zeroext %v) {
81 %0 = atomicrmw add i32* %p, i32 %v seq_cst
85 ; CHECK-LABEL: test_load_sub_64
90 define zeroext i64 @test_load_sub_64(i64* %p, i64 zeroext %v) {
92 %0 = atomicrmw sub i64* %p, i64 %v seq_cst
96 ; CHECK-LABEL: test_load_xor_32
101 define zeroext i32 @test_load_xor_32(i32* %p, i32 zeroext %v) {
103 %0 = atomicrmw xor i32* %p, i32 %v seq_cst
107 ; CHECK-LABEL: test_load_and_32
113 define zeroext i32 @test_load_and_32(i32* %p, i32 zeroext %v) {
115 %0 = atomicrmw and i32* %p, i32 %v seq_cst
119 ; CHECK-LABEL: test_load_nand_32
125 define zeroext i32 @test_load_nand_32(i32* %p, i32 zeroext %v) {
127 %0 = atomicrmw nand i32* %p, i32 %v seq_cst
131 ; CHECK-LABEL: test_load_max_64
137 define zeroext i64 @test_load_max_64(i64* %p, i64 zeroext %v) {
139 %0 = atomicrmw max i64* %p, i64 %v seq_cst
143 ; CHECK-LABEL: test_load_umin_32
149 define zeroext i32 @test_load_umin_32(i32* %p, i32 zeroext %v) {
151 %0 = atomicrmw umin i32* %p, i32 %v seq_cst