[Mlir-commits] [mlir] [mlir][arith] Add `arith.fptofp` op (PR #188041)
Krzysztof Drewniak
llvmlistbot at llvm.org
Mon Mar 23 08:23:51 PDT 2026
krzysz00 wrote:
> On the other hand, you may be able to get rid of these checks when coming from the frontend. E.g., PyTorch does not distinguish between FP extensions/truncations: x_f32.to(torch.float16).
So now when converting from torch to something arith-like your code becomes
```
if (width(src) < width(dst)) {
arith::ExtfOp::create(...);
} else if (width(src) > width(dst)) {
arith::TruncfOp::create(...);
} else {
arith::FptoFpOp::create(...);
}
```
which gives each of these three options one legal representation.
https://github.com/llvm/llvm-project/pull/188041
More information about the Mlir-commits
mailing list