Lines Matching refs:BitWidth

93   assert(BitWidth && "Bitwidth too small");  in initFromArray()
110 : BitWidth(numBits) { in APInt()
115 : BitWidth(numBits) { in APInt()
120 : BitWidth(numbits) { in APInt()
121 assert(BitWidth && "Bitwidth too small"); in APInt()
128 BitWidth = NewBitWidth; in reallocate()
137 BitWidth = NewBitWidth; in reallocate()
161 ID.AddInteger(BitWidth); in Profile()
195 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator +=()
215 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); 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 *()
257 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *=()
277 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compare()
285 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compareSigned()
287 int64_t lhsSext = SignExtend64(U.VAL, BitWidth); in compareSigned()
288 int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth); in compareSigned()
341 assert(bitPosition < BitWidth && "Out of the bit-width range!"); in flipBit()
348 assert(0 < subBitWidth && (subBitWidth + bitPosition) <= BitWidth && in insertBits()
352 if (subBitWidth == BitWidth) { in insertBits()
407 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth && in extractBits()
512 return this->lshr(BitWidth - numBits); in getHiBits()
517 APInt Result(getLowBitsSet(BitWidth, numBits)); in getLoBits()
545 unsigned Mod = BitWidth % APINT_BITS_PER_WORD; in countLeadingZerosSlowCase()
551 unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD; in countLeadingOnesSlowCase()
581 return std::min(Count, BitWidth); in countTrailingZerosSlowCase()
591 assert(Count <= BitWidth); in countTrailingOnesSlowCase()
619 assert(BitWidth >= 16 && BitWidth % 16 == 0 && "Cannot byteswap!"); in byteSwap()
620 if (BitWidth == 16) in byteSwap()
621 return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL))); in byteSwap()
622 if (BitWidth == 32) in byteSwap()
623 return APInt(BitWidth, ByteSwap_32(unsigned(U.VAL))); in byteSwap()
624 if (BitWidth == 48) { in byteSwap()
629 return APInt(BitWidth, (uint64_t(Tmp2) << 32) | Tmp1); in byteSwap()
631 if (BitWidth == 64) in byteSwap()
632 return APInt(BitWidth, ByteSwap_64(U.VAL)); in byteSwap()
637 if (Result.BitWidth != BitWidth) { in byteSwap()
638 Result.lshrInPlace(Result.BitWidth - BitWidth); in byteSwap()
639 Result.BitWidth = BitWidth; in byteSwap()
645 switch (BitWidth) { in reverseBits()
647 return APInt(BitWidth, llvm::reverseBits<uint64_t>(U.VAL)); in reverseBits()
649 return APInt(BitWidth, llvm::reverseBits<uint32_t>(U.VAL)); in reverseBits()
651 return APInt(BitWidth, llvm::reverseBits<uint16_t>(U.VAL)); in reverseBits()
653 return APInt(BitWidth, llvm::reverseBits<uint8_t>(U.VAL)); in reverseBits()
659 APInt Reversed(BitWidth, 0); in reverseBits()
660 unsigned S = BitWidth; in reverseBits()
760 int64_t sext = SignExtend64(getWord(0), BitWidth); in roundToDouble()
767 bool isNeg = isSigned ? (*this)[BitWidth-1] : false; in roundToDouble()
812 assert(width < BitWidth && "Invalid APInt Truncate request"); in trunc()
835 assert(Width > BitWidth && "Invalid APInt SignExtend request"); in sext()
838 return APInt(Width, SignExtend64(U.VAL, BitWidth)); in sext()
848 ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in sext()
859 assert(width > BitWidth && "Invalid APInt ZeroExtend request"); in zext()
877 if (BitWidth < width) in zextOrTrunc()
879 if (BitWidth > width) in zextOrTrunc()
885 if (BitWidth < width) in sextOrTrunc()
887 if (BitWidth > width) in sextOrTrunc()
893 if (BitWidth < width) in zextOrSelf()
899 if (BitWidth < width) in sextOrSelf()
907 ashrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in ashrInPlace()
928 U.pVal[getNumWords() - 1], ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in ashrSlowCase()
956 lshrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in lshrInPlace()
969 *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth); in operator <<=()
979 static unsigned rotateModulo(unsigned BitWidth, const APInt &rotateAmt) { in rotateModulo() argument
982 if (rotBitWidth < BitWidth) { in rotateModulo()
985 rot = rotateAmt.zext(BitWidth); in rotateModulo()
987 rot = rot.urem(APInt(rot.getBitWidth(), BitWidth)); in rotateModulo()
988 return rot.getLimitedValue(BitWidth); in rotateModulo()
992 return rotl(rotateModulo(BitWidth, rotateAmt)); in rotl()
996 rotateAmt %= BitWidth; in rotl()
999 return shl(rotateAmt) | lshr(BitWidth - rotateAmt); in rotl()
1003 return rotr(rotateModulo(BitWidth, rotateAmt)); in rotr()
1007 rotateAmt %= BitWidth; in rotr()
1010 return lshr(rotateAmt) | shl(BitWidth - rotateAmt); in rotr()
1037 return APInt(BitWidth, results[ (isSingleWord() ? U.VAL : U.pVal[0]) ]); in sqrt()
1045 return APInt(BitWidth, in sqrt()
1055 unsigned nbits = BitWidth, i = 4; in sqrt()
1056 APInt testy(BitWidth, 16); in sqrt()
1057 APInt x_old(BitWidth, 1); in sqrt()
1058 APInt x_new(BitWidth, 0); in sqrt()
1059 APInt two(BitWidth, 2); in sqrt()
1111 APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) }; in multiplicativeInverse()
1112 APInt q(BitWidth, 0); in multiplicativeInverse()
1129 return APInt(BitWidth, 0); in multiplicativeInverse()
1521 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udiv()
1526 return APInt(BitWidth, U.VAL / RHS.U.VAL); in udiv()
1538 return APInt(BitWidth, 0); in udiv()
1544 return APInt(BitWidth, 0); in udiv()
1547 return APInt(BitWidth, 1); in udiv()
1550 return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]); in udiv()
1553 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1563 return APInt(BitWidth, U.VAL / RHS); in udiv()
1571 return APInt(BitWidth, 0); in udiv()
1577 return APInt(BitWidth, 0); in udiv()
1580 return APInt(BitWidth, 1); in udiv()
1583 return APInt(BitWidth, this->U.pVal[0] / RHS); in udiv()
1586 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1614 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in urem()
1617 return APInt(BitWidth, U.VAL % RHS.U.VAL); in urem()
1631 return APInt(BitWidth, 0); in urem()
1634 return APInt(BitWidth, 0); in urem()
1640 return APInt(BitWidth, 0); in urem()
1643 return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]); in urem()
1646 APInt Remainder(BitWidth, 0); in urem()
1707 assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udivrem()
1708 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1715 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1716 Remainder = APInt(BitWidth, RemVal); in udivrem()
1728 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1729 Remainder = APInt(BitWidth, 0); // 0 % Y ===> 0 in udivrem()
1735 Remainder = APInt(BitWidth, 0); // X % 1 ===> 0 in udivrem()
1740 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1745 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1746 Remainder = APInt(BitWidth, 0); // X % X ===> 0; in udivrem()
1754 Quotient.reallocate(BitWidth); in udivrem()
1755 Remainder.reallocate(BitWidth); in udivrem()
1771 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
1773 (getNumWords(BitWidth) - rhsWords) * APINT_WORD_SIZE); in udivrem()
1779 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1785 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1794 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1807 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1812 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1820 Quotient.reallocate(BitWidth); in udivrem()
1834 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
1930 return APInt(BitWidth, 0); in sshl_ov()
1943 return APInt(BitWidth, 0); in ushl_ov()
1956 return isNegative() ? APInt::getSignedMinValue(BitWidth) in sadd_sat()
1957 : APInt::getSignedMaxValue(BitWidth); in sadd_sat()
1966 return APInt::getMaxValue(BitWidth); in uadd_sat()
1975 return isNegative() ? APInt::getSignedMinValue(BitWidth) in ssub_sat()
1976 : APInt::getSignedMaxValue(BitWidth); in ssub_sat()
1985 return APInt(BitWidth, 0); in usub_sat()
2166 dbgs() << "APInt(" << BitWidth << "b, " in dump()