[llvm] [InstCombine] Canonicalize `(uitofp x)` -> `(sitofp x)` if `x >= 0` (PR #82404)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 10:47:22 PST 2024
topperc wrote:
> > Can be fixed up elsewhere (i.e during lowering) but think generally its indicative of the somewhat builtin "signedness" of floats and thus how si is a better match.
>
> I think this says a lot more about the x86 architecture than about floating point numbers :) Pre-avx512 is well known to have very weird holes in the simd instruction set -- you could equally say that integers have an inherent preference for signed comparison because x86 can't compare packed unsigned numbers...
I think there's an asymmetry somewhere in PowerPC too. But its for the other direction fptosi/fptoui. See this comment from `DAGTypeLegalizer::PromoteIntRes_FP_TO_XINT`
```
// If we're promoting a UINT to a larger size and the larger FP_TO_UINT is
// not Legal, check to see if we can use FP_TO_SINT instead. (If both UINT
// and SINT conversions are Custom, there is no way to tell which is
// preferable. We choose SINT because that's the right thing on PPC.)
```
https://github.com/llvm/llvm-project/pull/82404
More information about the llvm-commits
mailing list