aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-22 07:24:01 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-22 07:24:01 +0000
commit253174bf50c932abaa680f465e2888c0e5272267 (patch)
treebe3d2341639fa1e8150bce59509971f02b965fec /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent8ac0d4b4fb10406278cd600214cd3ee6d76620cd (diff)
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." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 02159de0c7..7d64b2441d 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/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() ==