[PATCH] ARMEB: Fix function return type f64

Christian Pirker cpirker at a-bix.com
Fri May 30 09:36:15 PDT 2014


Hi all,

This patch implements the correct word order to load f64 from stack location and return it as function return value.
Please review.

Thanks,
Christian

http://reviews.llvm.org/D3968

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/big-endian-ret-f64.ll

Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -8315,6 +8315,8 @@
                                  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);
Index: test/CodeGen/ARM/big-endian-ret-f64.ll
===================================================================
--- test/CodeGen/ARM/big-endian-ret-f64.ll
+++ test/CodeGen/ARM/big-endian-ret-f64.ll
@@ -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
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3968.9962.patch
Type: text/x-patch
Size: 1083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140530/2b6c0ed0/attachment.bin>


More information about the llvm-commits mailing list