[PATCH] Fix makeLibCall argument (signed) in SoftenFloatRes_XINT_TO_FP function

Strahinja Petrovic strahinja.petrovic at rt-rk.com
Fri Jan 30 04:58:48 PST 2015


Hi t.p.northover, petarj,

The isSigned argument of makeLibCall function was hard-coded to false (unsigned). This caused zero extension on MIPS64 soft float.
As the result SingleSource/Benchmarks/Stanford/FloatMM test and SingleSource/UnitTests/2005-07-17-INT-To-FP test failed. 
The solution was to use the proper argument.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7292

Files:
  lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
  test/CodeGen/Mips/mips64sinttofpsf.ll

Index: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -658,7 +658,7 @@
                            NVT, N->getOperand(0));
   return TLI.makeLibCall(DAG, LC,
                          TLI.getTypeToTransformTo(*DAG.getContext(), RVT),
-                         &Op, 1, false, dl).first;
+                         &Op, 1, Signed, dl).first;
 }
 
 
Index: test/CodeGen/Mips/mips64sinttofpsf.ll
===================================================================
--- test/CodeGen/Mips/mips64sinttofpsf.ll
+++ test/CodeGen/Mips/mips64sinttofpsf.ll
@@ -0,0 +1,15 @@
+; RUN: llc -march=mips64 -mcpu=mips64r2 -soft-float -O0 < %s | FileCheck %s
+
+
+define double @foo() #0 {
+entry:
+  %x = alloca i32, align 4
+  store volatile i32 -32, i32* %x, align 4
+  %0 = load volatile i32* %x, align 4
+  %conv = sitofp i32 %0 to double
+  ret double %conv
+
+; CHECK-NOT:        dsll
+; CHECK-NOT:        dsrl
+
+}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7292.19031.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150130/49714309/attachment.bin>


More information about the llvm-commits mailing list