[Mlir-commits] [mlir] [mlir][arith][spirv] Convert arith.truncf rounding mode to SPIR-V (PR #101547)
Andrea Faulds
llvmlistbot at llvm.org
Thu Aug 1 15:26:20 PDT 2024
================
@@ -754,6 +754,21 @@ func.func @fptrunc2(%arg0: f32) -> f16 {
return %0 : f16
}
+
+// CHECK-LABEL: @experimental_constrained_fptrunc
+func.func @experimental_constrained_fptrunc(%arg0 : f64) {
+ // CHECK: spirv.FConvert %arg0 {fp_rounding_mode = #spirv.fp_rounding_mode<RTE>} : f64 to f32
+ %0 = arith.truncf %arg0 to_nearest_even : f64 to f32
+ // CHECK: spirv.FConvert %arg0 {fp_rounding_mode = #spirv.fp_rounding_mode<RTN>} : f64 to f32
+ %1 = arith.truncf %arg0 downward : f64 to f32
+ // CHECK: spirv.FConvert %arg0 {fp_rounding_mode = #spirv.fp_rounding_mode<RTP>} : f64 to f32
+ %2 = arith.truncf %arg0 upward : f64 to f32
+ // CHECK: spirv.FConvert %arg0 {fp_rounding_mode = #spirv.fp_rounding_mode<RTZ>} : f64 to f32
+ %3 = arith.truncf %arg0 toward_zero : f64 to f32
+ return
+}
----------------
andfau-amd wrote:
Done in a4effd454f09906021e467c24f5bc8a85bbece73.
https://github.com/llvm/llvm-project/pull/101547
More information about the Mlir-commits
mailing list