aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-10 16:51:40 +0000
committerChris Lattner <sabre@nondot.org>2005-10-10 16:51:40 +0000
commitbba9aa3475e307be7bd60eecc733cd46eeaf107a (patch)
tree4078cfc533b11c4623ef0e9c06f7416f1d5dcffd /lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent3892560680e244601e52080f448df75988d89663 (diff)
Add ISD::ADD to MaskedValueIsZero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 60bb6c6795..f15ce5784c 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -215,6 +215,14 @@ static bool MaskedValueIsZero(const SDOperand &Op, uint64_t Mask,
return MaskedValueIsZero(Op.getOperand(0), NewVal, TLI);
}
return false;
+ case ISD::ADD:
+ // (add X, Y) & C == 0 iff (X&C)&(Y&C) == 0 and all bits are low bits.
+ if ((Mask&(Mask+1)) == 0) { // All low bits
+ if (MaskedValueIsZero(Op.getOperand(0), Mask, TLI) &&
+ MaskedValueIsZero(Op.getOperand(1), Mask, TLI))
+ return true;
+ }
+ break;
case ISD::SUB:
if (ConstantSDNode *CLHS = dyn_cast<ConstantSDNode>(Op.getOperand(0))) {
// We know that the top bits of C-X are clear if X contains less bits