From: Chris Lattner Date: Sat, 9 Sep 2006 00:20:27 +0000 (+0000) Subject: Allow targets to custom lower expanded BIT_CONVERT's X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3f333dbd67afde147165bb5ba87889d76a6f436;p=oota-llvm.git Allow targets to custom lower expanded BIT_CONVERT's git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30217 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index cd6a3bf2da1..c32da68454a 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/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; }