1 ; RUN: opt < %s -loweratomic -S | FileCheck %s 2 3 declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* %ptr, i8 %cmp, i8 %val) 4 declare i8 @llvm.atomic.swap.i8.p0i8(i8* %ptr, i8 %val) 5 6 define i8 @cmpswap() { 7 ; CHECK: @cmpswap 8 %i = alloca i8 9 %j = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* %i, i8 0, i8 42) 10 ; CHECK: [[INST:%[a-z0-9]+]] = load 11 ; CHECK-NEXT: icmp 12 ; CHECK-NEXT: select 13 ; CHECK-NEXT: store 14 ret i8 %j 15 ; CHECK: ret i8 [[INST]] 16 } 17 18 define i8 @swap() { 19 ; CHECK: @swap 20 %i = alloca i8 21 %j = call i8 @llvm.atomic.swap.i8.p0i8(i8* %i, i8 42) 22 ; CHECK: [[INST:%[a-z0-9]+]] = load 23 ; CHECK-NEXT: store 24 ret i8 %j 25 ; CHECK: ret i8 [[INST]] 26 } 27