[PATCH] D142093: [InstCombine] trunc (fptoui|fptosi)
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 11:01:00 PST 2023
efriedma added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/trunc-fp-to-int.ll:357
+; CHECK-NEXT: [[CONV:%.*]] = fptosi float [[X:%.*]] to i33
+; CHECK-NEXT: ret i33 [[CONV]]
;
----------------
>From alive2:
```
define i33 @src(float noundef %x) {
%0:
%conv = fptosi float noundef %x to i64
%conv.1 = trunc i64 %conv to i33
ret i33 %conv.1
}
=>
define i33 @tgt(float noundef %x) {
%0:
%conv = fptosi float noundef %x to i33
ret i33 %conv
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
```
The final result type must be able to hold the largest finite number representable in the floating-point type; otherwise, the transform isn't legal. For float, that's an i128 or i129, I think?
AArch64 does have an instruction FJCVTZS you could theoretically use for this kind of thing, but that seems unlikely to be worthwhile.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142093/new/
https://reviews.llvm.org/D142093
More information about the llvm-commits
mailing list