1; RUN: opt < %s -loweratomic -S | FileCheck %s 2; RUN: opt < %s -passes=loweratomic -S | FileCheck %s 3 4define i8 @add() { 5; CHECK-LABEL: @add( 6 %i = alloca i8 7 %j = atomicrmw add i8* %i, i8 42 monotonic 8; CHECK: [[INST:%[a-z0-9]+]] = load 9; CHECK-NEXT: add 10; CHECK-NEXT: store 11 ret i8 %j 12; CHECK: ret i8 [[INST]] 13} 14 15define i8 @nand() { 16; CHECK-LABEL: @nand( 17 %i = alloca i8 18 %j = atomicrmw nand i8* %i, i8 42 monotonic 19; CHECK: [[INST:%[a-z0-9]+]] = load 20; CHECK-NEXT: and 21; CHECK-NEXT: xor 22; CHECK-NEXT: store 23 ret i8 %j 24; CHECK: ret i8 [[INST]] 25} 26 27define i8 @min() { 28; CHECK-LABEL: @min( 29 %i = alloca i8 30 %j = atomicrmw min i8* %i, i8 42 monotonic 31; CHECK: [[INST:%[a-z0-9]+]] = load 32; CHECK-NEXT: icmp 33; CHECK-NEXT: select 34; CHECK-NEXT: store 35 ret i8 %j 36; CHECK: ret i8 [[INST]] 37} 38 39define float @fadd() { 40; CHECK-LABEL: @fadd( 41 %i = alloca float 42 %j = atomicrmw fadd float* %i, float 42.0 monotonic 43; CHECK: [[INST:%[a-z0-9]+]] = load 44; CHECK-NEXT: fadd 45; CHECK-NEXT: store 46 ret float %j 47; CHECK: ret float [[INST]] 48} 49 50define float @fsub() { 51; CHECK-LABEL: @fsub( 52 %i = alloca float 53 %j = atomicrmw fsub float* %i, float 42.0 monotonic 54; CHECK: [[INST:%[a-z0-9]+]] = load 55; CHECK-NEXT: fsub 56; CHECK-NEXT: store 57 ret float %j 58; CHECK: ret float [[INST]] 59} 60