summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-07-29 00:33:32 +0000
committerChris Lattner <sabre@nondot.org>2005-07-29 00:33:32 +0000
commitfe68d75aad85287044bf1c5521a657409dea0d56 (patch)
tree674bb0847b698b323037a6b69799d48470ffc0f5 /llvm/lib/CodeGen
parent44fe26ff07efff3ad0b9649ad79eecc5b09bc057 (diff)
downloadbcm5719-llvm-fe68d75aad85287044bf1c5521a657409dea0d56.tar.gz
bcm5719-llvm-fe68d75aad85287044bf1c5521a657409dea0d56.zip
Allow targets to define custom expanders for FP_TO_*INT
llvm-svn: 22548
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index a65e9b58a2b..8508030b820 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud