[llvm] [NVPTX] Enhance `mul.wide` and `mad.wide` peepholes (PR #150477)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 25 19:47:38 PDT 2025


================
@@ -990,6 +990,34 @@ defm MAD32 : MAD<"mad.lo.s32", i32, B32, i32imm>;
 defm MAD64 : MAD<"mad.lo.s64", i64, B64, i64imm>;
 }
 
+multiclass MAD_WIDE<string PtxSuffix, SDNode Op, ValueType BigVT, NVPTXRegClass BigReg, Operand BigImm, ValueType SmallVT, NVPTXRegClass SmallReg, Operand SmallImm> {
+  def rrr:
+    BasicNVPTXInst<(outs BigReg:$dst),
+              (ins SmallReg:$a, SmallReg:$b, BigReg:$c),
+              "mad.wide." # PtxSuffix,
+              [(set BigVT:$dst, (add (Op SmallVT:$a, SmallVT:$b), BigVT:$c))]>;
----------------
AlexMaclean wrote:

Should we also be checking that Op only has one use?

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


More information about the llvm-commits mailing list