2011-07-18 21:23:42 +00:00
|
|
|
; RUN: llc < %s -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:
|
|
|
|
; CHECK: lwarx
|
2011-06-18 06:05:24 +00:00
|
|
|
%tmp = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %mem, i32 %val)
|
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
|
|
|
}
|
|
|
|
|
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-06-18 06:05:24 +00:00
|
|
|
%tmp = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %mem, i32 0, i32 1)
|
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-06-18 06:05:24 +00:00
|
|
|
%tmp = call i32 @llvm.atomic.swap.i32.p0i32(i32* %mem, i32 1)
|
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
|
|
|
}
|
|
|
|
|
2011-06-18 06:05:24 +00:00
|
|
|
declare i32 @llvm.atomic.load.add.i32.p0i32(i32* nocapture, i32) nounwind
|
|
|
|
|
|
|
|
declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* nocapture, i32, i32) nounwind
|
|
|
|
|
|
|
|
declare i32 @llvm.atomic.swap.i32.p0i32(i32* nocapture, i32) nounwind
|