mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[KnownBits] Rename KnownBits::computeForMul to KnownBits::mul. NFCI.
As promised in D98866
This commit is contained in:
parent
334683ea40
commit
8cd06abbb1
@ -299,7 +299,7 @@ public:
|
|||||||
KnownBits RHS);
|
KnownBits RHS);
|
||||||
|
|
||||||
/// Compute known bits resulting from multiplying LHS and RHS.
|
/// Compute known bits resulting from multiplying LHS and RHS.
|
||||||
static KnownBits computeForMul(const KnownBits &LHS, const KnownBits &RHS);
|
static KnownBits mul(const KnownBits &LHS, const KnownBits &RHS);
|
||||||
|
|
||||||
/// Compute known bits from sign-extended multiply-hi.
|
/// Compute known bits from sign-extended multiply-hi.
|
||||||
static KnownBits mulhs(const KnownBits &LHS, const KnownBits &RHS);
|
static KnownBits mulhs(const KnownBits &LHS, const KnownBits &RHS);
|
||||||
|
@ -462,7 +462,7 @@ static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
|
|
||||||
// Only make use of no-wrap flags if we failed to compute the sign bit
|
// Only make use of no-wrap flags if we failed to compute the sign bit
|
||||||
// directly. This matters if the multiplication always overflows, in
|
// directly. This matters if the multiplication always overflows, in
|
||||||
@ -1350,7 +1350,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
|
|||||||
ScalingFactor =
|
ScalingFactor =
|
||||||
KnownBits::makeConstant(APInt(IndexBitWidth, TypeSizeInBytes));
|
KnownBits::makeConstant(APInt(IndexBitWidth, TypeSizeInBytes));
|
||||||
}
|
}
|
||||||
IndexBits = KnownBits::computeForMul(IndexBits, ScalingFactor);
|
IndexBits = KnownBits::mul(IndexBits, ScalingFactor);
|
||||||
|
|
||||||
// If the offsets have a different width from the pointer, according
|
// If the offsets have a different width from the pointer, according
|
||||||
// to the language reference we need to sign-extend or truncate them
|
// to the language reference we need to sign-extend or truncate them
|
||||||
|
@ -302,7 +302,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
|
|||||||
Depth + 1);
|
Depth + 1);
|
||||||
computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts,
|
computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts,
|
||||||
Depth + 1);
|
Depth + 1);
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetOpcode::G_SELECT: {
|
case TargetOpcode::G_SELECT: {
|
||||||
|
@ -2991,7 +2991,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
|
|||||||
case ISD::MUL: {
|
case ISD::MUL: {
|
||||||
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
||||||
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ISD::MULHU: {
|
case ISD::MULHU: {
|
||||||
@ -3011,7 +3011,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
|
|||||||
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
||||||
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
||||||
if (Op.getResNo() == 0)
|
if (Op.getResNo() == 0)
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
else
|
else
|
||||||
Known = KnownBits::mulhu(Known, Known2);
|
Known = KnownBits::mulhu(Known, Known2);
|
||||||
break;
|
break;
|
||||||
@ -3021,7 +3021,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
|
|||||||
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
|
||||||
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
|
||||||
if (Op.getResNo() == 0)
|
if (Op.getResNo() == 0)
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
else
|
else
|
||||||
Known = KnownBits::mulhs(Known, Known2);
|
Known = KnownBits::mulhs(Known, Known2);
|
||||||
break;
|
break;
|
||||||
|
@ -412,10 +412,11 @@ KnownBits KnownBits::abs(bool IntMinIsPoison) const {
|
|||||||
return KnownAbs;
|
return KnownAbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
KnownBits KnownBits::computeForMul(const KnownBits &LHS, const KnownBits &RHS) {
|
KnownBits KnownBits::mul(const KnownBits &LHS, const KnownBits &RHS) {
|
||||||
unsigned BitWidth = LHS.getBitWidth();
|
unsigned BitWidth = LHS.getBitWidth();
|
||||||
|
assert(BitWidth == RHS.getBitWidth() && !LHS.hasConflict() &&
|
||||||
|
!RHS.hasConflict() && "Operand mismatch");
|
||||||
|
|
||||||
assert(!LHS.hasConflict() && !RHS.hasConflict());
|
|
||||||
// Compute a conservative estimate for high known-0 bits.
|
// Compute a conservative estimate for high known-0 bits.
|
||||||
unsigned LeadZ =
|
unsigned LeadZ =
|
||||||
std::max(LHS.countMinLeadingZeros() + RHS.countMinLeadingZeros(),
|
std::max(LHS.countMinLeadingZeros() + RHS.countMinLeadingZeros(),
|
||||||
@ -497,7 +498,7 @@ KnownBits KnownBits::mulhs(const KnownBits &LHS, const KnownBits &RHS) {
|
|||||||
!RHS.hasConflict() && "Operand mismatch");
|
!RHS.hasConflict() && "Operand mismatch");
|
||||||
KnownBits WideLHS = LHS.sext(2 * BitWidth);
|
KnownBits WideLHS = LHS.sext(2 * BitWidth);
|
||||||
KnownBits WideRHS = RHS.sext(2 * BitWidth);
|
KnownBits WideRHS = RHS.sext(2 * BitWidth);
|
||||||
return computeForMul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
|
return mul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
KnownBits KnownBits::mulhu(const KnownBits &LHS, const KnownBits &RHS) {
|
KnownBits KnownBits::mulhu(const KnownBits &LHS, const KnownBits &RHS) {
|
||||||
@ -506,7 +507,7 @@ KnownBits KnownBits::mulhu(const KnownBits &LHS, const KnownBits &RHS) {
|
|||||||
!RHS.hasConflict() && "Operand mismatch");
|
!RHS.hasConflict() && "Operand mismatch");
|
||||||
KnownBits WideLHS = LHS.zext(2 * BitWidth);
|
KnownBits WideLHS = LHS.zext(2 * BitWidth);
|
||||||
KnownBits WideRHS = RHS.zext(2 * BitWidth);
|
KnownBits WideRHS = RHS.zext(2 * BitWidth);
|
||||||
return computeForMul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
|
return mul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
KnownBits KnownBits::udiv(const KnownBits &LHS, const KnownBits &RHS) {
|
KnownBits KnownBits::udiv(const KnownBits &LHS, const KnownBits &RHS) {
|
||||||
|
@ -17785,7 +17785,7 @@ void ARMTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
|
|||||||
else if (Op.getOpcode() == ARMISD::CSINV)
|
else if (Op.getOpcode() == ARMISD::CSINV)
|
||||||
std::swap(KnownOp1.Zero, KnownOp1.One);
|
std::swap(KnownOp1.Zero, KnownOp1.One);
|
||||||
else if (Op.getOpcode() == ARMISD::CSNEG)
|
else if (Op.getOpcode() == ARMISD::CSNEG)
|
||||||
KnownOp1 = KnownBits::computeForMul(
|
KnownOp1 = KnownBits::mul(
|
||||||
KnownOp1, KnownBits::makeConstant(APInt(32, -1)));
|
KnownOp1, KnownBits::makeConstant(APInt(32, -1)));
|
||||||
|
|
||||||
Known = KnownBits::commonBits(KnownOp0, KnownOp1);
|
Known = KnownBits::commonBits(KnownOp0, KnownOp1);
|
||||||
|
@ -34507,7 +34507,7 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
|
|||||||
|
|
||||||
Known = Known.trunc(BitWidth / 2).zext(BitWidth);
|
Known = Known.trunc(BitWidth / 2).zext(BitWidth);
|
||||||
Known2 = Known2.trunc(BitWidth / 2).zext(BitWidth);
|
Known2 = Known2.trunc(BitWidth / 2).zext(BitWidth);
|
||||||
Known = KnownBits::computeForMul(Known, Known2);
|
Known = KnownBits::mul(Known, Known2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case X86ISD::CMOV: {
|
case X86ISD::CMOV: {
|
||||||
|
@ -230,7 +230,7 @@ TEST(KnownBitsTest, BinaryExhaustive) {
|
|||||||
|
|
||||||
// The following are conservatively correct, but not guaranteed to be
|
// The following are conservatively correct, but not guaranteed to be
|
||||||
// precise.
|
// precise.
|
||||||
KnownBits ComputedMul = KnownBits::computeForMul(Known1, Known2);
|
KnownBits ComputedMul = KnownBits::mul(Known1, Known2);
|
||||||
EXPECT_TRUE(ComputedMul.Zero.isSubsetOf(KnownMul.Zero));
|
EXPECT_TRUE(ComputedMul.Zero.isSubsetOf(KnownMul.Zero));
|
||||||
EXPECT_TRUE(ComputedMul.One.isSubsetOf(KnownMul.One));
|
EXPECT_TRUE(ComputedMul.One.isSubsetOf(KnownMul.One));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user