Lines Matching refs:RHS

144 void APInt::AssignSlowCase(const APInt& RHS) {  in AssignSlowCase()  argument
146 if (this == &RHS) in AssignSlowCase()
150 reallocate(RHS.getBitWidth()); in AssignSlowCase()
154 U.VAL = RHS.U.VAL; in AssignSlowCase()
156 memcpy(U.pVal, RHS.U.pVal, getNumWords() * APINT_WORD_SIZE); in AssignSlowCase()
194 APInt& APInt::operator+=(const APInt& RHS) { in operator +=() argument
195 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator +=()
197 U.VAL += RHS.U.VAL; in operator +=()
199 tcAdd(U.pVal, RHS.U.pVal, 0, getNumWords()); in operator +=()
203 APInt& APInt::operator+=(uint64_t RHS) { in operator +=() argument
205 U.VAL += RHS; in operator +=()
207 tcAddPart(U.pVal, RHS, getNumWords()); in operator +=()
214 APInt& APInt::operator-=(const APInt& RHS) { in operator -=() argument
215 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator -=()
217 U.VAL -= RHS.U.VAL; in operator -=()
219 tcSubtract(U.pVal, RHS.U.pVal, 0, getNumWords()); in operator -=()
223 APInt& APInt::operator-=(uint64_t RHS) { in operator -=() argument
225 U.VAL -= RHS; in operator -=()
227 tcSubtractPart(U.pVal, RHS, getNumWords()); in operator -=()
231 APInt APInt::operator*(const APInt& RHS) const { in operator *()
232 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *()
234 return APInt(BitWidth, U.VAL * RHS.U.VAL); in operator *()
238 tcMultiply(Result.U.pVal, U.pVal, RHS.U.pVal, getNumWords()); in operator *()
244 void APInt::AndAssignSlowCase(const APInt& RHS) { in AndAssignSlowCase() argument
245 tcAnd(U.pVal, RHS.U.pVal, getNumWords()); in AndAssignSlowCase()
248 void APInt::OrAssignSlowCase(const APInt& RHS) { in OrAssignSlowCase() argument
249 tcOr(U.pVal, RHS.U.pVal, getNumWords()); in OrAssignSlowCase()
252 void APInt::XorAssignSlowCase(const APInt& RHS) { in XorAssignSlowCase() argument
253 tcXor(U.pVal, RHS.U.pVal, getNumWords()); in XorAssignSlowCase()
256 APInt& APInt::operator*=(const APInt& RHS) { in operator *=() argument
257 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *=()
258 *this = *this * RHS; in operator *=()
262 APInt& APInt::operator*=(uint64_t RHS) { in operator *=() argument
264 U.VAL *= RHS; in operator *=()
267 tcMultiplyPart(U.pVal, U.pVal, RHS, 0, NumWords, NumWords, false); in operator *=()
272 bool APInt::EqualSlowCase(const APInt& RHS) const { in EqualSlowCase()
273 return std::equal(U.pVal, U.pVal + getNumWords(), RHS.U.pVal); in EqualSlowCase()
276 int APInt::compare(const APInt& RHS) const { in compare()
277 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compare()
279 return U.VAL < RHS.U.VAL ? -1 : U.VAL > RHS.U.VAL; in compare()
281 return tcCompare(U.pVal, RHS.U.pVal, getNumWords()); in compare()
284 int APInt::compareSigned(const APInt& RHS) const { in compareSigned()
285 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compareSigned()
288 int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth); in compareSigned()
293 bool rhsNeg = RHS.isNegative(); in compareSigned()
301 return tcCompare(U.pVal, RHS.U.pVal, getNumWords()); in compareSigned()
602 bool APInt::intersectsSlowCase(const APInt &RHS) const { in intersectsSlowCase()
604 if ((U.pVal[i] & RHS.U.pVal[i]) != 0) in intersectsSlowCase()
610 bool APInt::isSubsetOfSlowCase(const APInt &RHS) const { in isSubsetOfSlowCase()
612 if ((U.pVal[i] & ~RHS.U.pVal[i]) != 0) in isSubsetOfSlowCase()
1397 void APInt::divide(const WordType *LHS, unsigned lhsWords, const WordType *RHS, in divide() argument
1444 uint64_t tmp = RHS[i]; in divide()
1520 APInt APInt::udiv(const APInt &RHS) const { in udiv()
1521 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udiv()
1525 assert(RHS.U.VAL != 0 && "Divide by zero?"); in udiv()
1526 return APInt(BitWidth, U.VAL / RHS.U.VAL); in udiv()
1531 unsigned rhsBits = RHS.getActiveBits(); in udiv()
1542 if (lhsWords < rhsWords || this->ult(RHS)) in udiv()
1545 if (*this == RHS) in udiv()
1550 return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]); in udiv()
1554 divide(U.pVal, lhsWords, RHS.U.pVal, rhsWords, Quotient.U.pVal, nullptr); in udiv()
1558 APInt APInt::udiv(uint64_t RHS) const { in udiv()
1559 assert(RHS != 0 && "Divide by zero?"); in udiv()
1563 return APInt(BitWidth, U.VAL / RHS); in udiv()
1572 if (RHS == 1) in udiv()
1575 if (this->ult(RHS)) in udiv()
1578 if (*this == RHS) in udiv()
1583 return APInt(BitWidth, this->U.pVal[0] / RHS); in udiv()
1587 divide(U.pVal, lhsWords, &RHS, 1, Quotient.U.pVal, nullptr); in udiv()
1591 APInt APInt::sdiv(const APInt &RHS) const { in sdiv()
1593 if (RHS.isNegative()) in sdiv()
1594 return (-(*this)).udiv(-RHS); in sdiv()
1595 return -((-(*this)).udiv(RHS)); in sdiv()
1597 if (RHS.isNegative()) in sdiv()
1598 return -(this->udiv(-RHS)); in sdiv()
1599 return this->udiv(RHS); in sdiv()
1602 APInt APInt::sdiv(int64_t RHS) const { in sdiv()
1604 if (RHS < 0) in sdiv()
1605 return (-(*this)).udiv(-RHS); in sdiv()
1606 return -((-(*this)).udiv(RHS)); in sdiv()
1608 if (RHS < 0) in sdiv()
1609 return -(this->udiv(-RHS)); in sdiv()
1610 return this->udiv(RHS); in sdiv()
1613 APInt APInt::urem(const APInt &RHS) const { in urem()
1614 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in urem()
1616 assert(RHS.U.VAL != 0 && "Remainder by zero?"); in urem()
1617 return APInt(BitWidth, U.VAL % RHS.U.VAL); in urem()
1624 unsigned rhsBits = RHS.getActiveBits(); in urem()
1635 if (lhsWords < rhsWords || this->ult(RHS)) in urem()
1638 if (*this == RHS) in urem()
1643 return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]); in urem()
1647 divide(U.pVal, lhsWords, RHS.U.pVal, rhsWords, nullptr, Remainder.U.pVal); in urem()
1651 uint64_t APInt::urem(uint64_t RHS) const { in urem()
1652 assert(RHS != 0 && "Remainder by zero?"); in urem()
1655 return U.VAL % RHS; in urem()
1664 if (RHS == 1) in urem()
1667 if (this->ult(RHS)) in urem()
1670 if (*this == RHS) in urem()
1675 return U.pVal[0] % RHS; in urem()
1679 divide(U.pVal, lhsWords, &RHS, 1, nullptr, &Remainder); in urem()
1683 APInt APInt::srem(const APInt &RHS) const { in srem()
1685 if (RHS.isNegative()) in srem()
1686 return -((-(*this)).urem(-RHS)); in srem()
1687 return -((-(*this)).urem(RHS)); in srem()
1689 if (RHS.isNegative()) in srem()
1690 return this->urem(-RHS); in srem()
1691 return this->urem(RHS); in srem()
1694 int64_t APInt::srem(int64_t RHS) const { in srem()
1696 if (RHS < 0) in srem()
1697 return -((-(*this)).urem(-RHS)); in srem()
1698 return -((-(*this)).urem(RHS)); in srem()
1700 if (RHS < 0) in srem()
1701 return this->urem(-RHS); in srem()
1702 return this->urem(RHS); in srem()
1705 void APInt::udivrem(const APInt &LHS, const APInt &RHS, in udivrem() argument
1707 assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udivrem()
1712 assert(RHS.U.VAL != 0 && "Divide by zero?"); in udivrem()
1713 uint64_t QuotVal = LHS.U.VAL / RHS.U.VAL; in udivrem()
1714 uint64_t RemVal = LHS.U.VAL % RHS.U.VAL; in udivrem()
1722 unsigned rhsBits = RHS.getActiveBits(); in udivrem()
1738 if (lhsWords < rhsWords || LHS.ult(RHS)) { in udivrem()
1744 if (LHS == RHS) { in udivrem()
1760 uint64_t rhsValue = RHS.U.pVal[0]; in udivrem()
1767 divide(LHS.U.pVal, lhsWords, RHS.U.pVal, rhsWords, Quotient.U.pVal, in udivrem()
1776 void APInt::udivrem(const APInt &LHS, uint64_t RHS, APInt &Quotient, in udivrem() argument
1778 assert(RHS != 0 && "Divide by zero?"); in udivrem()
1783 uint64_t QuotVal = LHS.U.VAL / RHS; in udivrem()
1784 Remainder = LHS.U.VAL % RHS; in udivrem()
1799 if (RHS == 1) { in udivrem()
1805 if (LHS.ult(RHS)) { in udivrem()
1811 if (LHS == RHS) { in udivrem()
1825 Quotient = lhsValue / RHS; in udivrem()
1826 Remainder = lhsValue % RHS; in udivrem()
1831 divide(LHS.U.pVal, lhsWords, &RHS, 1, Quotient.U.pVal, &Remainder); in udivrem()
1837 void APInt::sdivrem(const APInt &LHS, const APInt &RHS, in sdivrem() argument
1840 if (RHS.isNegative()) in sdivrem()
1841 APInt::udivrem(-LHS, -RHS, Quotient, Remainder); in sdivrem()
1843 APInt::udivrem(-LHS, RHS, Quotient, Remainder); in sdivrem()
1847 } else if (RHS.isNegative()) { in sdivrem()
1848 APInt::udivrem(LHS, -RHS, Quotient, Remainder); in sdivrem()
1851 APInt::udivrem(LHS, RHS, Quotient, Remainder); in sdivrem()
1855 void APInt::sdivrem(const APInt &LHS, int64_t RHS, in sdivrem() argument
1859 if (RHS < 0) in sdivrem()
1860 APInt::udivrem(-LHS, -RHS, Quotient, R); in sdivrem()
1862 APInt::udivrem(-LHS, RHS, Quotient, R); in sdivrem()
1866 } else if (RHS < 0) { in sdivrem()
1867 APInt::udivrem(LHS, -RHS, Quotient, R); in sdivrem()
1870 APInt::udivrem(LHS, RHS, Quotient, R); in sdivrem()
1875 APInt APInt::sadd_ov(const APInt &RHS, bool &Overflow) const { in sadd_ov() argument
1876 APInt Res = *this+RHS; in sadd_ov()
1877 Overflow = isNonNegative() == RHS.isNonNegative() && in sadd_ov()
1882 APInt APInt::uadd_ov(const APInt &RHS, bool &Overflow) const { in uadd_ov() argument
1883 APInt Res = *this+RHS; in uadd_ov()
1884 Overflow = Res.ult(RHS); in uadd_ov()
1888 APInt APInt::ssub_ov(const APInt &RHS, bool &Overflow) const { in ssub_ov() argument
1889 APInt Res = *this - RHS; in ssub_ov()
1890 Overflow = isNonNegative() != RHS.isNonNegative() && in ssub_ov()
1895 APInt APInt::usub_ov(const APInt &RHS, bool &Overflow) const { in usub_ov() argument
1896 APInt Res = *this-RHS; in usub_ov()
1901 APInt APInt::sdiv_ov(const APInt &RHS, bool &Overflow) const { in sdiv_ov() argument
1903 Overflow = isMinSignedValue() && RHS.isAllOnesValue(); in sdiv_ov()
1904 return sdiv(RHS); in sdiv_ov()
1907 APInt APInt::smul_ov(const APInt &RHS, bool &Overflow) const { in smul_ov() argument
1908 APInt Res = *this * RHS; in smul_ov()
1910 if (*this != 0 && RHS != 0) in smul_ov()
1911 Overflow = Res.sdiv(RHS) != *this || Res.sdiv(*this) != RHS; in smul_ov()
1917 APInt APInt::umul_ov(const APInt &RHS, bool &Overflow) const { in umul_ov() argument
1918 APInt Res = *this * RHS; in umul_ov()
1920 if (*this != 0 && RHS != 0) in umul_ov()
1921 Overflow = Res.udiv(RHS) != *this || Res.udiv(*this) != RHS; in umul_ov()
1950 APInt APInt::sadd_sat(const APInt &RHS) const { in sadd_sat()
1952 APInt Res = sadd_ov(RHS, Overflow); in sadd_sat()
1960 APInt APInt::uadd_sat(const APInt &RHS) const { in uadd_sat()
1962 APInt Res = uadd_ov(RHS, Overflow); in uadd_sat()
1969 APInt APInt::ssub_sat(const APInt &RHS) const { in ssub_sat()
1971 APInt Res = ssub_ov(RHS, Overflow); in ssub_sat()
1979 APInt APInt::usub_sat(const APInt &RHS) const { in usub_sat()
1981 APInt Res = usub_ov(RHS, Overflow); in usub_sat()