[llvm] r252042 - [X86] DAGCombine should not introduce FILD in soft-float mode

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 03:17:54 PST 2015


Author: mkuper
Date: Wed Nov  4 05:17:53 2015
New Revision: 252042

URL: http://llvm.org/viewvc/llvm-project?rev=252042&view=rev
Log:
[X86] DAGCombine should not introduce FILD in soft-float mode

The x86 "sitofp i64 to double" dag combine, in 32-bit mode, lowers sitofp 
directly to X86ISD::FILD (or FILD_FLAG). This should not be done in soft-float mode.

Added:
    llvm/trunk/test/CodeGen/X86/soft-sitofp.ll
Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=252042&r1=252041&r2=252042&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Nov  4 05:17:53 2015
@@ -26419,8 +26419,8 @@ static SDValue PerformSINT_TO_FPCombine(
   }
 
   // Transform (SINT_TO_FP (i64 ...)) into an x87 operation if we have
-  // a 32-bit target where SSE doesn't support i64->FP operations.
-  if (Op0.getOpcode() == ISD::LOAD) {
+  // a 32-bit target where SSE doesn't support i64->FP operations.  
+  if (!Subtarget->useSoftFloat() && Op0.getOpcode() == ISD::LOAD) {
     LoadSDNode *Ld = cast<LoadSDNode>(Op0.getNode());
     EVT LdVT = Ld->getValueType(0);
 

Added: llvm/trunk/test/CodeGen/X86/soft-sitofp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/soft-sitofp.ll?rev=252042&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/soft-sitofp.ll (added)
+++ llvm/trunk/test/CodeGen/X86/soft-sitofp.ll Wed Nov  4 05:17:53 2015
@@ -0,0 +1,15 @@
+; RUN: llc < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
+target triple = "i386-pc-linux"
+
+; Function Attrs: nounwind
+; CHECK-LABEL: ll_to_d:
+; CHECK: calll __floatdidf
+define double @ll_to_d(i64 %n) #0 {
+entry:
+  %conv = sitofp i64 %n to double
+  ret double %conv
+}
+
+attributes #0 = { nounwind "use-soft-float"="true" }




More information about the llvm-commits mailing list