Lines Matching refs:BitWidth

105 APInt::APInt(unsigned numBits, ArrayRef<uint64_t> bigVal) : BitWidth(numBits) {  in APInt()
110 : BitWidth(numBits) { in APInt()
115 : BitWidth(numbits) { in APInt()
122 BitWidth = NewBitWidth; in reallocate()
131 BitWidth = NewBitWidth; in reallocate()
155 ID.AddInteger(BitWidth); in Profile()
189 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator +=()
209 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator -=()
226 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in operator *()
228 return APInt(BitWidth, U.VAL * RHS.U.VAL); in operator *()
274 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compare()
282 assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"); in compareSigned()
284 int64_t lhsSext = SignExtend64(U.VAL, BitWidth); in compareSigned()
285 int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth); in compareSigned()
355 assert(bitPosition < BitWidth && "Out of the bit-width range!"); in flipBit()
361 assert((subBitWidth + bitPosition) <= BitWidth && "Illegal bit insertion"); in insertBits()
368 if (subBitWidth == BitWidth) { in insertBits()
445 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth && in extractBits()
483 assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth && in extractBitsAsZExtValue()
580 return hash_combine(Arg.BitWidth, Arg.U.VAL); in hash_value()
583 Arg.BitWidth, in hash_value()
601 return this->lshr(BitWidth - numBits); in getHiBits()
606 APInt Result(getLowBitsSet(BitWidth, numBits)); in getLoBits()
634 unsigned Mod = BitWidth % APINT_BITS_PER_WORD; in countLeadingZerosSlowCase()
640 unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD; in countLeadingOnesSlowCase()
670 return std::min(Count, BitWidth); in countTrailingZerosSlowCase()
680 assert(Count <= BitWidth); in countTrailingOnesSlowCase()
708 assert(BitWidth >= 16 && BitWidth % 8 == 0 && "Cannot byteswap!"); in byteSwap()
709 if (BitWidth == 16) in byteSwap()
710 return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL))); in byteSwap()
711 if (BitWidth == 32) in byteSwap()
712 return APInt(BitWidth, ByteSwap_32(unsigned(U.VAL))); in byteSwap()
713 if (BitWidth <= 64) { in byteSwap()
715 Tmp1 >>= (64 - BitWidth); in byteSwap()
716 return APInt(BitWidth, Tmp1); in byteSwap()
722 if (Result.BitWidth != BitWidth) { in byteSwap()
723 Result.lshrInPlace(Result.BitWidth - BitWidth); in byteSwap()
724 Result.BitWidth = BitWidth; in byteSwap()
730 switch (BitWidth) { in reverseBits()
732 return APInt(BitWidth, llvm::reverseBits<uint64_t>(U.VAL)); in reverseBits()
734 return APInt(BitWidth, llvm::reverseBits<uint32_t>(U.VAL)); in reverseBits()
736 return APInt(BitWidth, llvm::reverseBits<uint16_t>(U.VAL)); in reverseBits()
738 return APInt(BitWidth, llvm::reverseBits<uint8_t>(U.VAL)); in reverseBits()
746 APInt Reversed(BitWidth, 0); in reverseBits()
747 unsigned S = BitWidth; in reverseBits()
847 int64_t sext = SignExtend64(getWord(0), BitWidth); in roundToDouble()
854 bool isNeg = isSigned ? (*this)[BitWidth-1] : false; in roundToDouble()
899 assert(width <= BitWidth && "Invalid APInt Truncate request"); in trunc()
904 if (width == BitWidth) in trunc()
924 assert(width <= BitWidth && "Invalid APInt Truncate request"); in truncUSat()
935 assert(width <= BitWidth && "Invalid APInt Truncate request"); in truncSSat()
947 assert(Width >= BitWidth && "Invalid APInt SignExtend request"); in sext()
950 return APInt(Width, SignExtend64(U.VAL, BitWidth)); in sext()
952 if (Width == BitWidth) in sext()
963 ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in sext()
974 assert(width >= BitWidth && "Invalid APInt ZeroExtend request"); in zext()
979 if (width == BitWidth) in zext()
995 if (BitWidth < width) in zextOrTrunc()
997 if (BitWidth > width) in zextOrTrunc()
1003 if (BitWidth < width) in sextOrTrunc()
1005 if (BitWidth > width) in sextOrTrunc()
1013 ashrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in ashrInPlace()
1034 U.pVal[getNumWords() - 1], ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1); in ashrSlowCase()
1062 lshrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth)); in lshrInPlace()
1075 *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth); in operator <<=()
1085 static unsigned rotateModulo(unsigned BitWidth, const APInt &rotateAmt) { in rotateModulo() argument
1086 if (LLVM_UNLIKELY(BitWidth == 0)) in rotateModulo()
1090 if (rotBitWidth < BitWidth) { in rotateModulo()
1093 rot = rotateAmt.zext(BitWidth); in rotateModulo()
1095 rot = rot.urem(APInt(rot.getBitWidth(), BitWidth)); in rotateModulo()
1096 return rot.getLimitedValue(BitWidth); in rotateModulo()
1100 return rotl(rotateModulo(BitWidth, rotateAmt)); in rotl()
1104 if (LLVM_UNLIKELY(BitWidth == 0)) in rotl()
1106 rotateAmt %= BitWidth; in rotl()
1109 return shl(rotateAmt) | lshr(BitWidth - rotateAmt); in rotl()
1113 return rotr(rotateModulo(BitWidth, rotateAmt)); in rotr()
1117 if (BitWidth == 0) in rotr()
1119 rotateAmt %= BitWidth; in rotr()
1122 return lshr(rotateAmt) | shl(BitWidth - rotateAmt); in rotr()
1138 if (BitWidth == 1) in nearestLogBase2()
1178 return APInt(BitWidth, results[ (isSingleWord() ? U.VAL : U.pVal[0]) ]); in sqrt()
1186 return APInt(BitWidth, in sqrt()
1196 unsigned nbits = BitWidth, i = 4; in sqrt()
1197 APInt testy(BitWidth, 16); in sqrt()
1198 APInt x_old(BitWidth, 1); in sqrt()
1199 APInt x_new(BitWidth, 0); in sqrt()
1200 APInt two(BitWidth, 2); in sqrt()
1254 APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) }; in multiplicativeInverse()
1255 APInt q(BitWidth, 0); in multiplicativeInverse()
1272 return APInt(BitWidth, 0); in multiplicativeInverse()
1572 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udiv()
1577 return APInt(BitWidth, U.VAL / RHS.U.VAL); in udiv()
1589 return APInt(BitWidth, 0); in udiv()
1595 return APInt(BitWidth, 0); in udiv()
1598 return APInt(BitWidth, 1); in udiv()
1601 return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]); in udiv()
1604 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1614 return APInt(BitWidth, U.VAL / RHS); in udiv()
1622 return APInt(BitWidth, 0); in udiv()
1628 return APInt(BitWidth, 0); in udiv()
1631 return APInt(BitWidth, 1); in udiv()
1634 return APInt(BitWidth, this->U.pVal[0] / RHS); in udiv()
1637 APInt Quotient(BitWidth, 0); // to hold result. in udiv()
1665 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); in urem()
1668 return APInt(BitWidth, U.VAL % RHS.U.VAL); in urem()
1682 return APInt(BitWidth, 0); in urem()
1685 return APInt(BitWidth, 0); in urem()
1691 return APInt(BitWidth, 0); in urem()
1694 return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]); in urem()
1697 APInt Remainder(BitWidth, 0); in urem()
1758 assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same"); in udivrem()
1759 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1766 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1767 Remainder = APInt(BitWidth, RemVal); in udivrem()
1779 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1780 Remainder = APInt(BitWidth, 0); // 0 % Y ===> 0 in udivrem()
1786 Remainder = APInt(BitWidth, 0); // X % 1 ===> 0 in udivrem()
1791 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1796 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1797 Remainder = APInt(BitWidth, 0); // X % X ===> 0; in udivrem()
1805 Quotient.reallocate(BitWidth); in udivrem()
1806 Remainder.reallocate(BitWidth); in udivrem()
1822 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
1824 (getNumWords(BitWidth) - rhsWords) * APINT_WORD_SIZE); in udivrem()
1830 unsigned BitWidth = LHS.BitWidth; in udivrem() local
1836 Quotient = APInt(BitWidth, QuotVal); in udivrem()
1845 Quotient = APInt(BitWidth, 0); // 0 / Y ===> 0 in udivrem()
1858 Quotient = APInt(BitWidth, 0); // X / Y ===> 0, iff X < Y in udivrem()
1863 Quotient = APInt(BitWidth, 1); // X / X ===> 1 in udivrem()
1871 Quotient.reallocate(BitWidth); in udivrem()
1885 (getNumWords(BitWidth) - lhsWords) * APINT_WORD_SIZE); in udivrem()
1970 if (countLeadingZeros() + RHS.countLeadingZeros() + 2 <= BitWidth) { in umul_ov()
1989 return APInt(BitWidth, 0); in sshl_ov()
2002 return APInt(BitWidth, 0); in ushl_ov()
2015 return isNegative() ? APInt::getSignedMinValue(BitWidth) in sadd_sat()
2016 : APInt::getSignedMaxValue(BitWidth); in sadd_sat()
2025 return APInt::getMaxValue(BitWidth); in uadd_sat()
2034 return isNegative() ? APInt::getSignedMinValue(BitWidth) in ssub_sat()
2035 : APInt::getSignedMaxValue(BitWidth); in ssub_sat()
2044 return APInt(BitWidth, 0); in usub_sat()
2056 return ResIsNegative ? APInt::getSignedMinValue(BitWidth) in smul_sat()
2057 : APInt::getSignedMaxValue(BitWidth); in smul_sat()
2066 return APInt::getMaxValue(BitWidth); in umul_sat()
2075 return isNegative() ? APInt::getSignedMinValue(BitWidth) in sshl_sat()
2076 : APInt::getSignedMaxValue(BitWidth); in sshl_sat()
2085 return APInt::getMaxValue(BitWidth); in ushl_sat()
2257 dbgs() << "APInt(" << BitWidth << "b, " in dump()