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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 11:54:01 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))
----------------
peterbell10 wrote:

I guess it's only profitable when the target has mad, otherwise it's the same number of ops.

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


More information about the llvm-commits mailing list