[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:52 PDT 2026


================
@@ -1617,8 +1617,8 @@ bool LoopIdiomRecognize::optimizeCRCLoop(const PolynomialInfo &Info) {
   // bit width is a fast operation on the target.
   // TODO: If clmul exists on the target but not for the required width, it
   // might be possible to split into multiple iterations of reduction.
-  if (TTI->haveFastClmul(ClmulTy)) {
-    optimizeCRCLoopUsingClmul(Info, ClmulTy);
+  if (TTI->haveFastClmul(ClmulMuTy) && TTI->haveFastClmul(ClmulGPTy)) {
----------------
artagnon wrote:

```suggestion
  if (TTI->haveFastClmul(std::max(ClmulMuTy->getBitWidth(), ClmulGPTy->getBitwidth()))) {
```

and change haveFastClmul to accept a bitwidth?

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


More information about the llvm-commits mailing list