[llvm] [LoopIdiom] Use narrower bit widths where possible in `optimizeCRCLoopUsingClmul` (PR #210139)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 02:05:51 PDT 2026


================
@@ -1703,18 +1712,21 @@ void LoopIdiomRecognize::optimizeCRCLoopUsingClmul(const PolynomialInfo &Info,
 
   // Step 2: T2(x) = floor(T1(x)/x^TC) * P(x)
   // Input is TC bits and P(x) is CRCBW+1 bits, so result will be CRCBW+TC bits.
+  ClmulGPInput =
+      Builder.CreateZExtOrTrunc(ClmulGPInput, ClmulGPTy, "quot.cast");
----------------
artagnon wrote:

Isn't ClmulMuInput of BW TC or TC + BW after the cast to SetupTy? How can TC + BW < TC * 2 (ClmulMuTy)? BW >= TC, ignoring DataBW? Isn't ClmulGPTy of bitwidth BW + 1 (ClmulGPTy)? How can BW + 1 <= BW + TC? TC can never be 1?

https://github.com/llvm/llvm-project/pull/210139


More information about the llvm-commits mailing list