aboutsummaryrefslogtreecommitdiffstats
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
commitf8bb44039c56063c3e0bf6224f1abf20c844ad91 (patch)
treebe3d2341639fa1e8150bce59509971f02b965fec /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent913dcf35c3b19eebc8f8fcd7733faf2e5cd4bc84 (diff)
downloadexternal_llvm-f8bb44039c56063c3e0bf6224f1abf20c844ad91.zip
external_llvm-f8bb44039c56063c3e0bf6224f1abf20c844ad91.tar.gz
external_llvm-f8bb44039c56063c3e0bf6224f1abf20c844ad91.tar.bz2
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 02159de..7d64b24 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() ==