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 {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: exchange_and_add:
|
2011-07-18 21:23:42 +00:00
|
|
|
; 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 {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: exchange_and_cmp:
|
2011-07-18 21:23:42 +00:00
|
|
|
; CHECK: ldarx
|
2014-03-11 10:48:52 +00:00
|
|
|
%tmp = cmpxchg i64* %mem, i64 0, i64 1 monotonic 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 {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: exchange:
|
2011-07-18 21:23:42 +00:00
|
|
|
; 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
|
|
|
}
|
2012-12-25 17:22:53 +00:00
|
|
|
|
|
|
|
define void @atomic_store(i64* %mem, i64 %val) nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK: @atomic_store
|
|
|
|
store atomic i64 %val, i64* %mem release, align 64
|
|
|
|
; CHECK: ldarx
|
|
|
|
; CHECK: stdcx.
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @atomic_load(i64* %mem) nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK: @atomic_load
|
|
|
|
%tmp = load atomic i64* %mem acquire, align 64
|
|
|
|
; CHECK: ldarx
|
|
|
|
; CHECK: stdcx.
|
|
|
|
; CHECK: stdcx.
|
|
|
|
ret i64 %tmp
|
|
|
|
}
|
|
|
|
|