1; RUN: opt < %s | opt -S | FileCheck %s 2; RUN: verify-uselistorder %s 3; Basic smoke test for atomic operations. 4 5define void @f(i32* %x) { 6 ; CHECK: load atomic i32, i32* %x unordered, align 4 7 load atomic i32, i32* %x unordered, align 4 8 ; CHECK: load atomic volatile i32, i32* %x syncscope("singlethread") acquire, align 4 9 load atomic volatile i32, i32* %x syncscope("singlethread") acquire, align 4 10 ; CHECK: load atomic volatile i32, i32* %x syncscope("agent") acquire, align 4 11 load atomic volatile i32, i32* %x syncscope("agent") acquire, align 4 12 ; CHECK: store atomic i32 3, i32* %x release, align 4 13 store atomic i32 3, i32* %x release, align 4 14 ; CHECK: store atomic volatile i32 3, i32* %x syncscope("singlethread") monotonic, align 4 15 store atomic volatile i32 3, i32* %x syncscope("singlethread") monotonic, align 4 16 ; CHECK: store atomic volatile i32 3, i32* %x syncscope("workgroup") monotonic, align 4 17 store atomic volatile i32 3, i32* %x syncscope("workgroup") monotonic, align 4 18 ; CHECK: cmpxchg i32* %x, i32 1, i32 0 syncscope("singlethread") monotonic monotonic 19 cmpxchg i32* %x, i32 1, i32 0 syncscope("singlethread") monotonic monotonic 20 ; CHECK: cmpxchg i32* %x, i32 1, i32 0 syncscope("workitem") monotonic monotonic 21 cmpxchg i32* %x, i32 1, i32 0 syncscope("workitem") monotonic monotonic 22 ; CHECK: cmpxchg volatile i32* %x, i32 0, i32 1 acq_rel acquire 23 cmpxchg volatile i32* %x, i32 0, i32 1 acq_rel acquire 24 ; CHECK: cmpxchg i32* %x, i32 42, i32 0 acq_rel monotonic 25 cmpxchg i32* %x, i32 42, i32 0 acq_rel monotonic 26 ; CHECK: cmpxchg weak i32* %x, i32 13, i32 0 seq_cst monotonic 27 cmpxchg weak i32* %x, i32 13, i32 0 seq_cst monotonic 28 ; CHECK: atomicrmw add i32* %x, i32 10 seq_cst 29 atomicrmw add i32* %x, i32 10 seq_cst 30 ; CHECK: atomicrmw volatile xchg i32* %x, i32 10 monotonic 31 atomicrmw volatile xchg i32* %x, i32 10 monotonic 32 ; CHECK: atomicrmw volatile xchg i32* %x, i32 10 syncscope("agent") monotonic 33 atomicrmw volatile xchg i32* %x, i32 10 syncscope("agent") monotonic 34 ; CHECK: fence syncscope("singlethread") release 35 fence syncscope("singlethread") release 36 ; CHECK: fence seq_cst 37 fence seq_cst 38 ; CHECK: fence syncscope("device") seq_cst 39 fence syncscope("device") seq_cst 40 ret void 41} 42 43define void @fp_atomics(float* %x) { 44 ; CHECK: atomicrmw fadd float* %x, float 1.000000e+00 seq_cst 45 atomicrmw fadd float* %x, float 1.0 seq_cst 46 47 ; CHECK: atomicrmw volatile fadd float* %x, float 1.000000e+00 seq_cst 48 atomicrmw volatile fadd float* %x, float 1.0 seq_cst 49 50 ret void 51} 52