Lines Matching full:upper
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
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!");
72 // and the upper bound as a non-negative one.
73 APInt Lower = Known.getMinValue(), Upper = Known.getMaxValue();
75 Upper.clearSignBit();
76 return ConstantRange(Lower, Upper + 1);
302 APInt Lower, Upper;
305 Upper = APIntOps::RoundingSDiv(MinValue, V, APInt::Rounding::DOWN);
308 Upper = APIntOps::RoundingSDiv(MaxValue, V, APInt::Rounding::DOWN);
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);
464 return !isUpperSignWrapped() && !Upper.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);
527 return Other.getUpper().ule(Upper) ||
530 return Other.getUpper().ule(Upper) && Lower.ule(Other.getLower());
551 if (Lower == Upper)
553 return ConstantRange(Lower - Val, Upper - Val);
596 if (Upper.ule(CR.Lower))
601 if (Upper.ult(CR.Upper))
602 return ConstantRange(CR.Lower, Upper);
610 if (Upper.ult(CR.Upper))
615 if (Lower.ult(CR.Upper))
616 return ConstantRange(Lower, CR.Upper);
624 if (CR.Lower.ult(Upper)) {
627 if (CR.Upper.ult(Upper))
632 if (CR.Upper.ule(Lower))
633 return ConstantRange(CR.Lower, Upper);
642 if (CR.Upper.ule(Lower))
647 return ConstantRange(Lower, CR.Upper);
655 if (CR.Upper.ult(Upper)) {
658 if (CR.Lower.ult(Upper))
664 return ConstantRange(Lower, CR.Upper);
670 if (CR.Upper.ule(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);
708 APInt U = (CR.Upper - 1).ugt(Upper - 1) ? CR.Upper : Upper;
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))
754 APInt U = CR.Upper.ugt(Upper) ? CR.Upper : Upper;
836 if (!Upper) // special case: [X, 0) -- not really wrapping around
842 return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));
852 if (Upper.isMinSignedValue())
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]
875 // then we do the union with [MaxValue, Upper)
877 // If Upper is greater than or equal to MaxValue(DstTy), it covers the whole
879 if (Upper.getActiveBits() > DstTySize || Upper.countr_one() == DstTySize)
882 Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize));
1210 // lower and upper ranges; for example:
1212 // Similarly for the upper bound, swapping min for max.
1340 APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
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()) {
1381 AdjNegRUpper = RHS.Upper;
1384 AdjNegRUpper = NegR.Upper - 1;
1392 if (NegL.Upper != SignedMin + 1) {
1394 if (Upper == SignedMin + 1)
1403 AdjNegLLower.sdiv(NegR.Upper - 1) + 1));
1407 ConstantRange(std::move(Lo), NegL.Lower.sdiv(NegR.Upper - 1) + 1));
1414 NegRes = ConstantRange((PosL.Upper - 1).sdiv(NegR.Upper - 1),
1421 (NegL.Upper - 1).sdiv(PosR.Upper - 1) + 1));
1450 APInt Upper = APIntOps::umin(getUnsignedMax(), RHS.getUnsignedMax() - 1) + 1;
1451 return getNonEmpty(APInt::getZero(getBitWidth()), std::move(Upper));
1486 APInt Upper = APIntOps::umin(MaxLHS, MaxAbsRHS - 1) + 1;
1487 return ConstantRange(APInt::getZero(getBitWidth()), std::move(Upper));
1501 APInt Upper = APIntOps::umin(MaxLHS, MaxAbsRHS - 1) + 1;
1502 return ConstantRange(std::move(Lower), std::move(Upper));
1527 // Upper wrapped range.
1623 // 'PosMax' is the upper bound of the result of the ashr
1624 // operation, when Upper of the LHS of ashr is a non-negative.
1626 // smaller number, the Upper value of LHS is shifted right with
1637 // 'NegMax' is the upper bound of the result of the ashr
1638 // operation, when Upper of the LHS of ashr is a negative number.
1640 // number, the Upper 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.
1718 // the smallest of the cartesian product of the lower and upper ranges;
1721 // Similarly for the upper bound, swapping min for max.
1759 return ConstantRange(Upper, Lower);
1769 if (Upper.isStrictlyPositive() || !Lower.isStrictlyPositive())
1772 Lo = APIntOps::umin(Lower, -Upper + 1);
1813 // 2) Upper is zero, wrapped set, handling cases of kind [3, 0], etc.
1828 // Compute the resulting range by excluding zero from Upper.
1843 const APInt &Upper) {
1844 assert(!ConstantRange(Lower, Upper).isWrappedSet() &&
1846 assert(Lower != Upper && "Unexpected empty set.");
1848 if (Lower + 1 == Upper)
1855 unsigned LCPLength = (Lower ^ (Upper - 1)).countl_zero();
1874 // 2) Upper is zero, wrapped set, handling cases of kind [3, 0], etc.
1878 if (Upper == 1) {
1885 return getUnsignedCountTrailingZerosRange(APInt(BitWidth, 1), Upper);
1886 } else if (Upper == 1) {
1887 // Compute the resulting range by excluding zero from Upper.
1892 getUnsignedCountTrailingZerosRange(APInt(BitWidth, 1), Upper);
1900 return getUnsignedCountTrailingZerosRange(Lower, Upper);
1901 // The range is wrapped. We decompose it into two ranges, [0, Upper) and
1905 // Handle [0, Upper)
1906 ConstantRange CR2 = getUnsignedCountTrailingZerosRange(Zero, Upper);
1911 const APInt &Upper) {
1912 assert(!ConstantRange(Lower, Upper).isWrappedSet() &&
1914 assert(Lower != Upper && "Unexpected empty set.");
1916 if (Lower + 1 == Upper)
1919 APInt Max = Upper - 1;
1945 return getUnsignedPopCountRange(Lower, Upper);
1946 // The range is wrapped. We decompose it into two ranges, [0, Upper) and
1951 // Handle [0, Upper)
1952 ConstantRange CR2 = getUnsignedPopCountRange(Zero, Upper);
2074 OS << "[" << Lower << "," << Upper << ")";