[llvm] [LoopIdiomRecognize] Enable clmul optimization for CRC loops (PR #203405)

Sean Clarke via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 10:59:34 PDT 2026


================
@@ -669,6 +669,19 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
            TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
   }
 
+  bool haveFastClmul(IntegerType *Ty) const override {
+    // FIXME: clmul should really be Promote for any bitwidth under the largest
+    // legal bitwidth for clmul. This is a hack to get around that shortcoming.
+    auto *PromoteTy = dyn_cast_if_present<IntegerType>(
+        DL.getLargestLegalIntType(Ty->getContext()));
+    if (PromoteTy && Ty->getBitWidth() <= PromoteTy->getBitWidth())
+      Ty = PromoteTy;
----------------
xarkenz wrote:

I'm not convinced `getIndexType` would be better than `getLargestLegalIntType`. Why would using the index type make more sense when we're not dealing with an index?

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


More information about the llvm-commits mailing list