Lines Matching full:lower
10 // for an integral value. This keeps track of a lower and upper bound for the
12 // keeps track of a [lower, upper) bound, which specifies an interval just like
45 : Lower(Full ? APInt::getMaxValue(BitWidth) : APInt::getMinValue(BitWidth)),
46 Upper(Lower) {}
49 : Lower(std::move(V)), Upper(Lower + 1) {}
52 : Lower(std::move(L)), Upper(std::move(U)) {
53 assert(Lower.getBitWidth() == Upper.getBitWidth() &&
55 assert((Lower != Upper || (Lower.isMaxValue() || Lower.isMinValue())) &&
56 "Lower == Upper, but they aren't min or max value!");
71 // If we don't know the sign bit, pick the lower bound as a negative number
73 APInt Lower = Known.getMinValue(), Upper = Known.getMaxValue();
74 Lower.setSignBit();
76 return ConstantRange(Lower, Upper + 1);
302 APInt Lower, Upper;
304 Lower = APIntOps::RoundingSDiv(MaxValue, V, APInt::Rounding::UP);
307 Lower = APIntOps::RoundingSDiv(MinValue, V, APInt::Rounding::UP);
310 return ConstantRange::getNonEmpty(Lower, Upper + 1);
414 return Lower == Upper && Lower.isMaxValue();
418 return Lower == Upper && Lower.isMinValue();
422 return Lower.ugt(Upper) && !Upper.isZero();
426 return Lower.ugt(Upper);
430 return Lower.sgt(Upper) && !Upper.isMinSignedValue();
434 return Lower.sgt(Upper);
444 return (Upper - Lower).ult(Other.Upper - Other.Lower);
454 return (Upper - Lower).ugt(MaxSize);
469 return !isSignWrappedSet() && Lower.isNonNegative();
479 return !isSignWrappedSet() && Lower.isStrictlyPositive();
507 if (Lower == Upper)
511 return Lower.ule(V) && V.ult(Upper);
512 return Lower.ule(V) || V.ult(Upper);
523 return Lower.ule(Other.getLower()) && Other.getUpper().ule(Upper);
528 Lower.ule(Other.getLower());
530 return Other.getUpper().ule(Upper) && Lower.ule(Other.getLower());
551 if (Lower == Upper)
553 return ConstantRange(Lower - Val, Upper - Val);
593 if (Lower.ult(CR.Lower)) {
596 if (Upper.ule(CR.Lower))
602 return ConstantRange(CR.Lower, Upper);
615 if (Lower.ult(CR.Upper))
616 return ConstantRange(Lower, CR.Upper);
624 if (CR.Lower.ult(Upper)) {
632 if (CR.Upper.ule(Lower))
633 return ConstantRange(CR.Lower, Upper);
639 if (CR.Lower.ult(Lower)) {
642 if (CR.Upper.ule(Lower))
647 return ConstantRange(Lower, CR.Upper);
658 if (CR.Lower.ult(Upper))
663 if (CR.Lower.ult(Lower))
664 return ConstantRange(Lower, CR.Upper);
670 if (CR.Upper.ule(Lower)) {
673 if (CR.Lower.ult(Lower))
678 return ConstantRange(CR.Lower, Upper);
703 if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower))
705 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
707 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
719 if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
724 if (CR.Lower.ule(Upper) && Lower.ule(CR.Upper))
732 if (Upper.ult(CR.Lower) && CR.Upper.ult(Lower))
734 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
738 if (Upper.ult(CR.Lower) && Lower.ule(CR.Upper))
739 return ConstantRange(CR.Lower, Upper);
743 assert(CR.Lower.ule(Upper) && CR.Upper.ult(Lower) &&
745 return ConstantRange(Lower, CR.Upper);
750 if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
753 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
837 LowerExt = Lower.zext(DstTySize);
842 return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));
853 return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize));
860 return ConstantRange(Lower.sext(DstTySize), Upper.sext(DstTySize));
870 APInt LowerDiv(Lower), UpperDiv(Upper);
873 // Analyze wrapped sets in their two parts: [0, Upper) \/ [Lower, MaxValue]
874 // We use the non-wrapped set code to analyze the [Lower, MaxValue) part, and
1209 // here, the lower bound is the smallest of the cartesian product of the
1210 // lower and upper ranges; for example:
1328 APInt Lower = getUnsignedMin().udiv(RHS.getUnsignedMax());
1341 return getNonEmpty(std::move(Lower), std::move(Upper));
1363 PosRes = ConstantRange(PosL.Lower.sdiv(PosR.Upper - 1),
1364 (PosL.Upper - 1).sdiv(PosR.Lower) + 1);
1373 APInt Lo = (NegL.Upper - 1).sdiv(NegR.Lower);
1374 if (NegL.Lower.isMinSignedValue() && NegR.Upper.isZero()) {
1377 if (!NegR.Lower.isAllOnes()) {
1379 if (RHS.Lower.isAllOnes())
1387 ConstantRange(Lo, NegL.Lower.sdiv(AdjNegRUpper - 1) + 1));
1396 AdjNegLLower = Lower;
1399 AdjNegLLower = NegL.Lower + 1;
1407 ConstantRange(std::move(Lo), NegL.Lower.sdiv(NegR.Upper - 1) + 1));
1415 PosL.Lower.sdiv(NegR.Lower) + 1);
1420 ConstantRange(NegL.Lower.sdiv(PosR.Lower),
1495 APInt Lower = APIntOps::umax(MinLHS, -MaxAbsRHS + 1);
1496 return ConstantRange(std::move(Lower), APInt(getBitWidth(), 1));
1500 APInt Lower = APIntOps::umax(MinLHS, -MaxAbsRHS + 1);
1502 return ConstantRange(std::move(Lower), std::move(Upper));
1630 // 'PosMin' is the lower bound of the result of the ashr
1631 // operation, when Lower of the LHS is a non-negative number.
1633 // number, the Lower value of LHS is shifted right with the
1644 // 'NegMin' is the lower bound of the result of the ashr
1645 // operation, when Lower of the LHS of ashr is a negative number.
1647 // number, the Lower value of LHS is shifted right with the
1653 // Upper and Lower of LHS are non-negative.
1657 // Upper and Lower of LHS are negative.
1661 // Upper is non-negative and Lower is negative.
1717 // Because we could be dealing with negative numbers here, the lower bound is
1718 // the smallest of the cartesian product of the lower and upper ranges;
1759 return ConstantRange(Upper, Lower);
1769 if (Upper.isStrictlyPositive() || !Lower.isStrictlyPositive())
1772 Lo = APIntOps::umin(Lower, -Upper + 1);
1812 // 1) Lower is zero, handling cases of kind [0, 1), [0, 2), etc.
1823 // Compute the resulting range by excluding zero from Lower.
1842 static ConstantRange getUnsignedCountTrailingZerosRange(const APInt &Lower,
1844 assert(!ConstantRange(Lower, Upper).isWrappedSet() &&
1846 assert(Lower != Upper && "Unexpected empty set.");
1847 unsigned BitWidth = Lower.getBitWidth();
1848 if (Lower + 1 == Upper)
1849 return ConstantRange(APInt(BitWidth, Lower.countr_zero()));
1850 if (Lower.isZero())
1855 unsigned LCPLength = (Lower ^ (Upper - 1)).countl_zero();
1856 // If Lower is {LCP, 000...}, the maximum is Lower.countr_zero().
1861 std::max(BitWidth - LCPLength - 1, Lower.countr_zero()) + 1));
1873 // 1) Lower is zero, handling cases of kind [0, 1), [0, 2), etc.
1877 if (Lower.isZero()) {
1884 // Compute the resulting range by excluding zero from Lower.
1888 return getUnsignedCountTrailingZerosRange(Lower, Zero);
1890 ConstantRange CR1 = getUnsignedCountTrailingZerosRange(Lower, Zero);
1900 return getUnsignedCountTrailingZerosRange(Lower, Upper);
1902 // [Lower, 0).
1903 // Handle [Lower, 0)
1904 ConstantRange CR1 = getUnsignedCountTrailingZerosRange(Lower, Zero);
1910 static ConstantRange getUnsignedPopCountRange(const APInt &Lower,
1912 assert(!ConstantRange(Lower, Upper).isWrappedSet() &&
1914 assert(Lower != Upper && "Unexpected empty set.");
1915 unsigned BitWidth = Lower.getBitWidth();
1916 if (Lower + 1 == Upper)
1917 return ConstantRange(APInt(BitWidth, Lower.popcount()));
1921 unsigned LCPLength = (Lower ^ Max).countl_zero();
1922 unsigned LCPPopCount = Lower.getHiBits(LCPLength).popcount();
1923 // If Lower is {LCP, 000...}, the minimum is the popcount of LCP.
1926 LCPPopCount + (Lower.countr_zero() < BitWidth - LCPLength ? 1 : 0);
1945 return getUnsignedPopCountRange(Lower, Upper);
1947 // [Lower, 0).
1948 // Handle [Lower, 0) == [Lower, Max]
1949 ConstantRange CR1 = ConstantRange(APInt(BitWidth, Lower.countl_one()),
2074 OS << "[" << Lower << "," << Upper << ")";