fix float->long conversions on x86
authorChris Lattner <sabre@nondot.org>
Sat, 30 Jul 2005 01:40:57 +0000 (01:40 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 30 Jul 2005 01:40:57 +0000 (01:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22563 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 53e9b5cb63c22e7164b31c4ab383bd94e6bf1283..b47fc0df5782655f27db44b1389e153c53616271 100644 (file)
@@ -2779,11 +2779,18 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
     // library functions.
   case ISD::FP_TO_SINT:
     if (TLI.getOperationAction(ISD::FP_TO_SINT, VT) == TargetLowering::Custom) {
-      SDOperand Op = DAG.getNode(ISD::FP_TO_SINT, VT,
-                                 LegalizeOp(Node->getOperand(0)));
+      SDOperand Op;
+      switch (getTypeAction(Node->getOperand(0).getValueType())) {
+      case Expand: assert(0 && "cannot expand FP!");
+      case Legal: Op = LegalizeOp(Node->getOperand(0)); break;
+      case Promote: Op = PromoteOp(Node->getOperand(0)); break;
+      }
+      
+      Op = TLI.LowerOperation(DAG.getNode(ISD::FP_TO_SINT, VT, Op), DAG);
+
       // Now that the custom expander is done, expand the result, which is still
       // VT.
-      ExpandOp(TLI.LowerOperation(Op, DAG), Lo, Hi);
+      ExpandOp(Op, Lo, Hi);
       break;
     }