diff options
author | Chris Lattner <sabre@nondot.org> | 2006-09-09 00:20:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-09-09 00:20:27 +0000 |
commit | e4bbb6c3412ca8f05c85099500d576510b5497d2 (patch) | |
tree | dc0bae29ad290e650708224606950011e85c3a45 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 69df6132d781665ab59adca3ea24acc33ec77525 (diff) | |
download | bcm5719-llvm-e4bbb6c3412ca8f05c85099500d576510b5497d2.tar.gz bcm5719-llvm-e4bbb6c3412ca8f05c85099500d576510b5497d2.zip |
Allow targets to custom lower expanded BIT_CONVERT's
llvm-svn: 30217
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index cd6a3bf2da1..c32da68454a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -4457,8 +4457,21 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){ break; case ISD::BIT_CONVERT: { - SDOperand Tmp = ExpandBIT_CONVERT(Node->getValueType(0), - Node->getOperand(0)); + SDOperand Tmp; + if (TLI.getOperationAction(ISD::BIT_CONVERT, VT) == TargetLowering::Custom){ + // If the target wants to, allow it to lower this itself. + switch (getTypeAction(Node->getOperand(0).getValueType())) { + case Expand: assert(0 && "cannot expand FP!"); + case Legal: Tmp = LegalizeOp(Node->getOperand(0)); break; + case Promote: Tmp = PromoteOp (Node->getOperand(0)); break; + } + Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); + } + + // Turn this into a load/store pair by default. + if (Tmp.Val == 0) + Tmp = ExpandBIT_CONVERT(Node->getValueType(0), Node->getOperand(0)); + ExpandOp(Tmp, Lo, Hi); break; } |