[Mlir-commits] [mlir] [MLIR][NVGPU] Add convert.fpext and convert.fptrunc Ops (PR #199700)

Srinivasa Ravi llvmlistbot at llvm.org
Fri Jul 3 05:29:17 PDT 2026


================
@@ -671,4 +671,78 @@ def NVGPU_RcpOp : NVGPU_Op<"rcp", [Pure,
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// NVGPU Conversion Ops
+//===----------------------------------------------------------------------===//
+
+def AnyI32Like : TypeOrValueSemanticsContainer<I32, "scalar i32 or vector of i32">;
+
+// nvgpu.convert.fptrunc only supports the satfinite and none saturation modes.
+def NVGPU_SaturationModeSatfiniteOrNone :
+  ConfinedAttr<SaturationModeAttr, [EnumAttrIsOneOf<SaturationModeAttr,
+                [SaturationModeNone, SaturationModeFinite]>]>;
+
+def NVGPU_ConvertFPTruncOp : NVGPU_Op<"convert.fptrunc", [Pure]> {
+  let summary = "Truncate floating-point to narrower floating-point";
+  let description = [{
+    Truncate a floating-point value to a smaller floating-point type.
+    Destination must be strictly narrower than source.
+
+    Supported paths:
+      f64 -> f32, f16, bf16
+      f32 -> f16, bf16, f8, f6, f4
+      f16 -> f8, f6, f4
+      bf16 -> f8, f6, f4
----------------
Wolfram70 wrote:

Done

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


More information about the Mlir-commits mailing list