mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Use the correct ShiftAmtTy for creating shifts after legalization. PR11881. Not committing a testcase because I think it will be too fragile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149315 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1612,15 +1612,17 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
|||||||
|
|
||||||
APInt MsbMask = APInt::getHighBitsSet(BitWidth, 1);
|
APInt MsbMask = APInt::getHighBitsSet(BitWidth, 1);
|
||||||
// If we only care about the highest bit, don't bother shifting right.
|
// If we only care about the highest bit, don't bother shifting right.
|
||||||
if (MsbMask == DemandedMask) {
|
if (MsbMask == DemandedMask) {
|
||||||
unsigned ShAmt = ExVT.getScalarType().getSizeInBits();
|
unsigned ShAmt = ExVT.getScalarType().getSizeInBits();
|
||||||
SDValue InOp = Op.getOperand(0);
|
SDValue InOp = Op.getOperand(0);
|
||||||
// In this code we may handle vector types. We can't use the
|
|
||||||
// getShiftAmountTy API because it only works on scalars.
|
// Compute the correct shift amount type, which must be getShiftAmountTy
|
||||||
// We use the shift value type because we know that its an integer
|
// for scalar types after legalization.
|
||||||
// with enough bits.
|
EVT ShiftAmtTy = Op.getValueType();
|
||||||
SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt,
|
if (TLO.LegalTypes() && !ShiftAmtTy.isVector())
|
||||||
Op.getValueType());
|
ShiftAmtTy = getShiftAmountTy(ShiftAmtTy);
|
||||||
|
|
||||||
|
SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt, ShiftAmtTy);
|
||||||
return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
|
return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
|
||||||
Op.getValueType(), InOp, ShiftAmt));
|
Op.getValueType(), InOp, ShiftAmt));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user