[clang] [llvm] [HLSL][DirectX][SPIRV] Implement the `fma` API (PR #185304)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 10:04:30 PDT 2026


================
@@ -782,6 +782,16 @@ def FMad : DXILOp<46, tertiary> {
   let attributes = [Attributes<DXIL1_0, [ReadNone]>];
 }
 
+def Fma : DXILOp<47, tertiary> {
+  let Doc = "Double-precision fused multiply-add. fma(a,b,c) = a * b + c.";
+  let intrinsics = [IntrinSelect<int_fma>];
----------------
farzonl wrote:

See llvm/test/CodeGen/DirectX/imad.ll  you will want to make sure that scalar and vector  intrinsic signatures both work. ie llvm ir `@llvm.fma.f64` converts to `f64 @dx.op.tertiary.f64(i32 47,...)`

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


More information about the llvm-commits mailing list