[llvm] [NVPTX] Add intrinsics for new narrow FP conversions (PR #173954)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 30 06:15:55 PST 2025


================
@@ -1736,6 +1736,33 @@ let TargetPrefix = "nvvm" in {
             PureIntrinsic<[llvm_i32_ty], [llvm_float_ty]>;
   }
 
+  foreach relu = ["", "_relu"] in {
+    def int_nvvm_ff_to_s2f6x2_rn # relu # _satfinite :
+        PureIntrinsic<[llvm_i16_ty], [llvm_float_ty, llvm_float_ty]>;
+
+    def int_nvvm_ff_to_s2f6x2_rn # relu # _satfinite_scale_n2_ue8m0 :
+        PureIntrinsic<[llvm_i16_ty], [llvm_float_ty, llvm_float_ty, llvm_i16_ty]>;
----------------
AlexMaclean wrote:

Nit can we pull the scale out into a loop as well? maybe something like 
```
foreach has_scale = [true, false] in {
  defvar scale_suffix = !if(has_scale, "_scale_n2_ue8m0", ""); 
  defvar scale_params = !if(has_scale, [llvm_i16_ty], []);
}
```

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


More information about the llvm-commits mailing list