[llvm] [RISCV][GlobalISel] Add G_CLMULH support (PR #221686)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 23:25:18 PDT 2026


================
@@ -845,6 +849,11 @@ bool RISCVLegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
   switch (IntrinsicID) {
   default:
     return false;
+  case Intrinsic::riscv_clmulh:
+    Helper.MIRBuilder.buildInstr(TargetOpcode::G_CLMULH, {MI.getOperand(0)},
----------------
arsenm wrote:

> > Why does riscv_clmulh exist? Can't you do shift of llvm.cmul?
> 
> Because a multi instruction pattern like that can get split across basic blocks and fail to match in SelectionDAG.

Which is what the various sinking hooks in CGP are for?

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


More information about the llvm-commits mailing list