Use x86_no_sse configuration in more places

Emit `x86_no_sse` in the compiler-builtins (and builtins-test) build
script, and use it to simplify `all(target_arch = "x86",
not(target_fefature = "sse))` configuration.
This commit is contained in:
Trevor Gross 2025-07-24 18:55:27 +00:00
parent 0b6c1d3861
commit 9dad77f337
8 changed files with 16 additions and 17 deletions

View file

@ -43,9 +43,7 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
return true;
}
if cfg!(all(target_arch = "x86", not(target_feature = "sse")))
&& X86_NO_SSE_SKIPPED.contains(&test_name)
{
if cfg!(x86_no_sse) && X86_NO_SSE_SKIPPED.contains(&test_name) {
return true;
}

View file

@ -111,7 +111,7 @@ macro_rules! float_sum {
}
}
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg(not(x86_no_sse))]
mod float_addsub {
use super::*;
@ -122,7 +122,7 @@ mod float_addsub {
}
#[cfg(f128_enabled)]
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg(not(x86_no_sse))]
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
mod float_addsub_f128 {
use super::*;

View file

@ -138,7 +138,7 @@ macro_rules! float {
};
}
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg(not(x86_no_sse))]
mod float_div {
use super::*;

View file

@ -1,7 +1,7 @@
#![allow(unused_macros)]
#![cfg_attr(f128_enabled, feature(f128))]
#![cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg_attr(x86_no_sse, allow(unused))]
use builtins_test::*;
// This is approximate because of issues related to
@ -52,6 +52,7 @@ macro_rules! pow {
};
}
#[cfg(not(x86_no_sse))] // FIXME(i586): failure for powidf2
pow! {
f32, 1e-4, __powisf2, all();
f64, 1e-12, __powidf2, all();

View file

@ -113,7 +113,7 @@ macro_rules! float_mul {
};
}
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg(not(x86_no_sse))]
mod float_mul {
use super::*;
@ -126,7 +126,7 @@ mod float_mul {
}
#[cfg(f128_enabled)]
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
#[cfg(not(x86_no_sse))]
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
mod float_mul_f128 {
use super::*;

View file

@ -106,13 +106,6 @@ fn configure_libm(target: &Target) {
println!("cargo:rustc-cfg=optimizations_enabled");
}
// Config shorthands
println!("cargo:rustc-check-cfg=cfg(x86_no_sse)");
if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") {
// Shorthand to detect i586 targets
println!("cargo:rustc-cfg=x86_no_sse");
}
println!(
"cargo:rustc-env=CFG_CARGO_FEATURES={:?}",
target.cargo_features

View file

@ -100,6 +100,13 @@ pub fn configure_aliases(target: &Target) {
println!("cargo:rustc-cfg=thumb_1")
}
// Config shorthands
println!("cargo:rustc-check-cfg=cfg(x86_no_sse)");
if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") {
// Shorthand to detect i586 targets
println!("cargo:rustc-cfg=x86_no_sse");
}
/* Not all backends support `f16` and `f128` to the same level on all architectures, so we
* need to disable things if the compiler may crash. See configuration at:
* * https://github.com/rust-lang/rust/blob/c65dccabacdfd6c8a7f7439eba13422fdd89b91e/compiler/rustc_codegen_llvm/src/llvm_util.rs#L367-L432

View file

@ -195,7 +195,7 @@ mod tests {
#[test]
// FIXME(correctness): inaccurate results on i586
#[cfg_attr(all(target_arch = "x86", not(target_feature = "sse")), ignore)]
#[cfg_attr(x86_no_sse, ignore)]
fn test_near_pi() {
let arg = 3.141592025756836;
let arg = force_eval!(arg);