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