Skip to content

Use x86_no_sse configuration in more places #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions builtins-test/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
"extend_f16_f32",
"trunc_f32_f16",
"trunc_f64_f16",
// FIXME(#616): re-enable once fix is in nightly
// <https://github.com/rust-lang/compiler-builtins/issues/616>
"mul_f32",
"mul_f64",
];

// FIXME(f16_f128): system symbols have incorrect results
Expand All @@ -29,11 +25,6 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
"add_f128", "sub_f128", "mul_f128", "div_f128", "powi_f32", "powi_f64",
];

// FIXME(f16_f128): Wide multiply carry bug in `compiler-rt`, re-enable when nightly no longer
// uses `compiler-rt` version.
// <https://github.com/llvm/llvm-project/issues/91840>
const AARCH64_SKIPPED: &[&str] = &["mul_f128", "div_f128"];

// FIXME(llvm): system symbols have incorrect results on Windows
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2121359807>
const WINDOWS_SKIPPED: &[&str] = &[
Expand All @@ -52,13 +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)
{
return true;
}

if cfg!(target_arch = "aarch64") && AARCH64_SKIPPED.contains(&test_name) {
if cfg!(x86_no_sse) && X86_NO_SSE_SKIPPED.contains(&test_name) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions builtins-test/tests/addsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand All @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion builtins-test/tests/div_rem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
3 changes: 2 additions & 1 deletion builtins-test/tests/float_pow.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions builtins-test/tests/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand All @@ -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::*;
Expand Down
7 changes: 0 additions & 7 deletions compiler-builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions compiler-builtins/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libm/src/math/rem_pio2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading