mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 20:33:15 +00:00
(X & Y) & C == 0 if either X&C or Y&C are zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23678 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5fb0deb43a
commit
ee899e6bfc
@ -176,10 +176,15 @@ static bool MaskedValueIsZero(const SDOperand &Op, uint64_t Mask,
|
|||||||
SrcBits = MVT::getSizeInBits(cast<VTSDNode>(Op.getOperand(1))->getVT());
|
SrcBits = MVT::getSizeInBits(cast<VTSDNode>(Op.getOperand(1))->getVT());
|
||||||
return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits.
|
return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits.
|
||||||
case ISD::AND:
|
case ISD::AND:
|
||||||
|
// If either of the operands has zero bits, the result will too.
|
||||||
|
if (MaskedValueIsZero(Op.getOperand(1), Mask, TLI) ||
|
||||||
|
MaskedValueIsZero(Op.getOperand(0), Mask, TLI))
|
||||||
|
return true;
|
||||||
|
|
||||||
// (X & C1) & C2 == 0 iff C1 & C2 == 0.
|
// (X & C1) & C2 == 0 iff C1 & C2 == 0.
|
||||||
if (ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(Op.getOperand(1)))
|
if (ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(Op.getOperand(1)))
|
||||||
return MaskedValueIsZero(Op.getOperand(0),AndRHS->getValue() & Mask, TLI);
|
return MaskedValueIsZero(Op.getOperand(0),AndRHS->getValue() & Mask, TLI);
|
||||||
// FALL THROUGH
|
return false;
|
||||||
case ISD::OR:
|
case ISD::OR:
|
||||||
case ISD::XOR:
|
case ISD::XOR:
|
||||||
return MaskedValueIsZero(Op.getOperand(0), Mask, TLI) &&
|
return MaskedValueIsZero(Op.getOperand(0), Mask, TLI) &&
|
||||||
|
@ -608,11 +608,15 @@ static bool MaskedValueIsZero(const SDOperand &Op, uint64_t Mask,
|
|||||||
SrcBits = MVT::getSizeInBits(cast<VTSDNode>(Op.getOperand(1))->getVT());
|
SrcBits = MVT::getSizeInBits(cast<VTSDNode>(Op.getOperand(1))->getVT());
|
||||||
return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits.
|
return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits.
|
||||||
case ISD::AND:
|
case ISD::AND:
|
||||||
|
// If either of the operands has zero bits, the result will too.
|
||||||
|
if (MaskedValueIsZero(Op.getOperand(1), Mask, TLI) ||
|
||||||
|
MaskedValueIsZero(Op.getOperand(0), Mask, TLI))
|
||||||
|
return true;
|
||||||
|
|
||||||
// (X & C1) & C2 == 0 iff C1 & C2 == 0.
|
// (X & C1) & C2 == 0 iff C1 & C2 == 0.
|
||||||
if (ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(Op.getOperand(1)))
|
if (ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(Op.getOperand(1)))
|
||||||
return MaskedValueIsZero(Op.getOperand(0),AndRHS->getValue() & Mask, TLI);
|
return MaskedValueIsZero(Op.getOperand(0),AndRHS->getValue() & Mask, TLI);
|
||||||
|
return false;
|
||||||
// FALL THROUGH
|
|
||||||
case ISD::OR:
|
case ISD::OR:
|
||||||
case ISD::XOR:
|
case ISD::XOR:
|
||||||
return MaskedValueIsZero(Op.getOperand(0), Mask, TLI) &&
|
return MaskedValueIsZero(Op.getOperand(0), Mask, TLI) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user