[llvm] [NVPTX] Remove `NVPTX::IMAD` opcode, and rely on intruction selection only (PR #121724)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 11:35:34 PST 2025


================
@@ -4442,14 +4441,8 @@ PerformADDCombineWithOperands(SDNode *N, SDValue N0, SDValue N1,
   if (!N0.getNode()->hasOneUse())
     return SDValue();
 
-  // fold (add (mul a, b), c) -> (mad a, b, c)
-  //
-  if (N0.getOpcode() == ISD::MUL)
-    return DCI.DAG.getNode(NVPTXISD::IMAD, SDLoc(N), VT, N0.getOperand(0),
-                           N0.getOperand(1), N1);
-
   // fold (add (select cond, 0, (mul a, b)), c)
-  //   -> (select cond, c, (mad a, b, c))
+  //   -> (select cond, c, (add (mul a, b), c))
----------------
justinfargnoli wrote:

I know this would likely be out of scope of this PR, but could this transformation be done in `DAGCombiner`?

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


More information about the llvm-commits mailing list