Home | History | Annotate | Download | only in Scalar

Lines Matching full:bitwidth

331 /// CarmichaelShift - Returns k such that lambda(2^Bitwidth) = 2^k, where lambda
332 /// is the Carmichael function. This means that x^(2^k) === 1 mod 2^Bitwidth for
333 /// every odd x, i.e. x^(2^k) = 1 for every odd x in Bitwidth-bit arithmetic.
334 /// Note that 0 <= k < Bitwidth, and if Bitwidth > 3 then x^(2^k) = 0 for every
335 /// even x in Bitwidth-bit arithmetic.
336 static unsigned CarmichaelShift(unsigned Bitwidth) {
337 if (Bitwidth < 3)
338 return Bitwidth - 1;
339 return Bitwidth - 2;
387 unsigned Bitwidth = LHS.getBitWidth();
388 // If CM is the Carmichael number then a weight W satisfying W >= CM+Bitwidth
389 // can be replaced with W-CM. That's because x^W=x^(W-CM) for every Bitwidth
392 // of CM like this weights can always be reduced to the range [0, CM+Bitwidth)
394 // Bitwidth bits.
397 if (Bitwidth > 3) {
399 APInt CM = APInt::getOneBitSet(Bitwidth, CarmichaelShift(Bitwidth));
401 APInt Threshold = CM + Bitwidth;
403 // For Bitwidth 4 or more the following sum does not overflow.
410 unsigned CM = 1U << CarmichaelShift(Bitwidth);
411 unsigned Threshold = CM + Bitwidth;
500 unsigned Bitwidth = I->getType()->getScalarType()->getPrimitiveSizeInBits();
517 Worklist.push_back(std::make_pair(I, APInt(Bitwidth, 1)));
660 // because the expression was "X xor X" or consisted of 2^Bitwidth additions:
665 Ops.push_back(std::make_pair(Identity, APInt(Bitwidth, 1)));