Home | History | Annotate | Download | only in Scalar

Lines Matching full:bitwidth

266 /// Returns k such that lambda(2^Bitwidth) = 2^k, where lambda is the Carmichael
267 /// function. This means that x^(2^k) === 1 mod 2^Bitwidth for
268 /// every odd x, i.e. x^(2^k) = 1 for every odd x in Bitwidth-bit arithmetic.
269 /// Note that 0 <= k < Bitwidth, and if Bitwidth > 3 then x^(2^k) = 0 for every
270 /// even x in Bitwidth-bit arithmetic.
271 static unsigned CarmichaelShift(unsigned Bitwidth) {
272 if (Bitwidth < 3)
273 return Bitwidth - 1;
274 return Bitwidth - 2;
323 unsigned Bitwidth = LHS.getBitWidth();
324 // If CM is the Carmichael number then a weight W satisfying W >= CM+Bitwidth
325 // can be replaced with W-CM. That's because x^W=x^(W-CM) for every Bitwidth
328 // of CM like this weights can always be reduced to the range [0, CM+Bitwidth)
330 // Bitwidth bits.
333 if (Bitwidth > 3) {
335 APInt CM = APInt::getOneBitSet(Bitwidth, CarmichaelShift(Bitwidth));
337 APInt Threshold = CM + Bitwidth;
339 // For Bitwidth 4 or more the following sum does not overflow.
346 unsigned CM = 1U << CarmichaelShift(Bitwidth);
347 unsigned Threshold = CM + Bitwidth;
436 unsigned Bitwidth = I->getType()->getScalarType()->getPrimitiveSizeInBits();
452 Worklist.push_back(std::make_pair(I, APInt(Bitwidth, 1)));
598 // because the expression was "X xor X" or consisted of 2^Bitwidth additions:
603 Ops.emplace_back(Identity, APInt(Bitwidth, 1));