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

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 07:16:03 PST 2025


================
@@ -8302,6 +8302,59 @@ 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);
+
+  SDValue Res = DAG.getConstant(0, DL, VT);
----------------
pfusik wrote:

Constant zero only used in the `CLMUL` case. I suggest using separate `Res` variables for the two cases.

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


More information about the llvm-commits mailing list