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