[Mlir-commits] [mlir] [MLIR][ARITH] Adds missing foldings for truncf (PR #128096)
Krzysztof Drewniak
llvmlistbot at llvm.org
Fri Feb 21 12:05:13 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
----------------
krzysz00 wrote:
Sadly, I can't alive2 this to be really safe, but it *feels* fine now that I've thought about it
https://github.com/llvm/llvm-project/pull/128096
More information about the Mlir-commits
mailing list