[llvm] [ISel] Introduce llvm.clmul intrinsic (PR #168731)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 11:15:23 PST 2025


================
@@ -11440,6 +11420,28 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
   if (SDValue AVG = foldShiftToAvg(N, DL))
     return AVG;
 
+  // Fold clmul(zext(x), zext(y)) >> (BW - 1 | BW) -> clmul(r|h)(x, y).
+  if (VT.getScalarSizeInBits() % 2)
+    return SDValue();
----------------
topperc wrote:

Don't early out. Inevitably someone will add code below this without noticing this. Either wrap the whole thing with an if or more move it to a function like combineShiftToMULH.

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


More information about the llvm-commits mailing list