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