Lines Matching full:other

14 // ranges (other integral ranges use min/max values for special range values):
244 const ConstantRange &Other) const {
245 if (isEmptySet() || Other.isEmptySet())
251 if (const APInt *R = Other.getSingleElement())
255 return inverse().contains(Other);
257 return getUnsignedMax().ult(Other.getUnsignedMin());
259 return getUnsignedMax().ule(Other.getUnsignedMin());
261 return getUnsignedMin().ugt(Other.getUnsignedMax());
263 return getUnsignedMin().uge(Other.getUnsignedMax());
265 return getSignedMax().slt(Other.getSignedMin());
267 return getSignedMax().sle(Other.getSignedMin());
269 return getSignedMin().sgt(Other.getSignedMax());
271 return getSignedMin().sge(Other.getSignedMax());
316 const ConstantRange &Other,
327 unsigned BitWidth = Other.getBitWidth();
335 return getNonEmpty(APInt::getZero(BitWidth), -Other.getUnsignedMax());
338 APInt SMin = Other.getSignedMin(), SMax = Other.getSignedMax();
346 return getNonEmpty(Other.getUnsignedMax(), APInt::getMinValue(BitWidth));
349 APInt SMin = Other.getSignedMin(), SMax = Other.getSignedMax();
357 return makeExactMulNUWRegion(Other.getUnsignedMax());
360 if (const APInt *C = Other.getSingleElement())
363 return makeExactMulNSWRegion(Other.getSignedMin())
364 .intersectWith(makeExactMulNSWRegion(Other.getSignedMax()));
369 ConstantRange ShAmt = Other.intersectWith(
390 const APInt &Other,
394 return makeGuaranteedNoWrapRegion(BinOp, ConstantRange(Other), NoWrapKind);
439 ConstantRange::isSizeStrictlySmallerThan(const ConstantRange &Other) const {
440 assert(getBitWidth() == Other.getBitWidth());
443 if (Other.isFullSet())
445 return (Upper - Lower).ult(Other.Upper - Other.Lower);
516 bool ConstantRange::contains(const ConstantRange &Other) const {
517 if (isFullSet() || Other.isEmptySet()) return true;
518 if (isEmptySet() || Other.isFullSet()) return false;
521 if (Other.isUpperWrapped())
524 return Lower.ule(Other.getLower()) && Other.getUpper().ule(Upper);
527 if (!Other.isUpperWrapped())
528 return Other.getUpper().ule(Upper) ||
529 Lower.ule(Other.getLower());
531 return Other.getUpper().ule(Upper) && Lower.ule(Other.getLower());
936 const ConstantRange &Other) const {
941 return add(Other);
943 return sub(Other);
945 return multiply(Other);
947 return udiv(Other);
949 return sdiv(Other);
951 return urem(Other);
953 return srem(Other);
955 return shl(Other);
957 return lshr(Other);
959 return ashr(Other);
961 return binaryAnd(Other);
963 return binaryOr(Other);
965 return binaryXor(Other);
969 return add(Other);
971 return sub(Other);
973 return multiply(Other);
981 const ConstantRange &Other,
987 return addWithNoWrap(Other, NoWrapKind);
989 return subWithNoWrap(Other, NoWrapKind);
991 return multiplyWithNoWrap(Other, NoWrapKind);
993 return shlWithNoWrap(Other, NoWrapKind);
997 return binaryOp(BinOp, Other);
1067 ConstantRange::add(const ConstantRange &Other) const {
1068 if (isEmptySet() || Other.isEmptySet())
1070 if (isFullSet() || Other.isFullSet())
1073 APInt NewLower = getLower() + Other.getLower();
1074 APInt NewUpper = getUpper() + Other.getUpper() - 1;
1080 X.isSizeStrictlySmallerThan(Other))
1086 ConstantRange ConstantRange::addWithNoWrap(const ConstantRange &Other,
1090 // (X is from this, and Y is from Other)
1091 if (isEmptySet() || Other.isEmptySet())
1093 if (isFullSet() && Other.isFullSet())
1097 ConstantRange Result = add(Other);
1105 Result = Result.intersectWith(sadd_sat(Other), RangeType);
1108 Result = Result.intersectWith(uadd_sat(Other), RangeType);
1114 ConstantRange::sub(const ConstantRange &Other) const {
1115 if (isEmptySet() || Other.isEmptySet())
1117 if (isFullSet() || Other.isFullSet())
1120 APInt NewLower = getLower() - Other.getUpper() + 1;
1121 APInt NewUpper = getUpper() - Other.getLower();
1127 X.isSizeStrictlySmallerThan(Other))
1133 ConstantRange ConstantRange::subWithNoWrap(const ConstantRange &Other,
1137 // (X is from this, and Y is from Other)
1138 if (isEmptySet() || Other.isEmptySet())
1140 if (isFullSet() && Other.isFullSet())
1144 ConstantRange Result = sub(Other);
1152 Result = Result.intersectWith(ssub_sat(Other), RangeType);
1155 if (getUnsignedMax().ult(Other.getUnsignedMin()))
1157 Result = Result.intersectWith(usub_sat(Other), RangeType);
1164 ConstantRange::multiply(const ConstantRange &Other) const {
1170 if (isEmptySet() || Other.isEmptySet())
1175 return Other;
1177 return ConstantRange(APInt::getZero(getBitWidth())).sub(Other);
1180 if (const APInt *C = Other.getSingleElement()) {
1190 // other. We calculate two ranges; one treating the inputs as unsigned
1191 // and the other signed, then return the smallest of these ranges.
1196 APInt Other_min = Other.getUnsignedMin().zext(getBitWidth() * 2);
1197 APInt Other_max = Other.getUnsignedMax().zext(getBitWidth() * 2);
1219 Other_min = Other.getSignedMin().sext(getBitWidth() * 2);
1220 Other_max = Other.getSignedMax().sext(getBitWidth() * 2);
1232 ConstantRange::multiplyWithNoWrap(const ConstantRange &Other,
1235 if (isEmptySet() || Other.isEmptySet())
1237 if (isFullSet() && Other.isFullSet())
1240 ConstantRange Result = multiply(Other);
1243 Result = Result.intersectWith(smul_sat(Other), RangeType);
1246 Result = Result.intersectWith(umul_sat(Other), RangeType);
1252 if (getSignedMin().sgt(1) || Other.getSignedMin().sgt(1))
1262 ConstantRange ConstantRange::smul_fast(const ConstantRange &Other) const {
1263 if (isEmptySet() || Other.isEmptySet())
1268 APInt OtherMin = Other.getSignedMin();
1269 APInt OtherMax = Other.getSignedMax();
1282 ConstantRange::smax(const ConstantRange &Other) const {
1285 if (isEmptySet() || Other.isEmptySet())
1287 APInt NewL = APIntOps::smax(getSignedMin(), Other.getSignedMin());
1288 APInt NewU = APIntOps::smax(getSignedMax(), Other.getSignedMax()) + 1;
1290 if (isSignWrappedSet() || Other.isSignWrappedSet())
1291 return Res.intersectWith(unionWith(Other, Signed), Signed);
1296 ConstantRange::umax(const ConstantRange &Other) const {
1299 if (isEmptySet() || Other.isEmptySet())
1301 APInt NewL = APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin());
1302 APInt NewU = APIntOps::umax(getUnsignedMax(), Other.getUnsignedMax()) + 1;
1304 if (isWrappedSet() || Other.isWrappedSet())
1305 return Res.intersectWith(unionWith(Other, Unsigned), Unsigned);
1310 ConstantRange::smin(const ConstantRange &Other) const {
1313 if (isEmptySet() || Other.isEmptySet())
1315 APInt NewL = APIntOps::smin(getSignedMin(), Other.getSignedMin());
1316 APInt NewU = APIntOps::smin(getSignedMax(), Other.getSignedMax()) + 1;
1318 if (isSignWrappedSet() || Other.isSignWrappedSet())
1319 return Res.intersectWith(unionWith(Other, Signed), Signed);
1324 ConstantRange::umin(const ConstantRange &Other) const {
1327 if (isEmptySet() || Other.isEmptySet())
1329 APInt NewL = APIntOps::umin(getUnsignedMin(), Other.getUnsignedMin());
1330 APInt NewU = APIntOps::umin(getUnsignedMax(), Other.getUnsignedMax()) + 1;
1332 if (isWrappedSet() || Other.isWrappedSet())
1333 return Res.intersectWith(unionWith(Other, Unsigned), Unsigned);
1580 ConstantRange ConstantRange::binaryAnd(const ConstantRange &Other) const {
1581 if (isEmptySet() || Other.isEmptySet())
1585 fromKnownBits(toKnownBits() & Other.toKnownBits(), false);
1586 auto LowerBound = estimateBitMaskedAndLowerBound(*this, Other);
1588 LowerBound, APIntOps::umin(Other.getUnsignedMax(), getUnsignedMax()) + 1);
1592 ConstantRange ConstantRange::binaryOr(const ConstantRange &Other) const {
1593 if (isEmptySet() || Other.isEmptySet())
1597 fromKnownBits(toKnownBits() | Other.toKnownBits(), false);
1605 -estimateBitMaskedAndLowerBound(binaryNot(), Other.binaryNot());
1608 APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin()), UpperBound);
1612 ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const {
1613 if (isEmptySet() || Other.isEmptySet())
1617 if (isSingleElement() && Other.isSingleElement())
1618 return {*getSingleElement() ^ *Other.getSingleElement()};
1621 if (Other.isSingleElement() && Other.getSingleElement()->isAllOnes())
1624 return Other.binaryNot();
1627 KnownBits RHSKnown = Other.toKnownBits();
1638 CR = CR.intersectWith(Other.sub(*this), PreferredRangeType::Unsigned);
1640 CR = CR.intersectWith(this->sub(Other), PreferredRangeType::Unsigned);
1645 ConstantRange::shl(const ConstantRange &Other) const {
1646 if (isEmptySet() || Other.isEmptySet())
1651 if (const APInt *RHS = Other.getSingleElement()) {
1664 APInt OtherMax = Other.getUnsignedMax();
1668 Max <<= Other.getUnsignedMin();
1677 // FIXME: implement the other tricky cases
1679 Min <<= Other.getUnsignedMin();
1766 ConstantRange ConstantRange::shlWithNoWrap(const ConstantRange &Other,
1769 if (isEmptySet() || Other.isEmptySet())
1774 return shl(Other);
1776 return computeShlNSW(*this, Other);
1778 return computeShlNUW(*this, Other);
1781 return computeShlNSW(*this, Other)
1782 .intersectWith(computeShlNUW(*this, Other), RangeType);
1789 ConstantRange::lshr(const ConstantRange &Other) const {
1790 if (isEmptySet() || Other.isEmptySet())
1793 APInt max = getUnsignedMax().lshr(Other.getUnsignedMin()) + 1;
1794 APInt min = getUnsignedMin().lshr(Other.getUnsignedMax());
1799 ConstantRange::ashr(const ConstantRange &Other) const {
1800 if (isEmptySet() || Other.isEmptySet())
1808 // the minimum value of 'Other' instead of the maximum value.
1809 APInt PosMax = getSignedMax().ashr(Other.getUnsignedMin()) + 1;
1815 // maximum value of 'Other'.
1816 APInt PosMin = getSignedMin().ashr(Other.getUnsignedMax());
1822 // maximum value of 'Other'.
1823 APInt NegMax = getSignedMax().ashr(Other.getUnsignedMax()) + 1;
1829 // minimum value of 'Other'.
1830 APInt NegMin = getSignedMin().ashr(Other.getUnsignedMin());
1849 ConstantRange ConstantRange::uadd_sat(const ConstantRange &Other) const {
1850 if (isEmptySet() || Other.isEmptySet())
1853 APInt NewL = getUnsignedMin().uadd_sat(Other.getUnsignedMin());
1854 APInt NewU = getUnsignedMax().uadd_sat(Other.getUnsignedMax()) + 1;
1858 ConstantRange ConstantRange::sadd_sat(const ConstantRange &Other) const {
1859 if (isEmptySet() || Other.isEmptySet())
1862 APInt NewL = getSignedMin().sadd_sat(Other.getSignedMin());
1863 APInt NewU = getSignedMax().sadd_sat(Other.getSignedMax()) + 1;
1867 ConstantRange ConstantRange::usub_sat(const ConstantRange &Other) const {
1868 if (isEmptySet() || Other.isEmptySet())
1871 APInt NewL = getUnsignedMin().usub_sat(Other.getUnsignedMax());
1872 APInt NewU = getUnsignedMax().usub_sat(Other.getUnsignedMin()) + 1;
1876 ConstantRange ConstantRange::ssub_sat(const ConstantRange &Other) const {
1877 if (isEmptySet() || Other.isEmptySet())
1880 APInt NewL = getSignedMin().ssub_sat(Other.getSignedMax());
1881 APInt NewU = getSignedMax().ssub_sat(Other.getSignedMin()) + 1;
1885 ConstantRange ConstantRange::umul_sat(const ConstantRange &Other) const {
1886 if (isEmptySet() || Other.isEmptySet())
1889 APInt NewL = getUnsignedMin().umul_sat(Other.getUnsignedMin());
1890 APInt NewU = getUnsignedMax().umul_sat(Other.getUnsignedMax()) + 1;
1894 ConstantRange ConstantRange::smul_sat(const ConstantRange &Other) const {
1895 if (isEmptySet() || Other.isEmptySet())
1906 APInt OtherMin = Other.getSignedMin();
1907 APInt OtherMax = Other.getSignedMax();
1915 ConstantRange ConstantRange::ushl_sat(const ConstantRange &Other) const {
1916 if (isEmptySet() || Other.isEmptySet())
1919 APInt NewL = getUnsignedMin().ushl_sat(Other.getUnsignedMin());
1920 APInt NewU = getUnsignedMax().ushl_sat(Other.getUnsignedMax()) + 1;
1924 ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const {
1925 if (isEmptySet() || Other.isEmptySet())
1929 APInt ShAmtMin = Other.getUnsignedMin(), ShAmtMax = Other.getUnsignedMax();
2138 const ConstantRange &Other) const {
2139 if (isEmptySet() || Other.isEmptySet())
2143 APInt OtherMin = Other.getUnsignedMin(), OtherMax = Other.getUnsignedMax();
2154 const ConstantRange &Other) const {
2155 if (isEmptySet() || Other.isEmptySet())
2159 APInt OtherMin = Other.getSignedMin(), OtherMax = Other.getSignedMax();
2184 const ConstantRange &Other) const {
2185 if (isEmptySet() || Other.isEmptySet())
2189 APInt OtherMin = Other.getUnsignedMin(), OtherMax = Other.getUnsignedMax();
2200 const ConstantRange &Other) const {
2201 if (isEmptySet() || Other.isEmptySet())
2205 APInt OtherMin = Other.getSignedMin(), OtherMax = Other.getSignedMax();
2230 const ConstantRange &Other) const {
2231 if (isEmptySet() || Other.isEmptySet())
2235 APInt OtherMin = Other.getUnsignedMin(), OtherMax = Other.getUnsignedMax();