Initial commit of LLVM 3.4

This commit is contained in:
Pascal Junod
2014-01-07 11:45:01 +01:00
parent 569cee53d0
commit 0c32ada97e
10493 changed files with 713743 additions and 208975 deletions
+21 -41
View File
@@ -692,14 +692,14 @@ unsigned APInt::countLeadingZerosSlowCase() const {
unsigned i = getNumWords();
integerPart MSW = pVal[i-1] & MSWMask;
if (MSW)
return CountLeadingZeros_64(MSW) - (APINT_BITS_PER_WORD - BitsInMSW);
return llvm::countLeadingZeros(MSW) - (APINT_BITS_PER_WORD - BitsInMSW);
unsigned Count = BitsInMSW;
for (--i; i > 0u; --i) {
if (pVal[i-1] == 0)
Count += APINT_BITS_PER_WORD;
else {
Count += CountLeadingZeros_64(pVal[i-1]);
Count += llvm::countLeadingZeros(pVal[i-1]);
break;
}
}
@@ -735,13 +735,13 @@ unsigned APInt::countLeadingOnes() const {
unsigned APInt::countTrailingZeros() const {
if (isSingleWord())
return std::min(unsigned(CountTrailingZeros_64(VAL)), BitWidth);
return std::min(unsigned(llvm::countTrailingZeros(VAL)), BitWidth);
unsigned Count = 0;
unsigned i = 0;
for (; i < getNumWords() && pVal[i] == 0; ++i)
Count += APINT_BITS_PER_WORD;
if (i < getNumWords())
Count += CountTrailingZeros_64(pVal[i]);
Count += llvm::countTrailingZeros(pVal[i]);
return std::min(Count, BitWidth);
}
@@ -1512,7 +1512,7 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r,
// and v so that its high bits are shifted to the top of v's range without
// overflow. Note that this can require an extra word in u so that u must
// be of length m+n+1.
unsigned shift = CountLeadingZeros_32(v[n-1]);
unsigned shift = countLeadingZeros(v[n-1]);
unsigned v_carry = 0;
unsigned u_carry = 0;
if (shift) {
@@ -2304,24 +2304,7 @@ namespace {
static unsigned int
partMSB(integerPart value)
{
unsigned int n, msb;
if (value == 0)
return -1U;
n = integerPartWidth / 2;
msb = 0;
do {
if (value >> n) {
value >>= n;
msb += n;
}
n >>= 1;
} while (n);
return msb;
return findLastSet(value, ZB_Max);
}
/* Returns the bit number of the least significant set bit of a
@@ -2329,24 +2312,7 @@ namespace {
static unsigned int
partLSB(integerPart value)
{
unsigned int n, lsb;
if (value == 0)
return -1U;
lsb = integerPartWidth - 1;
n = integerPartWidth / 2;
do {
if (value << n) {
value <<= n;
lsb -= n;
}
n >>= 1;
} while (n);
return lsb;
return findFirstSet(value, ZB_Max);
}
}
@@ -2888,6 +2854,20 @@ APInt::tcIncrement(integerPart *dst, unsigned int parts)
return i == parts;
}
/* Decrement a bignum in-place, return the borrow flag. */
integerPart
APInt::tcDecrement(integerPart *dst, unsigned int parts) {
for (unsigned int i = 0; i < parts; i++) {
// If the current word is non-zero, then the decrement has no effect on the
// higher-order words of the integer and no borrow can occur. Exit early.
if (dst[i]--)
return 0;
}
// If every word was zero, then there is a borrow.
return 1;
}
/* Set the least significant BITS bits of a bignum, clear the
rest. */
void