2012-04-24 17:15:38 +08:00
|
|
|
; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s
|
2009-02-04 13:16:46 +08:00
|
|
|
|
|
|
|
@flag0 = internal global i32 zeroinitializer
|
|
|
|
@turn = internal global i32 zeroinitializer
|
|
|
|
|
2012-04-24 17:15:38 +08:00
|
|
|
; CHECK: ret i32 0
|
2009-02-04 13:16:46 +08:00
|
|
|
|
|
|
|
define i32 @main() {
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i32, i32* @flag0
|
2011-09-27 04:15:28 +08:00
|
|
|
%b = atomicrmw xchg i32* @turn, i32 1 monotonic
|
2015-02-28 05:17:42 +08:00
|
|
|
%c = load i32, i32* @flag0
|
2009-10-14 01:39:29 +08:00
|
|
|
%d = sub i32 %a, %c
|
|
|
|
ret i32 %d
|
2009-02-04 13:16:46 +08:00
|
|
|
}
|