[llvm] [InstCombine] Canonicalize `(uitofp x)` -> `(sitofp x)` if `x >= 0` (PR #82404)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 02:21:47 PST 2024


nikic 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...

> If youre not convinced lmk and ill swap this patch around and start work on the regressions.

I think we should first address any unnecessary differences between sitofp and uitofp optimization, and then we can check the result of both canonicalization directions on @dtcxzyw's test set and see whether we see any clear benefit in one direction or the other.

https://github.com/llvm/llvm-project/pull/82404


More information about the llvm-commits mailing list