Skip to content

Commit 787a1f7

Browse files
authored
Rollup merge of rust-lang#128388 - beetrees:f16-f128-slightly-improve-windows-abi, r=tgross35
Match LLVM ABI in `extern "C"` functions for `f128` on Windows As MSVC doesn't support `_Float128`, x86-64 Windows doesn't have a defined ABI for `f128`. Currently, Rust will pass and return `f128` indirectly for `extern "C"` functions. This is inconsistent with LLVM, which passes and returns `f128` in XMM registers, meaning that e.g. the ABI of `extern "C"` compiler builtins won't match. This PR fixes this discrepancy by making the x86-64 Windows `extern "C"` ABI pass `f128` directly through to LLVM, so that Rust will follow whatever LLVM does. This still leaves the difference between LLVM and GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054) but this PR is still an improvement as at least Rust is now consistent with it's primary codegen backend and compiler builtins from `compiler-builtins` will now work. I've also fixed the x86-64 Windows `has_reliable_f16` match arm in `std` `build.rs` to refer to the correct target, and added an equivalent match arm to `has_reliable_f128` as the LLVM-GCC ABI difference affects both `f16` and `f128`. Tracking issue: rust-lang#116909 try-job: x86_64-msvc try-job: x86_64-mingw
2 parents e3a4ed3 + 176508c commit 787a1f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

std/build.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn main() {
9494
// Unsupported <https://github.com/llvm/llvm-project/issues/94434>
9595
("arm64ec", _) => false,
9696
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
97-
("x86", "windows") => false,
97+
("x86_64", "windows") => false,
9898
// x86 has ABI bugs that show up with optimizations. This should be partially fixed with
9999
// the compiler-builtins update. <https://github.com/rust-lang/rust/issues/123885>
100100
("x86" | "x86_64", _) => false,
@@ -122,6 +122,8 @@ fn main() {
122122
("nvptx64", _) => false,
123123
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838>
124124
("sparc", _) => false,
125+
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
126+
("x86_64", "windows") => false,
125127
// 64-bit Linux is about the only platform to have f128 symbols by default
126128
(_, "linux") if target_pointer_width == 64 => true,
127129
// Same as for f16, except MacOS is also missing f128 symbols.

0 commit comments

Comments
 (0)