1 ; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s 2 3 ; CHECK-LABEL: 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-LABEL: 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: movls {{r[0-9]*}}, [[old]] 19 %old = atomicrmw umin i32* %ptr, i32 %val monotonic 20 ret i32 %old 21 } 22