[all-commits] [llvm/llvm-project] a6e302: [X86] Avoid converting u64 to f32 using x87 on Win...
icedrocket via All-commits
all-commits at lists.llvm.org
Wed Jan 18 23:14:47 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a6e3027db7ebe6863e44bafcfeaacc16bdc88a3f
https://github.com/llvm/llvm-project/commit/a6e3027db7ebe6863e44bafcfeaacc16bdc88a3f
Author: icedrocket <114203630+icedrocket at users.noreply.github.com>
Date: 2023-01-18 (Wed, 18 Jan 2023)
Changed paths:
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/test/CodeGen/X86/uint64-to-float.ll
Log Message:
-----------
[X86] Avoid converting u64 to f32 using x87 on Windows
The code below currently prints less accurate values only on Windows 32-bit. On Windows, the default precision control on x87 is only 53-bit, and FADD triggers rounding with that precision, so the final result may be less accurate. This revision avoids less accurate conversions by using library calls instead.
```
int main() {
int64_t n = 0b0000000000111111111111111111111111011111111111111111111111111111;
printf("%lld, %.0f, %.0f", n, (float)n, (float)(uint64_t)n);
return 0;
}
```
Reviewed By: craig.topper, lebedev.ri
Differential Revision: https://reviews.llvm.org/D141074
More information about the All-commits
mailing list