diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-08 17:22:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-08 17:22:53 +0000 |
commit | 10c653744ed8a60e29af3895beb55b264bff2e94 (patch) | |
tree | f97ff2bb75fd6d7cdaa63157704734c3737a31e0 | |
parent | d7a19102d185b62050474465df106c56c4352b5b (diff) | |
download | bcm5719-llvm-10c653744ed8a60e29af3895beb55b264bff2e94.tar.gz bcm5719-llvm-10c653744ed8a60e29af3895beb55b264bff2e94.zip |
When tracking demanded bits, if any bits from the sext of an SRA are demanded,
then so is the input sign bit. This fixes mediabench/g721 on X86.
llvm-svn: 28166
-rw-r--r-- | llvm/lib/Target/TargetLowering.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetLowering.cpp b/llvm/lib/Target/TargetLowering.cpp index 41405408de5..bbe8e95b785 100644 --- a/llvm/lib/Target/TargetLowering.cpp +++ b/llvm/lib/Target/TargetLowering.cpp @@ -467,8 +467,14 @@ bool TargetLowering::SimplifyDemandedBits(SDOperand Op, uint64_t DemandedMask, HighBits <<= MVT::getSizeInBits(VT) - ShAmt; uint64_t TypeMask = MVT::getIntVTBitMask(VT); - if (SimplifyDemandedBits(Op.getOperand(0), - (DemandedMask << ShAmt) & TypeMask, + uint64_t InDemandedMask = (DemandedMask << ShAmt) & TypeMask; + + // If any of the demanded bits are produced by the sign extension, we also + // demand the input sign bit. + if (HighBits & DemandedMask) + InDemandedMask |= MVT::getIntVTSignBit(VT); + + if (SimplifyDemandedBits(Op.getOperand(0), InDemandedMask, KnownZero, KnownOne, TLO, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); |