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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 09:24:38 PST 2025


================
@@ -8302,6 +8302,57 @@ SDValue TargetLowering::expandFunnelShift(SDNode *Node,
   return DAG.getNode(ISD::OR, DL, VT, ShX, ShY);
 }
 
+SDValue TargetLowering::expandCLMUL(SDNode *Node, SelectionDAG &DAG) const {
+  SDLoc DL(Node);
+  EVT VT = Node->getValueType(0);
+  SDValue X = Node->getOperand(0);
+  SDValue Y = Node->getOperand(1);
+  unsigned BW = VT.getScalarSizeInBits();
+  unsigned Opcode = Node->getOpcode();
+
+  if (VT.isVector() &&
+      isOperationLegalOrCustomOrPromote(Opcode, VT.getVectorElementType()))
+    return DAG.UnrollVectorOp(Node);
----------------
topperc wrote:

Why do we want to unroll this? Can't we do all the bit math across the whole vector?

Also scalable vectors can't be unrolled and have to go through the bit math.

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


More information about the llvm-commits mailing list