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 %tmppair = cmpxchg i64* %mem, i64 0, i64 1 monotonic monotonic 15 %tmp = extractvalue { i64, i1 } %tmppair, 0 16 ; CHECK: stdcx. 17 ; CHECK: stdcx. 18 ret i64 %tmp 19 } 20 21 define i64 @exchange(i64* %mem, i64 %val) nounwind { 22 ; CHECK-LABEL: exchange: 23 ; CHECK: ldarx 24 %tmp = atomicrmw xchg i64* %mem, i64 1 monotonic 25 ; CHECK: stdcx. 26 ret i64 %tmp 27 } 28 29 define void @atomic_store(i64* %mem, i64 %val) nounwind { 30 entry: 31 ; CHECK: @atomic_store 32 store atomic i64 %val, i64* %mem release, align 64 33 ; CHECK: ldarx 34 ; CHECK: stdcx. 35 ret void 36 } 37 38 define i64 @atomic_load(i64* %mem) nounwind { 39 entry: 40 ; CHECK: @atomic_load 41 %tmp = load atomic i64* %mem acquire, align 64 42 ; CHECK: ldarx 43 ; CHECK: stdcx. 44 ; CHECK: stdcx. 45 ret i64 %tmp 46 } 47 48