From 34e2d22d63bd324ec0a46b4760defdfd67539c7b Mon Sep 17 00:00:00 2001 From: Scott Michel Date: Mon, 30 Jul 2007 21:00:31 +0000 Subject: [PATCH] - Allow custom lowering for CTPOP, CTTZ, CTLZ. - Fixed an existing unexpanded tab. llvm-svn: 40605 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 078cbf3d7a21..3ca30dd88d22 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2738,9 +2738,16 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case ISD::CTLZ: Tmp1 = LegalizeOp(Node->getOperand(0)); // Op switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { - case TargetLowering::Custom: assert(0 && "Cannot custom handle this yet!"); + case TargetLowering::Custom: case TargetLowering::Legal: Result = DAG.UpdateNodeOperands(Result, Tmp1); + if (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0)) == + TargetLowering::Custom) { + Tmp1 = TLI.LowerOperation(Result, DAG); + if (Tmp1.Val) { + Result = Tmp1; + } + } break; case TargetLowering::Promote: { MVT::ValueType OVT = Tmp1.getValueType(); @@ -2760,7 +2767,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { DAG.getConstant(MVT::getSizeInBits(NVT), NVT), ISD::SETEQ); Result = DAG.getNode(ISD::SELECT, NVT, Tmp2, - DAG.getConstant(MVT::getSizeInBits(OVT),NVT), Tmp1); + DAG.getConstant(MVT::getSizeInBits(OVT),NVT), Tmp1); break; case ISD::CTLZ: // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT))