2011-07-19 05:23:42 +08:00
|
|
|
; RUN: llc < %s -march=ppc64 | FileCheck %s
|
2008-04-19 10:30:38 +08:00
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: exchange_and_add:
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: ldarx
|
2011-09-27 05:30:17 +08:00
|
|
|
%tmp = atomicrmw add i64* %mem, i64 %val monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stdcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i64 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i64 @exchange_and_cmp(i64* %mem) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: exchange_and_cmp:
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: ldarx
|
2014-03-11 18:48:52 +08:00
|
|
|
%tmp = cmpxchg i64* %mem, i64 0, i64 1 monotonic monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stdcx.
|
|
|
|
; CHECK: stdcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i64 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|
|
|
|
|
2011-06-18 14:05:24 +08:00
|
|
|
define i64 @exchange(i64* %mem, i64 %val) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: exchange:
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: ldarx
|
2011-09-27 05:30:17 +08:00
|
|
|
%tmp = atomicrmw xchg i64* %mem, i64 1 monotonic
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: stdcx.
|
2011-06-18 14:05:24 +08:00
|
|
|
ret i64 %tmp
|
2008-04-19 10:30:38 +08:00
|
|
|
}
|
2012-12-26 01:22:53 +08: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
|
|
|
|
}
|
|
|
|
|