2014-04-04 00:01:44 +08:00
|
|
|
; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s
|
2012-09-26 17:48:32 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: max:
|
2012-09-26 17:48:32 +08:00
|
|
|
define i32 @max(i8 %ctx, i32* %ptr, i32 %val)
|
|
|
|
{
|
|
|
|
; CHECK: ldrex
|
|
|
|
; CHECK: cmp [[old:r[0-9]*]], [[val:r[0-9]*]]
|
|
|
|
; CHECK: movhi {{r[0-9]*}}, [[old]]
|
|
|
|
%old = atomicrmw umax i32* %ptr, i32 %val monotonic
|
|
|
|
ret i32 %old
|
|
|
|
}
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: min:
|
2012-09-26 17:48:32 +08:00
|
|
|
define i32 @min(i8 %ctx, i32* %ptr, i32 %val)
|
|
|
|
{
|
|
|
|
; CHECK: ldrex
|
|
|
|
; CHECK: cmp [[old:r[0-9]*]], [[val:r[0-9]*]]
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: movls {{r[0-9]*}}, [[old]]
|
2012-09-26 17:48:32 +08:00
|
|
|
%old = atomicrmw umin i32* %ptr, i32 %val monotonic
|
|
|
|
ret i32 %old
|
|
|
|
}
|