1 ; RUN: llc < %s -march=ppc64 | FileCheck %s 2 3 define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind { 4 ; CHECK-LABEL: exchange_and_add: 5 ; CHECK: ldarx 6 %tmp = atomicrmw add i64* %mem, i64 %val monotonic 7 ; CHECK: stdcx. 8 ret i64 %tmp 9 } 10 11 define i64 @exchange_and_cmp(i64* %mem) nounwind { 12 ; CHECK-LABEL: exchange_and_cmp: 13 ; CHECK: ldarx 14 %tmp = cmpxchg i64* %mem, i64 0, i64 1 monotonic 15 ; CHECK: stdcx. 16 ; CHECK: stdcx. 17 ret i64 %tmp 18 } 19 20 define i64 @exchange(i64* %mem, i64 %val) nounwind { 21 ; CHECK-LABEL: exchange: 22 ; CHECK: ldarx 23 %tmp = atomicrmw xchg i64* %mem, i64 1 monotonic 24 ; CHECK: stdcx. 25 ret i64 %tmp 26 } 27 28 define void @atomic_store(i64* %mem, i64 %val) nounwind { 29 entry: 30 ; CHECK: @atomic_store 31 store atomic i64 %val, i64* %mem release, align 64 32 ; CHECK: ldarx 33 ; CHECK: stdcx. 34 ret void 35 } 36 37 define i64 @atomic_load(i64* %mem) nounwind { 38 entry: 39 ; CHECK: @atomic_load 40 %tmp = load atomic i64* %mem acquire, align 64 41 ; CHECK: ldarx 42 ; CHECK: stdcx. 43 ; CHECK: stdcx. 44 ret i64 %tmp 45 } 46 47