diff options
author | Dan Gohman <gohman@apple.com> | 2008-02-25 21:11:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-02-25 21:11:39 +0000 |
commit | 1f372edd97c15455c113ffdcc786b52e95c41b5f (patch) | |
tree | adb158ced8a68b13739b968006b25fdaa1120bd6 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | eb85ab44f220432c309bc566c91ec4c0e5a607e4 (diff) | |
download | bcm5719-llvm-1f372edd97c15455c113ffdcc786b52e95c41b5f.tar.gz bcm5719-llvm-1f372edd97c15455c113ffdcc786b52e95c41b5f.zip |
Convert MaskedValueIsZero and all its users to use APInt. Also add
a SignBitIsZero function to simplify a common use case.
llvm-svn: 47561
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index a12ff10c330..2f3bfcfb737 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1133,16 +1133,19 @@ SDOperand SelectionDAG::FoldSetCC(MVT::ValueType VT, SDOperand N1, return SDOperand(); } +/// SignBitIsZero - Return true if the sign bit of Op is known to be zero. We +/// use this predicate to simplify operations downstream. +bool SelectionDAG::SignBitIsZero(SDOperand Op, unsigned Depth) const { + unsigned BitWidth = Op.getValueSizeInBits(); + return MaskedValueIsZero(Op, APInt::getSignBit(BitWidth), Depth); +} + /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use /// this predicate to simplify operations downstream. Mask is known to be zero /// for bits that V cannot have. -bool SelectionDAG::MaskedValueIsZero(SDOperand Op, uint64_t Mask, +bool SelectionDAG::MaskedValueIsZero(SDOperand Op, const APInt &Mask, unsigned Depth) const { - // The masks are not wide enough to represent this type! Should use APInt. - if (Op.getValueType() == MVT::i128) - return false; - - uint64_t KnownZero, KnownOne; + APInt KnownZero, KnownOne; ComputeMaskedBits(Op, Mask, KnownZero, KnownOne, Depth); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); return (KnownZero & Mask) == Mask; |