2013-03-27 13:20:52 +00:00
|
|
|
; RUN: llc < %s -mtriple=powerpc-apple-darwin -march=ppc32 | FileCheck %s
|
2008-04-19 02:30:38 +00:00
|
|
|
|
2011-06-18 06:05:24 +00:00
|
|
|
define i32 @exchange_and_add(i32* %mem, i32 %val) nounwind {
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: exchange_and_add:
|
2013-03-27 13:20:52 +00:00
|
|
|
; CHECK: lwarx {{r[0-9]+}}, 0, {{r[0-9]+}}
|
2011-09-26 21:30:17 +00:00
|
|
|
%tmp = atomicrmw add i32* %mem, i32 %val monotonic
|
2013-03-27 13:20:52 +00:00
|
|
|
; CHECK: stwcx. {{r[0-9]+}}, 0, {{r[0-9]+}}
|
2011-06-18 06:05:24 +00:00
|
|
|
ret i32 %tmp
|
2008-04-19 02:30:38 +00:00
|
|
|
}
|
|
|
|
|
2011-06-18 06:05:24 +00:00
|
|
|
define i32 @exchange_and_cmp(i32* %mem) nounwind {
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: exchange_and_cmp:
|
|
|
|
; CHECK: lwarx
|
2011-09-26 21:30:17 +00:00
|
|
|
%tmp = cmpxchg i32* %mem, i32 0, i32 1 monotonic
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: stwcx.
|
|
|
|
; CHECK: stwcx.
|
2011-06-18 06:05:24 +00:00
|
|
|
ret i32 %tmp
|
2008-04-19 02:30:38 +00:00
|
|
|
}
|
|
|
|
|
2011-06-18 06:05:24 +00:00
|
|
|
define i32 @exchange(i32* %mem, i32 %val) nounwind {
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: exchange:
|
|
|
|
; CHECK: lwarx
|
2011-09-26 21:30:17 +00:00
|
|
|
%tmp = atomicrmw xchg i32* %mem, i32 1 monotonic
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: stwcx.
|
2011-06-18 06:05:24 +00:00
|
|
|
ret i32 %tmp
|
2008-04-19 02:30:38 +00:00
|
|
|
}
|