[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 28 17:33:43 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.146 -> 1.147
---
Log message:

Allow targets to define custom expanders for FP_TO_*INT


---
Diffs of the changes:  (+18 -0)

 LegalizeDAG.cpp |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.146 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.147
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.146	Thu Jul 28 19:11:56 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Thu Jul 28 19:33:32 2005
@@ -2772,12 +2772,30 @@
     // These operators cannot be expanded directly, emit them as calls to
     // 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)));
+      // Now that the custom expander is done, expand the result, which is still
+      // VT.
+      ExpandOp(TLI.LowerOperation(Op, DAG), Lo, Hi);
+      break;
+    }
+    
     if (Node->getOperand(0).getValueType() == MVT::f32)
       Lo = ExpandLibCall("__fixsfdi", Node, Hi);
     else
       Lo = ExpandLibCall("__fixdfdi", Node, Hi);
     break;
   case ISD::FP_TO_UINT:
+    if (TLI.getOperationAction(ISD::FP_TO_UINT, VT) == TargetLowering::Custom) {
+      SDOperand Op = DAG.getNode(ISD::FP_TO_UINT, VT,
+                                 LegalizeOp(Node->getOperand(0)));
+      // Now that the custom expander is done, expand the result, which is still
+      // VT.
+      ExpandOp(TLI.LowerOperation(Op, DAG), Lo, Hi);
+      break;
+    }
+    
     if (Node->getOperand(0).getValueType() == MVT::f32)
       Lo = ExpandLibCall("__fixunssfdi", Node, Hi);
     else






More information about the llvm-commits mailing list