aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-09-26 09:48:32 +0000
committerJames Molloy <james.molloy@arm.com>2012-09-26 09:48:32 +0000
commitd6d10ae1519f0eb71c1db46c2cc77321d02c6ee6 (patch)
tree2fa0096a179adfd50d0ee97fd35ce4692e1c3f7c /test/CodeGen
parentd72271cd84ab2a0d3855a95719341b036980d5ac (diff)
downloadexternal_llvm-d6d10ae1519f0eb71c1db46c2cc77321d02c6ee6.zip
external_llvm-d6d10ae1519f0eb71c1db46c2cc77321d02c6ee6.tar.gz
external_llvm-d6d10ae1519f0eb71c1db46c2cc77321d02c6ee6.tar.bz2
Fix ordering of operands on lowering of atomicrmw min/max nodes on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/ARM/atomicrmw_minmax.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/atomicrmw_minmax.ll b/test/CodeGen/ARM/atomicrmw_minmax.ll
new file mode 100644
index 0000000..87ec23a
--- /dev/null
+++ b/test/CodeGen/ARM/atomicrmw_minmax.ll
@@ -0,0 +1,21 @@
+; RUN: llc -march=arm -mcpu=cortex-a9 %s -o - |& 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
+}