forked from OSchip/llvm-project
[SelectionDAG] MaskedValueIsZero - add demanded elements implementation
Will be used in an upcoming patch but I've updated the original implementation to call this to ensure test coverage. llvm-svn: 361738
This commit is contained in:
parent
a549dd2560
commit
2916b9e28c
|
@ -1448,8 +1448,14 @@ public:
|
|||
/// Return true if 'Op & Mask' is known to be zero. We
|
||||
/// use this predicate to simplify operations downstream. Op and Mask are
|
||||
/// known to be the same type.
|
||||
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth = 0)
|
||||
const;
|
||||
bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
|
||||
unsigned Depth = 0) const;
|
||||
|
||||
/// Return true if 'Op & Mask' is known to be zero in DemandedElts. We
|
||||
/// use this predicate to simplify operations downstream. Op and Mask are
|
||||
/// known to be the same type.
|
||||
bool MaskedValueIsZero(SDValue Op, const APInt &Mask,
|
||||
const APInt &DemandedElts, unsigned Depth = 0) const;
|
||||
|
||||
/// Determine which bits of Op are known to be either zero or one and return
|
||||
/// them in Known. For vectors, the known bits are those that are shared by
|
||||
|
|
|
@ -2207,9 +2207,22 @@ bool SelectionDAG::SignBitIsZero(SDValue Op, unsigned Depth) const {
|
|||
/// 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(SDValue Op, const APInt &Mask,
|
||||
bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask,
|
||||
unsigned Depth) const {
|
||||
return Mask.isSubsetOf(computeKnownBits(Op, Depth).Zero);
|
||||
EVT VT = V.getValueType();
|
||||
APInt DemandedElts = VT.isVector()
|
||||
? APInt::getAllOnesValue(VT.getVectorNumElements())
|
||||
: APInt(1, 1);
|
||||
return MaskedValueIsZero(V, Mask, DemandedElts, Depth);
|
||||
}
|
||||
|
||||
/// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero in
|
||||
/// DemandedElts. We use this predicate to simplify operations downstream.
|
||||
/// Mask is known to be zero for bits that V cannot have.
|
||||
bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask,
|
||||
const APInt &DemandedElts,
|
||||
unsigned Depth) const {
|
||||
return Mask.isSubsetOf(computeKnownBits(V, DemandedElts, Depth).Zero);
|
||||
}
|
||||
|
||||
/// isSplatValue - Return true if the vector V has the same value
|
||||
|
|
Loading…
Reference in New Issue