Skip to content

Commit f66fa11

Browse files
committed
[TRY] Completely refactor std_detect tests
+ Add `avx512pf` and `avx512er` to `cpuid.def`
1 parent d263ac7 commit f66fa11

File tree

13 files changed

+351
-338
lines changed

13 files changed

+351
-338
lines changed

.github/workflows/main.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ jobs:
151151
tuple: x86_64-unknown-linux-gnu-emulated
152152
os: ubuntu-latest
153153
test_everything: true
154-
rustflags: --cfg stdarch_intel_sde
155154
# MIPS targets disabled since they are dropped to tier 3.
156155
# See https://github.com/rust-lang/compiler-team/issues/648
157156
#- target:
@@ -216,12 +215,9 @@ jobs:
216215
- run: echo "NORUN=1" >> $GITHUB_ENV
217216
shell: bash
218217
if: matrix.norun != '' || startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda'
219-
- run: echo "STDARCH_TEST_EVERYTHING=1" >> $GITHUB_ENV
218+
- run: echo "RUSTFLAGS=--cfg stdarch_test_everything" >> $GITHUB_ENV
220219
shell: bash
221220
if: matrix.test_everything != ''
222-
- run: echo "RUSTFLAGS=${{ matrix.rustflags }}" >> $GITHUB_ENV
223-
shell: bash
224-
if: matrix.rustflags != ''
225221
- run: echo "STDARCH_DISABLE_ASSERT_INSTR=1" >> $GITHUB_ENV
226222
shell: bash
227223
if: matrix.disable_assert_instr != ''

ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
00000004 00000004 => 00000000 00000000 00000000 00000000
3030
00000005 ******** => 00000040 00000040 00000003 00042120 #MONITOR/MWAIT
3131
00000006 ******** => 00000077 00000002 00000001 00000000 #Thermal and Power
32-
00000007 00000000 => 00000001 f3bfbfbf bbc05ffe 03d55130 #Extended Features
32+
00000007 00000000 => 00000001 ffbfbfbf bbc05ffe 03d55130 #Extended Features
3333
00000007 00000001 => 88ee00bf 00000002 00000000 1d29cd3e
3434
00000008 ******** => 00000000 00000000 00000000 00000000
3535
00000009 ******** => 00000000 00000000 00000000 00000000 #Direct Cache

ci/run-docker.sh

-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ run() {
2323
--env CARGO_HOME=/cargo \
2424
--env CARGO_TARGET_DIR=/checkout/target \
2525
--env TARGET="${target}" \
26-
--env STDARCH_TEST_EVERYTHING \
27-
--env STDARCH_ASSERT_INSTR_IGNORE \
2826
--env STDARCH_DISABLE_ASSERT_INSTR \
2927
--env NOSTD \
3028
--env NORUN \
3129
--env RUSTFLAGS \
32-
--env STDARCH_TEST_NORUN \
3330
--volume "${HOME}/.cargo":/cargo \
3431
--volume "$(rustc --print sysroot)":/rust:ro \
3532
--volume "$(pwd)":/checkout:ro \

ci/run.sh

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ echo "RUSTFLAGS=${RUSTFLAGS}"
6262
echo "FEATURES=${FEATURES}"
6363
echo "OBJDUMP=${OBJDUMP}"
6464
echo "STDARCH_DISABLE_ASSERT_INSTR=${STDARCH_DISABLE_ASSERT_INSTR}"
65-
echo "STDARCH_TEST_EVERYTHING=${STDARCH_TEST_EVERYTHING}"
6665
echo "PROFILE=${PROFILE}"
6766

6867
cargo_test() {

crates/core_arch/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ std_detect = { version = "0.*", path = "../std_detect" }
2828
syscalls = { version = "0.6.18", default-features = false }
2929

3030
[lints.rust]
31-
unexpected_cfgs = {level = "warn", check-cfg = ['cfg(stdarch_intel_sde)'] }
31+
unexpected_cfgs = {level = "warn", check-cfg = ['cfg(stdarch_test_everything)'] }
3232

3333
[lints.clippy]
3434
too_long_first_doc_paragraph = "allow"

crates/core_arch/src/x86/xsave.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ mod tests {
185185
}
186186
}
187187

188-
#[cfg_attr(stdarch_intel_sde, ignore)]
188+
#[cfg_attr(stdarch_test_everything, ignore)]
189189
#[simd_test(enable = "xsave")]
190190
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
191191
unsafe fn test_xsave() {
@@ -208,7 +208,7 @@ mod tests {
208208
assert_eq!(xcr, xcr_cpy);
209209
}
210210

211-
#[cfg_attr(stdarch_intel_sde, ignore)]
211+
#[cfg_attr(stdarch_test_everything, ignore)]
212212
#[simd_test(enable = "xsave,xsaveopt")]
213213
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
214214
unsafe fn test_xsaveopt() {

crates/core_arch/src/x86_64/xsave.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ mod tests {
149149
}
150150
}
151151

152-
#[cfg_attr(stdarch_intel_sde, ignore)]
152+
#[cfg_attr(stdarch_test_everything, ignore)]
153153
#[simd_test(enable = "xsave")]
154154
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
155155
unsafe fn test_xsave64() {
@@ -162,7 +162,7 @@ mod tests {
162162
xsave::_xsave64(b.ptr(), m);
163163
}
164164

165-
#[cfg_attr(stdarch_intel_sde, ignore)]
165+
#[cfg_attr(stdarch_test_everything, ignore)]
166166
#[simd_test(enable = "xsave,xsaveopt")]
167167
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
168168
unsafe fn test_xsaveopt64() {

crates/std_detect/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ rustc-dep-of-std = [
4040
"compiler_builtins",
4141
"alloc",
4242
]
43+
44+
[lints.rust]
45+
unexpected_cfgs = {level = "warn", check-cfg = ['cfg(stdarch_test_everything)'] }

crates/std_detect/src/detect/macros.rs

+11
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ macro_rules! features {
140140
)*
141141
}
142142

143+
#[test]
144+
#[cfg($cfg)]
145+
#[cfg(stdarch_test_everything)]
146+
fn everything_present() {
147+
$(
148+
assert!($crate::detect::check_for($crate::detect::Feature::$feature),
149+
concat!("Feature ", $feature_lit, " is not present on this target")
150+
);
151+
)*
152+
}
153+
143154
/// Each variant denotes a position in a bitset for a particular feature.
144155
///
145156
/// PLEASE: do not use this, it is an implementation detail subject

0 commit comments

Comments
 (0)