Skip to content

Commit 71f73a5

Browse files
committed
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.
1 parent 84507cc commit 71f73a5

File tree

8 files changed

+16
-17
lines changed

8 files changed

+16
-17
lines changed

builtins-test/src/bench.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
4343
return true;
4444
}
4545

46-
if cfg!(all(target_arch = "x86", not(target_feature = "sse")))
47-
&& X86_NO_SSE_SKIPPED.contains(&test_name)
48-
{
46+
if cfg!(x86_no_sse) && X86_NO_SSE_SKIPPED.contains(&test_name) {
4947
return true;
5048
}
5149

builtins-test/tests/addsub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ macro_rules! float_sum {
111111
}
112112
}
113113

114-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
114+
#[cfg(not(x86_no_sse))]
115115
mod float_addsub {
116116
use super::*;
117117

@@ -122,7 +122,7 @@ mod float_addsub {
122122
}
123123

124124
#[cfg(f128_enabled)]
125-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
125+
#[cfg(not(x86_no_sse))]
126126
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
127127
mod float_addsub_f128 {
128128
use super::*;

builtins-test/tests/div_rem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ macro_rules! float {
138138
};
139139
}
140140

141-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
141+
#[cfg(not(x86_no_sse))]
142142
mod float_div {
143143
use super::*;
144144

builtins-test/tests/float_pow.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unused_macros)]
22
#![cfg_attr(f128_enabled, feature(f128))]
3-
#![cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
43

4+
#[cfg_attr(x86_no_sse, allow(unused))]
55
use builtins_test::*;
66

77
// This is approximate because of issues related to
@@ -52,6 +52,7 @@ macro_rules! pow {
5252
};
5353
}
5454

55+
#[cfg(not(x86_no_sse))] // FIXME(i586): failure for powidf2
5556
pow! {
5657
f32, 1e-4, __powisf2, all();
5758
f64, 1e-12, __powidf2, all();

builtins-test/tests/mul.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ macro_rules! float_mul {
113113
};
114114
}
115115

116-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
116+
#[cfg(not(x86_no_sse))]
117117
mod float_mul {
118118
use super::*;
119119

@@ -126,7 +126,7 @@ mod float_mul {
126126
}
127127

128128
#[cfg(f128_enabled)]
129-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]
129+
#[cfg(not(x86_no_sse))]
130130
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
131131
mod float_mul_f128 {
132132
use super::*;

compiler-builtins/build.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ fn configure_libm(target: &Target) {
106106
println!("cargo:rustc-cfg=optimizations_enabled");
107107
}
108108

109-
// Config shorthands
110-
println!("cargo:rustc-check-cfg=cfg(x86_no_sse)");
111-
if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") {
112-
// Shorthand to detect i586 targets
113-
println!("cargo:rustc-cfg=x86_no_sse");
114-
}
115-
116109
println!(
117110
"cargo:rustc-env=CFG_CARGO_FEATURES={:?}",
118111
target.cargo_features

compiler-builtins/configure.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ pub fn configure_aliases(target: &Target) {
100100
println!("cargo:rustc-cfg=thumb_1")
101101
}
102102

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

libm/src/math/rem_pio2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ mod tests {
195195

196196
#[test]
197197
// FIXME(correctness): inaccurate results on i586
198-
#[cfg_attr(all(target_arch = "x86", not(target_feature = "sse")), ignore)]
198+
#[cfg_attr(x86_no_sse, ignore)]
199199
fn test_near_pi() {
200200
let arg = 3.141592025756836;
201201
let arg = force_eval!(arg);

0 commit comments

Comments
 (0)