[clang] [llvm] [clang][NVPTX] Add intrinsics and builtins for mixed-precision FP arithmetic (PR #168359)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 11:20:38 PST 2025


================
@@ -1694,6 +1694,20 @@ multiclass FMA_INST {
 
 defm INT_NVVM_FMA : FMA_INST;
 
+foreach rnd = ["_RN", "_RZ", "_RM", "_RP"] in {
+  foreach sat = ["", "_SAT"] in {
+    foreach type = ["F16", "BF16"] in {
+      def INT_NVVM_FMA # rnd # sat # _F32_ # type : 
+        BasicNVPTXInst<(outs B32:$dst), (ins B16:$a, B16:$b, B32:$c),
+          !tolower(!subst("_", ".", "fma" # rnd # sat # "_f32_" # type)),
+          [(set f32:$dst, 
+           (!cast<Intrinsic>(!tolower("int_nvvm_fma_mixed" # rnd # sat # "_f32")) 
+             !cast<ValueType>(!tolower(type)):$a, !cast<ValueType>(!tolower(type)):$b, f32:$c))]>,
----------------
Artem-B wrote:

Nit: I'd put each argument on a separate line. Easier to read, compared to all of them jammed together on the same line, with a lot of `<>()` sprinkled around.

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


More information about the llvm-commits mailing list