[Mlir-commits] [mlir] [MLIR][ARITH] Adds missing foldings for truncf (PR #128096)
Mehdi Amini
llvmlistbot at llvm.org
Fri Feb 21 12:02:27 PST 2025
================
@@ -714,6 +714,25 @@ func.func @extFPVectorConstant() -> vector<2xf128> {
return %0 : vector<2xf128>
}
+// CHECK-LABEL: @truncExtf
+// CHECK-NOT: truncf
+// CHECK: return %arg0
+func.func @truncExtf(%arg0: f32) -> f32 {
+ %extf = arith.extf %arg0 : f32 to f64
+ %trunc = arith.truncf %extf : f64 to f32
+ return %trunc : f32
+}
+
+// CHECK-LABEL: @truncExtf2
+// CHECK: %[[ARG0:.+]]: f32
+// CHECK: %[[CST:.*]] = arith.truncf %[[ARG0:.+]] : f32 to f16
----------------
joker-eph wrote:
I think these are safe in this direction, but I always end-up surprised with floating-point so I would bet too much on it either :)
https://github.com/llvm/llvm-project/pull/128096
More information about the Mlir-commits
mailing list