2009-10-13 19:39:29 +02:00
|
|
|
; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0}
|
2009-02-04 06:16:46 +01:00
|
|
|
|
|
|
|
@flag0 = internal global i32 zeroinitializer
|
|
|
|
@turn = internal global i32 zeroinitializer
|
|
|
|
|
|
|
|
|
|
|
|
define i32 @main() {
|
|
|
|
%a = load i32* @flag0
|
2009-10-13 19:39:29 +02:00
|
|
|
%b = tail call i32 @llvm.atomic.swap.i32.p0i32(i32* @turn, i32 1)
|
2009-02-04 06:16:46 +01:00
|
|
|
%c = load i32* @flag0
|
2009-10-13 19:39:29 +02:00
|
|
|
%d = sub i32 %a, %c
|
|
|
|
ret i32 %d
|
2009-02-04 06:16:46 +01:00
|
|
|
}
|
|
|
|
|
2010-04-08 00:53:17 +02:00
|
|
|
declare i32 @llvm.atomic.swap.i32.p0i32(i32*, i32) nounwind
|