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