diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-11-22 07:24:01 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-11-22 07:24:01 +0000 |
commit | 5424e6d4ec69683c05d883354a3f5c1536cf98ad (patch) | |
tree | f0e79b93142b4ef17f4616eff967bf6d600a0bec /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 59acca58742cd584b46476a2350ffbd827e9ff89 (diff) | |
download | bcm5719-llvm-5424e6d4ec69683c05d883354a3f5c1536cf98ad.tar.gz bcm5719-llvm-5424e6d4ec69683c05d883354a3f5c1536cf98ad.zip |
Cleanup of the [SU]ADDO type legalization code. Patch by Duncan!
"It simplifies the type legalization part a bit, and produces better code by
teaching SelectionDAG about the extra bits in an i8 SADDO/UADDO node. In
essence, I spontaneously decided that on x86 this i8 boolean result would be
either 0 or 1, and on other platforms 0/1 or 0/-1, depending on whether the
platform likes it's boolean zero extended or sign extended."
llvm-svn: 59864
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 02159de0c75..7d64b2441d9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1491,6 +1491,11 @@ void SelectionDAG::ComputeMaskedBits(SDValue Op, const APInt &Mask, KnownOne &= KnownOne2; KnownZero &= KnownZero2; return; + case ISD::SADDO: + case ISD::UADDO: + if (Op.getResNo() != 1) + return; + // The boolean result conforms to getSetCCResultContents. Fall through. case ISD::SETCC: // If we know the result of a setcc has the top bits zero, use this info. if (TLI.getSetCCResultContents() == TargetLowering::ZeroOrOneSetCCResult && @@ -1893,7 +1898,12 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{ if (Tmp == 1) return 1; // Early out. Tmp2 = ComputeNumSignBits(Op.getOperand(2), Depth+1); return std::min(Tmp, Tmp2); - + + case ISD::SADDO: + case ISD::UADDO: + if (Op.getResNo() != 1) + break; + // The boolean result conforms to getSetCCResultContents. Fall through. case ISD::SETCC: // If setcc returns 0/-1, all bits are sign bits. if (TLI.getSetCCResultContents() == |