[clang] [llvm] [NVPTX] Add builtins and intrinsics for conversions of new FP types (PR #134345)

Alex MacLean via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 09:27:53 PDT 2025


================
@@ -1944,6 +1944,62 @@ def : Pat<(int_nvvm_e5m2x2_to_f16x2_rn Int16Regs:$a),
 def : Pat<(int_nvvm_e5m2x2_to_f16x2_rn_relu Int16Regs:$a),
           (CVT_f16x2_e5m2x2 $a, CvtRN_RELU)>;
 
+def : Pat<(int_nvvm_ff_to_e2m3x2_rn f32:$a, f32:$b),
+          (CVT_e2m3x2_f32 $a, $b, CvtRN)>,
+      Requires<[hasPTX<86>, hasSM<100>, hasArchAccelFeatures]>;
+def : Pat<(int_nvvm_ff_to_e2m3x2_rn_relu f32:$a, f32:$b),
+          (CVT_e2m3x2_f32 $a, $b, CvtRN_RELU)>,
+      Requires<[hasPTX<86>, hasSM<100>, hasArchAccelFeatures]>;
+def : Pat<(int_nvvm_ff_to_e3m2x2_rn f32:$a, f32:$b),
+          (CVT_e3m2x2_f32 $a, $b, CvtRN)>,
+      Requires<[hasPTX<86>, hasSM<100>, hasArchAccelFeatures]>;
+def : Pat<(int_nvvm_ff_to_e3m2x2_rn_relu f32:$a, f32:$b),
+          (CVT_e3m2x2_f32 $a, $b, CvtRN_RELU)>,
+      Requires<[hasPTX<86>, hasSM<100>, hasArchAccelFeatures]>;
+
+def : Pat<(int_nvvm_e2m3x2_to_f16x2_rn Int16Regs:$a),
----------------
AlexMaclean wrote:

Instead of using a Register class in the input pattern, use whatever type we expect this to be, in this case `i16` I assume.

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


More information about the cfe-commits mailing list