[Mlir-commits] [mlir] [mlir][tosa] Avoid introducing int <-> float casts (PR #195882)
Ian Tayler Lessa
llvmlistbot at llvm.org
Wed May 6 03:07:11 PDT 2026
================
@@ -941,6 +941,13 @@ struct NonNarrowingCastsOptimization : public OpRewritePattern<tosa::CastOp> {
"legal in TOSA");
}
+ if (innerInputType.getElementType().isInteger() !=
+ outerOutputType.getElementType().isInteger()) {
+ return rewriter.notifyMatchFailure(
+ castOp, "integer to float and float to integer casts are not "
+ "supported to avoid introducing illegal type combinations");
+ }
----------------
IanTaylerLessa-arm wrote:
There's also `i64` which doesn't support floating point casts at all (directly).
I'll rewrite it so that we allow the legal cases, though. It might look at bit convoluted, though.
I also need to reject optimization of i8 -> i32 -> i64 (long-standing bug) and f16 -> f32 -> bf16 (new-ish bug)
https://github.com/llvm/llvm-project/pull/195882
More information about the Mlir-commits
mailing list