[X86][SSE] Split SimplifyDemandedBitsForTargetNode X86ISD::VSRLI/VSRAI handling.

First step towards adding more capable combines to fix comments in D55768.

llvm-svn: 349400
This commit is contained in:
Simon Pilgrim 2018-12-17 21:36:17 +00:00
parent b6bc1c5ba3
commit 6b5e0b7b2b
1 changed files with 16 additions and 3 deletions

View File

@ -32410,8 +32410,22 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
}
break;
}
case X86ISD::VSRAI:
case X86ISD::VSRLI: {
if (auto *ShiftImm = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
if (ShiftImm->getAPIntValue().uge(BitWidth))
break;
KnownBits KnownOp;
unsigned ShAmt = ShiftImm->getZExtValue();
APInt DemandedMask = OriginalDemandedBits << ShAmt;
if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask,
OriginalDemandedElts, KnownOp, TLO, Depth + 1))
return true;
}
break;
}
case X86ISD::VSRAI: {
if (auto *ShiftImm = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
if (ShiftImm->getAPIntValue().uge(BitWidth))
break;
@ -32422,8 +32436,7 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
// If any of the demanded bits are produced by the sign extension, we also
// demand the input sign bit.
if (Opc == X86ISD::VSRAI &&
OriginalDemandedBits.countLeadingZeros() < ShAmt)
if (OriginalDemandedBits.countLeadingZeros() < ShAmt)
DemandedMask.setSignBit();
if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask,