[PATCH] D141074: [X86] Avoid converting 64-bit integers to floating point using x87 on Windows

icedrocket via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 15 03:47:59 PST 2023


icedrocket added a comment.

In D141074#4054355 <https://reviews.llvm.org/D141074#4054355>, @icedrocket wrote:

> I'm not sure why the result depends on the x87 control word, but anyway, there is a possibility that this issue is because of the rounding mode. The conversion from f64 to f32 is typically done using round to nearest, and the target to round can differ between u64 and u64 to f64. We should round over u64, not u64 to f64.

Initially, I suspected that LLVM might have similar issues as MSVC's implementation. MSVC converts to f64 first and then to f32, whereas LLVM uses precision control to execute FADD. The results from the two different implementations were identical, which confused me a bit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141074/new/

https://reviews.llvm.org/D141074



More information about the llvm-commits mailing list