summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-29 16:43:11 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-29 16:43:11 +0000
commitca48af3c8786ad64a1533eaabae94a05028fbbf6 (patch)
treefb37cf54998a412934244449aca229202a9c095e /llvm/lib/CodeGen/SelectionDAG
parent9d580e85281c743ce3e8a18c935956bd78f1ea90 (diff)
downloadbcm5719-llvm-ca48af3c8786ad64a1533eaabae94a05028fbbf6.tar.gz
bcm5719-llvm-ca48af3c8786ad64a1533eaabae94a05028fbbf6.zip
[KnownBits] Add methods for determining if the known bits represent a negative/nonnegative number and add methods for changing the negative/nonnegative state
Summary: This patch adds isNegative, isNonNegative for querying whether the sign bit is known. It also adds makeNegative and makeNonNegative for controlling the sign bit. Reviewers: RKSimon, spatel, davide Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32651 llvm-svn: 301747
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index dabfb8bd06d..71d8109fb5a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2711,7 +2711,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, KnownBits &Known,
computeKnownBits(Op.getOperand(0), Known2, DemandedElts, Depth + 1);
// If the source's MSB is zero then we know the rest of the bits already.
- if (Known2.Zero[BitWidth - 1]) {
+ if (Known2.isNonNegative()) {
Known.Zero = Known2.Zero;
Known.One = Known2.One;
break;
@@ -3045,7 +3045,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
// If we are subtracting one from a positive number, there is no carry
// out of the result.
- if (Known.Zero.isNegative())
+ if (Known.isNonNegative())
return Tmp;
}
@@ -3069,7 +3069,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
// If the input is known to be positive (the sign bit is known clear),
// the output of the NEG has the same number of sign bits as the input.
- if (Known.Zero.isNegative())
+ if (Known.isNonNegative())
return Tmp2;
// Otherwise, we treat this like a SUB.
@@ -3208,9 +3208,9 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
computeKnownBits(Op, Known, DemandedElts, Depth);
APInt Mask;
- if (Known.Zero.isNegative()) { // sign bit is 0
+ if (Known.isNonNegative()) { // sign bit is 0
Mask = Known.Zero;
- } else if (Known.One.isNegative()) { // sign bit is 1;
+ } else if (Known.isNegative()) { // sign bit is 1;
Mask = Known.One;
} else {
// Nothing known.
OpenPOWER on IntegriCloud