[llvm] [X86] Faster truncf and roundf on x86 SSE2 (PR #226513)
Michael Schmidt via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 15:01:37 PDT 2026
RunDevelopment wrote:
Hi! Thank you both for working on this. I made the issue and would like to join the discussion here :)
> Also for float, a better bound is `|x| >= 2^23`, and for double, `|x| >= 2^53`.
I talked about this in the issue. Any value between 2^23 and 2^31 (inclusive) works as a threshold for float32 (similar for float64). I suggested using a large threshold purely in hopes that it helps LLVM to remove the return-unchanged branch if it knows something about the range of the input. I.e. if it knows that the input is between 0 and 2^16, LLVM can remove the branch. So I would like to suggest using 2^31 and 2^63 again, as they may enable more optimizations down the line.
Frankly, it's probably not going to make much of a huge difference, but having more optimization potential by picking a larger threshold seems like a no-brainer to me.
https://github.com/llvm/llvm-project/pull/226513
More information about the llvm-commits
mailing list