1; RUN: llc < %s -march=ppc64 | FileCheck %s 2 3define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind { 4; CHECK: exchange_and_add: 5; CHECK: ldarx 6 %tmp = atomicrmw add i64* %mem, i64 %val monotonic 7; CHECK: stdcx. 8 ret i64 %tmp 9} 10 11define i64 @exchange_and_cmp(i64* %mem) nounwind { 12; CHECK: 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 20define i64 @exchange(i64* %mem, i64 %val) nounwind { 21; CHECK: exchange: 22; CHECK: ldarx 23 %tmp = atomicrmw xchg i64* %mem, i64 1 monotonic 24; CHECK: stdcx. 25 ret i64 %tmp 26} 27 28define void @atomic_store(i64* %mem, i64 %val) nounwind { 29entry: 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 37define i64 @atomic_load(i64* %mem) nounwind { 38entry: 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