ARMEB: Fix function return type f64
authorChristian Pirker <cpirker@a-bix.com>
Sun, 1 Jun 2014 09:30:52 +0000 (09:30 +0000)
committerChristian Pirker <cpirker@a-bix.com>
Sun, 1 Jun 2014 09:30:52 +0000 (09:30 +0000)
Reviewed at http://reviews.llvm.org/D3968

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209990 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/big-endian-ret-f64.ll [new file with mode: 0644]

index a7a47d972cbb1f09227d7c6750f39ee32582a6e2..eed523be3f32d24860add974c44a0096ba0988e3 100644 (file)
@@ -8315,6 +8315,8 @@ static SDValue PerformVMOVRRDCombine(SDNode *N,
                                  std::min(4U, LD->getAlignment() / 2));
 
     DAG.ReplaceAllUsesOfValueWith(SDValue(LD, 1), NewLD2.getValue(1));
+    if (DCI.DAG.getTargetLoweringInfo().isBigEndian())
+      std::swap (NewLD1, NewLD2);
     SDValue Result = DCI.CombineTo(N, NewLD1, NewLD2);
     DCI.RemoveFromWorklist(LD);
     DAG.DeleteNode(LD);
diff --git a/test/CodeGen/ARM/big-endian-ret-f64.ll b/test/CodeGen/ARM/big-endian-ret-f64.ll
new file mode 100644 (file)
index 0000000..614bfc0
--- /dev/null
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=armebv7a-eabi %s -O0 -o - | FileCheck %s
+; RUN: llc -mtriple=armebv8a-eabi %s -O0 -o - | FileCheck %s
+
+define double @fn() {
+; CHECK-LABEL: fn
+; CHECK: ldr r0, [sp]
+; CHECK: ldr r1, [sp, #4]
+  %r = alloca double, align 8
+  %1 = load double* %r, align 8
+  ret double %1
+}
+