mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
9f4df20fe0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164687 91177308-0d34-0410-b5e6-96231b3b80d8
22 lines
529 B
LLVM
22 lines
529 B
LLVM
; RUN: llc -march=arm -mcpu=cortex-a9 < %s | FileCheck %s
|
|
|
|
; CHECK: max:
|
|
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
|
|
}
|
|
|
|
; CHECK: min:
|
|
define i32 @min(i8 %ctx, i32* %ptr, i32 %val)
|
|
{
|
|
; CHECK: ldrex
|
|
; CHECK: cmp [[old:r[0-9]*]], [[val:r[0-9]*]]
|
|
; CHECK: movlo {{r[0-9]*}}, [[old]]
|
|
%old = atomicrmw umin i32* %ptr, i32 %val monotonic
|
|
ret i32 %old
|
|
}
|