[llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp
Jim Laskey
jlaskey at apple.com
Tue Jun 13 06:09:24 PDT 2006
Changes in directory llvm/lib/Target:
TargetLowering.cpp updated: 1.67 -> 1.68
---
Log message:
TargetLowering::ComputeMaskedBits was not clearing reciprocal bits on shifts.
---
Diffs of the changes: (+11 -6)
TargetLowering.cpp | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
Index: llvm/lib/Target/TargetLowering.cpp
diff -u llvm/lib/Target/TargetLowering.cpp:1.67 llvm/lib/Target/TargetLowering.cpp:1.68
--- llvm/lib/Target/TargetLowering.cpp:1.67 Mon Jun 12 11:07:18 2006
+++ llvm/lib/Target/TargetLowering.cpp Tue Jun 13 08:08:58 2006
@@ -780,12 +780,14 @@
case ISD::SHL:
// (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0
if (ConstantSDNode *SA = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
+ uint64_t LowBits = (1ULL << SA->getValue())-1;
Mask >>= SA->getValue();
ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
KnownZero <<= SA->getValue();
KnownOne <<= SA->getValue();
- KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero.
+ KnownZero |= LowBits; // low bits known zero
+ KnownOne &= ~LowBits; // and known not to be one.
}
return;
case ISD::SRL:
@@ -798,7 +800,8 @@
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
KnownZero >>= SA->getValue();
KnownOne >>= SA->getValue();
- KnownZero |= HighBits; // high bits known zero.
+ KnownZero |= HighBits; // high bits known zero
+ KnownOne &= ~HighBits; // and known not to be one.
}
return;
case ISD::SRA:
@@ -815,10 +818,12 @@
uint64_t SignBit = 1ULL << (MVT::getSizeInBits(Op.getValueType())-1);
SignBit >>= SA->getValue(); // Adjust to where it is now in the mask.
- if (KnownZero & SignBit) { // New bits are known zero.
- KnownZero |= HighBits;
- } else if (KnownOne & SignBit) { // New bits are known one.
- KnownOne |= HighBits;
+ if (KnownZero & SignBit) {
+ KnownZero |= HighBits; // New bits are known zero
+ KnownOne &= ~HighBits; // and known not to be one.
+ } else if (KnownOne & SignBit) {
+ KnownOne |= HighBits; // New bits are known one
+ KnownZero &= ~HighBits; // and known not to be zero.
}
}
return;
More information about the llvm-commits
mailing list