diff options
author | Chris Lattner <sabre@nondot.org> | 2005-07-29 00:33:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-07-29 00:33:32 +0000 |
commit | 80a3e94653574c69ac805d9684a23a94ed3e4b5d (patch) | |
tree | 23f70bba327e1c2e3add8bc42bdc6861b3f7f81b | |
parent | 1618bebcf6f9cd19c4e05de3bfffda28c246bb12 (diff) | |
download | external_llvm-80a3e94653574c69ac805d9684a23a94ed3e4b5d.zip external_llvm-80a3e94653574c69ac805d9684a23a94ed3e4b5d.tar.gz external_llvm-80a3e94653574c69ac805d9684a23a94ed3e4b5d.tar.bz2 |
Allow targets to define custom expanders for FP_TO_*INT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22548 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index a65e9b5..8508030 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2772,12 +2772,30 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){ // 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 |