Enable f16 tests on x86 and x86-64

Since the `compiler_builtins` update [1], ABI bugs on x86 should be
resolved. Enable tests for f16 on these platforms now.

`f16` math functions (`reliable_f16_math`) are still excluded because
there is an LLVM crash for powi [2].

[1]: https://github.com/rust-lang/rust/pull/125016
[2]: https://github.com/llvm/llvm-project/issues/105747
This commit is contained in:
Trevor Gross 2024-07-29 11:12:30 -04:00
parent a60a9e567a
commit 402ce53bfe

View File

@ -103,9 +103,9 @@ fn main() {
("arm64ec", _) => false, ("arm64ec", _) => false,
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054> // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
("x86_64", "windows") => false, ("x86_64", "windows") => false,
// x86 has ABI bugs that show up with optimizations. This should be partially fixed with // Apple has a special ABI for `f16` that we do not yet support
// the compiler-builtins update. <https://github.com/rust-lang/rust/issues/123885> // FIXME(builtins): fixed by <https://github.com/rust-lang/compiler-builtins/pull/675>
("x86" | "x86_64", _) => false, ("x86" | "x86_64", _) if target_vendor == "apple" => false,
// Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee` // Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee`
("powerpc" | "powerpc64", _) => false, ("powerpc" | "powerpc64", _) => false,
// Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee` // Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee`
@ -140,17 +140,17 @@ fn main() {
_ => false, _ => false,
}; };
// These are currently empty, but will fill up as some platforms move from completely // Configure platforms that have reliable basics but may have unreliable math.
// unreliable to reliable basics but unreliable math.
// LLVM is currenlty adding missing routines, <https://github.com/llvm/llvm-project/issues/93566> // LLVM is currenlty adding missing routines, <https://github.com/llvm/llvm-project/issues/93566>
let has_reliable_f16_math = has_reliable_f16 let has_reliable_f16_math = has_reliable_f16
&& match (target_arch.as_str(), target_os.as_str()) { && match (target_arch.as_str(), target_os.as_str()) {
// FIXME: Disabled on Miri as the intrinsics are not implemented yet. // FIXME: Disabled on Miri as the intrinsics are not implemented yet.
_ if is_miri => false, _ if is_miri => false,
// Currently nothing special. Hooray! // x86 has a crash for `powi`: <https://github.com/llvm/llvm-project/issues/105747>
// This will change as platforms gain better better support for standard ops but math ("x86" | "x86_64", _) => false,
// lags behind. // Assume that working `f16` means working `f16` math for most platforms, since
// operations just go through `f32`.
_ => true, _ => true,
}; };