diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2008-10-07 18:27:23 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2008-10-07 18:27:23 +0000 |
commit | 21dca9cbb1c4b1c21c9dbeeb7d3d46d413fda04e (patch) | |
tree | 2957b7f589e26136488ce379de7ad78d36d77f5b /llvm/lib | |
parent | 5aa1cc40652530ae56f0f4e62daa5cd6a285260a (diff) | |
download | bcm5719-llvm-21dca9cbb1c4b1c21c9dbeeb7d3d46d413fda04e.tar.gz bcm5719-llvm-21dca9cbb1c4b1c21c9dbeeb7d3d46d413fda04e.zip |
Use Dan's supperior check
llvm-svn: 57255
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index d4d13c33bb3..8874eb872f6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/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); |