[clang] [llvm] [clang][NVPTX] Add support for mixed-precision FP arithmetic (PR #168359)
Srinivasa Ravi via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 10:11:57 PST 2025
================
@@ -1386,6 +1386,14 @@ let TargetPrefix = "nvvm" in {
PureIntrinsic<[llvm_double_ty],
[llvm_double_ty, llvm_double_ty, llvm_double_ty]>;
}
+
+ foreach rnd = ["_rn", "_rz", "_rm", "_rp"] in {
+ foreach sat = ["", "_sat"] in {
+ def int_nvvm_fma_mixed # rnd # sat # _f32 :
+ PureIntrinsic<[llvm_float_ty],
+ [llvm_anyfloat_ty, LLVMMatchType<0>, llvm_float_ty]>;
+ }
+ }
----------------
Wolfram70 wrote:
Agreed, that makes a lot of sense. We could do the same for the `add` and `sub` operations too since they are equivalent to a conversion followed by the fp operation as well. It looks like we are missing intrinsics some variants of these base operations currently (`fma` and `add` with `.sat` and all of `sub`) so I've just added those and used this pattern to lower to the mixed precision instructions.
Please take a look, thanks!
https://github.com/llvm/llvm-project/pull/168359
More information about the llvm-commits
mailing list