2009-09-09 02:09:15 +02:00
|
|
|
; RUN: llc < %s -march=ppc64 | grep ldarx | count 3
|
|
|
|
; RUN: llc < %s -march=ppc64 | grep stdcx. | count 4
|
2008-04-19 04:30:38 +02:00
|
|
|
|
|
|
|
define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind {
|
2008-06-25 10:15:39 +02:00
|
|
|
%tmp = call i64 @llvm.atomic.load.add.i64( i64* %mem, i64 %val )
|
2008-04-19 04:30:38 +02:00
|
|
|
ret i64 %tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @exchange_and_cmp(i64* %mem) nounwind {
|
2008-06-25 10:15:39 +02:00
|
|
|
%tmp = call i64 @llvm.atomic.cmp.swap.i64( i64* %mem, i64 0, i64 1 )
|
2008-04-19 04:30:38 +02:00
|
|
|
ret i64 %tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @exchange(i64* %mem, i64 %val) nounwind {
|
|
|
|
%tmp = call i64 @llvm.atomic.swap.i64( i64* %mem, i64 1 )
|
|
|
|
ret i64 %tmp
|
|
|
|
}
|
|
|
|
|
2008-06-25 10:15:39 +02:00
|
|
|
declare i64 @llvm.atomic.load.add.i64(i64*, i64) nounwind
|
|
|
|
declare i64 @llvm.atomic.cmp.swap.i64(i64*, i64, i64) nounwind
|
2008-04-19 04:30:38 +02:00
|
|
|
declare i64 @llvm.atomic.swap.i64(i64*, i64) nounwind
|