2011-07-19 05:23:42 +08:00
|
|
|
; RUN: llc < %s -march=ppc32 | FileCheck %s
|
2008-04-19 10:30:38 +08:00
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i32 @exchange_and_add(i32* %mem, i32 %val) nounwind {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange_and_add:
|
|
|
|
; CHECK: lwarx
|
2011-09-27 05:30:17 +08:00
|
|
|
%tmp = atomicrmw add i32* %mem, i32 %val monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stwcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i32 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i32 @exchange_and_cmp(i32* %mem) nounwind {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange_and_cmp:
|
|
|
|
; CHECK: lwarx
|
2011-09-27 05:30:17 +08:00
|
|
|
%tmp = cmpxchg i32* %mem, i32 0, i32 1 monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stwcx.
|
|
|
|
; CHECK: stwcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i32 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i32 @exchange(i32* %mem, i32 %val) nounwind {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange:
|
|
|
|
; CHECK: lwarx
|
2011-09-27 05:30:17 +08:00
|
|
|
%tmp = atomicrmw xchg i32* %mem, i32 1 monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stwcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i32 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|