From: Andrew Lenharth Date: Tue, 7 Oct 2008 18:27:23 +0000 (+0000) Subject: Use Dan's supperior check X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2163ca11d576059883d1c289e5c4d8163d123270;p=oota-llvm.git Use Dan's supperior check git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57255 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index d4d13c33bb3..8874eb872f6 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -6441,22 +6441,18 @@ void SelectionDAGLegalize::ExpandOp(SDValue Op, SDValue &Lo, SDValue &Hi){ LoOps[1] = RHSL; HiOps[0] = LHSH; HiOps[1] = RHSH; + //cascaded check to see if any smaller size has a a carry flag. unsigned OpV = Node->getOpcode() == ISD::ADD ? ISD::ADDC : ISD::SUBC; bool hasCarry = false; - if (NVT == MVT::i64) - hasCarry = TLI.isOperationLegal(OpV, MVT::i64) - | TLI.isOperationLegal(OpV, MVT::i32) - | TLI.isOperationLegal(OpV, MVT::i16) - | TLI.isOperationLegal(OpV, MVT::i8); - if (NVT == MVT::i32) - hasCarry = TLI.isOperationLegal(OpV, MVT::i32) - | TLI.isOperationLegal(OpV, MVT::i16) - | TLI.isOperationLegal(OpV, MVT::i8); - if (NVT == MVT::i16) - hasCarry = TLI.isOperationLegal(OpV, MVT::i16) - | TLI.isOperationLegal(OpV, MVT::i8); - + for (unsigned BitSize = NVT.getSizeInBits(); BitSize != 0; BitSize /= 2) { + MVT AVT = MVT::getIntegerVT(BitSize); + if (TLI.isOperationLegal(OpV, AVT)) { + hasCarry = true; + break; + } + } + if(hasCarry) { if (Node->getOpcode() == ISD::ADD) { Lo = DAG.getNode(ISD::ADDC, VTList, LoOps, 2);