2010-08-03 16:19:16 +00:00
|
|
|
; RUN: opt < %s -loweratomic -S | FileCheck %s
|
|
|
|
|
|
|
|
define i8 @cmpswap() {
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @cmpswap(
|
2010-08-03 16:19:16 +00:00
|
|
|
%i = alloca i8
|
2014-03-11 10:48:52 +00:00
|
|
|
%j = cmpxchg i8* %i, i8 0, i8 42 monotonic monotonic
|
2010-08-03 16:19:16 +00:00
|
|
|
; CHECK: [[INST:%[a-z0-9]+]] = load
|
|
|
|
; CHECK-NEXT: icmp
|
|
|
|
; CHECK-NEXT: select
|
|
|
|
; CHECK-NEXT: store
|
|
|
|
ret i8 %j
|
|
|
|
; CHECK: ret i8 [[INST]]
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 @swap() {
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @swap(
|
2010-08-03 16:19:16 +00:00
|
|
|
%i = alloca i8
|
2011-09-26 20:15:56 +00:00
|
|
|
%j = atomicrmw xchg i8* %i, i8 42 monotonic
|
2010-08-03 16:19:16 +00:00
|
|
|
; CHECK: [[INST:%[a-z0-9]+]] = load
|
|
|
|
; CHECK-NEXT: store
|
|
|
|
ret i8 %j
|
|
|
|
; CHECK: ret i8 [[INST]]
|
|
|
|
}
|