[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:36 PDT 2025


================
@@ -5408,6 +5408,53 @@ static SDValue PerformREMCombine(SDNode *N,
   return SDValue();
 }
 
+// (any_extend|sign_extend|zero_extend (mul|shl) x, y) -> (mul.wide x, y)
+static SDValue
+PerformExtendMULWIDECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
+  unsigned ExtOpcode = N->getOpcode();
+  assert(ExtOpcode == ISD::ANY_EXTEND || ExtOpcode == ISD::SIGN_EXTEND ||
+         ExtOpcode == ISD::ZERO_EXTEND);
+  EVT ToVT = N->getValueType(0);
+  if (!(ToVT == MVT::i32 || ToVT == MVT::i64))
+    return SDValue();
+  SDValue Op = N->getOperand(0);
----------------
AlexMaclean wrote:

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

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


More information about the llvm-commits mailing list