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 = atomicrmw add i32* %mem, i32 %val monotonic 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 = cmpxchg i32* %mem, i32 0, i32 1 monotonic 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 = atomicrmw xchg i32* %mem, i32 1 monotonic 24 ; CHECK: stwcx. 25 ret i32 %tmp 26 } 27