Lines Matching refs:Bitwidth
400 /// CarmichaelShift - Returns k such that lambda(2^Bitwidth) = 2^k, where lambda
401 /// is the Carmichael function. This means that x^(2^k) === 1 mod 2^Bitwidth for
402 /// every odd x, i.e. x^(2^k) = 1 for every odd x in Bitwidth-bit arithmetic.
403 /// Note that 0 <= k < Bitwidth, and if Bitwidth > 3 then x^(2^k) = 0 for every
404 /// even x in Bitwidth-bit arithmetic.
405 static unsigned CarmichaelShift(unsigned Bitwidth) {
406 if (Bitwidth < 3)
407 return Bitwidth - 1;
408 return Bitwidth - 2;
457 unsigned Bitwidth = LHS.getBitWidth();
458 // If CM is the Carmichael number then a weight W satisfying W >= CM+Bitwidth
459 // can be replaced with W-CM. That's because x^W=x^(W-CM) for every Bitwidth
462 // of CM like this weights can always be reduced to the range [0, CM+Bitwidth)
464 // Bitwidth bits.
467 if (Bitwidth > 3) {
469 APInt CM = APInt::getOneBitSet(Bitwidth, CarmichaelShift(Bitwidth));
471 APInt Threshold = CM + Bitwidth;
473 // For Bitwidth 4 or more the following sum does not overflow.
480 unsigned CM = 1U << CarmichaelShift(Bitwidth);
481 unsigned Threshold = CM + Bitwidth;
570 unsigned Bitwidth = I->getType()->getScalarType()->getPrimitiveSizeInBits();
586 Worklist.push_back(std::make_pair(I, APInt(Bitwidth, 1)));
732 // because the expression was "X xor X" or consisted of 2^Bitwidth additions:
737 Ops.push_back(std::make_pair(Identity, APInt(Bitwidth, 1)));