1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: max: 4*9880d681SAndroid Build Coastguard Workerdefine i32 @max(i8 %ctx, i32* %ptr, i32 %val) 5*9880d681SAndroid Build Coastguard Worker{ 6*9880d681SAndroid Build Coastguard Worker; CHECK: ldrex 7*9880d681SAndroid Build Coastguard Worker; CHECK: cmp [[old:r[0-9]*]], [[val:r[0-9]*]] 8*9880d681SAndroid Build Coastguard Worker; CHECK: movhi {{r[0-9]*}}, [[old]] 9*9880d681SAndroid Build Coastguard Worker %old = atomicrmw umax i32* %ptr, i32 %val monotonic 10*9880d681SAndroid Build Coastguard Worker ret i32 %old 11*9880d681SAndroid Build Coastguard Worker} 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: min: 14*9880d681SAndroid Build Coastguard Workerdefine i32 @min(i8 %ctx, i32* %ptr, i32 %val) 15*9880d681SAndroid Build Coastguard Worker{ 16*9880d681SAndroid Build Coastguard Worker; CHECK: ldrex 17*9880d681SAndroid Build Coastguard Worker; CHECK: cmp [[old:r[0-9]*]], [[val:r[0-9]*]] 18*9880d681SAndroid Build Coastguard Worker; CHECK: movls {{r[0-9]*}}, [[old]] 19*9880d681SAndroid Build Coastguard Worker %old = atomicrmw umin i32* %ptr, i32 %val monotonic 20*9880d681SAndroid Build Coastguard Worker ret i32 %old 21*9880d681SAndroid Build Coastguard Worker} 22