Go to the documentation of this file.
23 APInt AD, ANC, Delta, Q1, R1, Q2,
R2,
T;
28 T = SignedMin + (
D.lshr(
D.getBitWidth() - 1));
29 ANC =
T - 1 -
T.urem(AD);
30 P =
D.getBitWidth() - 1;
31 Q1 = SignedMin.
udiv(ANC);
32 R1 = SignedMin - Q1 * ANC;
33 Q2 = SignedMin.
udiv(AD);
34 R2 = SignedMin - Q2 * AD;
50 }
while (Q1.
ult(Delta) || (Q1 == Delta && R1 == 0));
52 Retval.
Magic = Q2 + 1;
75 NC = AllOnes - (AllOnes -
D).urem(
D);
76 P =
D.getBitWidth() - 1;
78 R1 = SignedMin - Q1 *
NC;
79 Q2 = SignedMax.
udiv(
D);
80 R2 = SignedMax - Q2 *
D;
83 if (R1.
uge(
NC - R1)) {
90 if ((
R2 + 1).uge(
D -
R2)) {
91 if (Q2.
uge(SignedMax))
96 if (Q2.
uge(SignedMin))
102 }
while (
P <
D.getBitWidth() * 2 &&
103 (Q1.
ult(Delta) || (Q1 == Delta && R1 == 0)));
104 Retval.
Magic = Q2 + 1;
This is an optimization pass for GlobalISel generic memory operations.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
static UnsignedDivisonByConstantInfo get(const APInt &D, unsigned LeadingZeros=0)
Calculate the magic numbers required to implement an unsigned integer division by a constant as a seq...
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
unsigned ShiftAmount
shift amount
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
unsigned ShiftAmount
shift amount
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static SignedDivisionByConstantInfo get(const APInt &D)
Calculate the magic numbers required to implement a signed integer division by a constant as a sequen...
Class for arbitrary precision integers.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
APInt udiv(const APInt &RHS) const
Unsigned division operation.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
Magic data for optimising unsigned division by a constant.
Magic data for optimising signed division by a constant.