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 {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange_and_add:
|
|
|
|
; CHECK: ldarx
|
2011-06-18 14:05:24 +08:00
|
|
|
%tmp = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %mem, i64 %val)
|
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 {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange_and_cmp:
|
|
|
|
; CHECK: ldarx
|
2011-06-18 14:05:24 +08:00
|
|
|
%tmp = call i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* %mem, i64 0, i64 1)
|
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 {
|
2011-07-19 05:23:42 +08:00
|
|
|
; CHECK: exchange:
|
|
|
|
; CHECK: ldarx
|
2011-06-18 14:05:24 +08:00
|
|
|
%tmp = call i64 @llvm.atomic.swap.i64.p0i64(i64* %mem, i64 1)
|
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
|
|
|
declare i64 @llvm.atomic.load.add.i64.p0i64(i64* nocapture, i64) nounwind
|
|
|
|
|
|
|
|
declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* nocapture, i64, i64) nounwind
|
|
|
|
|
|
|
|
declare i64 @llvm.atomic.swap.i64.p0i64(i64* nocapture, i64) nounwind
|