1 ; RUN: llc < %s -march=ppc64 | FileCheck %s 2 3 define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind { 4 ; CHECK: exchange_and_add: 5 ; CHECK: ldarx 6 %tmp = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %mem, i64 %val) 7 ; CHECK: stdcx. 8 ret i64 %tmp 9 } 10 11 define i64 @exchange_and_cmp(i64* %mem) nounwind { 12 ; CHECK: exchange_and_cmp: 13 ; CHECK: ldarx 14 %tmp = call i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* %mem, i64 0, i64 1) 15 ; CHECK: stdcx. 16 ; CHECK: stdcx. 17 ret i64 %tmp 18 } 19 20 define i64 @exchange(i64* %mem, i64 %val) nounwind { 21 ; CHECK: exchange: 22 ; CHECK: ldarx 23 %tmp = call i64 @llvm.atomic.swap.i64.p0i64(i64* %mem, i64 1) 24 ; CHECK: stdcx. 25 ret i64 %tmp 26 } 27 28 declare i64 @llvm.atomic.load.add.i64.p0i64(i64* nocapture, i64) nounwind 29 30 declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* nocapture, i64, i64) nounwind 31 32 declare i64 @llvm.atomic.swap.i64.p0i64(i64* nocapture, i64) nounwind 33