[llvm] [SLP]Initial support for copyables in fmuladd intrinsic (PR #211245)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 06:20:27 PDT 2026


================
@@ -12205,14 +12218,19 @@ class InstructionsCompatibilityAnalysis {
         VectorCost = TTI.getArithmeticInstrCost(MainOpcode, VecTy, Kind);
         break;
       default:
-        // Instruction::Call returns above before reaching this switch.
+        // Calls (min/max, fmuladd) return above before reaching this switch.
         llvm_unreachable("Unexpected instruction.");
       }
       if (VectorCost > ScalarCost)
         return OrigS;
       return S;
     }
-    assert(Operands.size() == 2 && "Unexpected number of operands!");
+    // fmuladd is the only 3-operand copyable main op and stores the copyable
+    // value in the addend, so it needs different handling than the 2-operand
+    // ops (binary operators and min/max intrinsics).
+    const bool IsFMulAdd = RecurrenceDescriptor::isFMulAddIntrinsic(MainOp);
+    assert((Operands.size() == 2 || (IsFMulAdd && Operands.size() == 3)) &&
----------------
RKSimon wrote:

```suggestion
    assert(Operands.size() == (IsFMulAdd ? 3 : 2) &&
```

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


More information about the llvm-commits mailing list