Skip to content

Commit ca6c178

Browse files
committed
Support x86 AVX-12 SIMD types on 1.89.0 stable
Previously, these types were gated by the `stdarch_x86_avx512` nightly Rust feature. As of 1.89.0, they are supported on stable. Closes #2583 gherrit-pr-id: I6907ba8f144bd90d917b85c9687443fc7cf19de2
1 parent 0e51bab commit ca6c178

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
# These are the names of specific Rust versions detected in
5151
# `build.rs`. Each of these represents the minimum Rust version for
5252
# which a particular feature is supported.
53+
"zerocopy-simd-x86-avx12-1-89-0",
5354
"zerocopy-core-error-1-81-0",
5455
"zerocopy-diagnostic-on-unimplemented-1-78-0",
5556
"zerocopy-generic-bounds-in-const-fn-1-61-0",
@@ -85,6 +86,8 @@ jobs:
8586
features: "--all-features"
8687
- toolchain: "stable"
8788
features: "--all-features"
89+
- toolchain: "zerocopy-simd-x86-avx12-1-89-0"
90+
features: "--all-features"
8891
- toolchain: "zerocopy-core-error-1-81-0"
8992
features: "--all-features"
9093
- toolchain: "zerocopy-diagnostic-on-unimplemented-1-78-0"
@@ -108,7 +111,9 @@ jobs:
108111
# Exclue any combination of zerocopy-derive and any toolchain version
109112
# other than "msrv", "stable", and "nightly". These other versions
110113
# exist to exercise zerocopy behavior which differs by toolchain;
111-
# zerocopy-derive doesn't behave different on these toolchains.
114+
# zerocopy-derive doesn't behave differently on these toolchains.
115+
- crate: "zerocopy-derive"
116+
toolchain: "zerocopy-simd-x86-avx12-1-89-0"
112117
- crate: "zerocopy-derive"
113118
toolchain: "zerocopy-core-error-1-81-0"
114119
- crate: "zerocopy-derive"

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ exclude = [".*"]
3636
# used in the codebase to make it less likely for us to make mistakes when
3737
# writing `doc_cfg` attributes.
3838

39+
# From 1.89.0, Rust supports x86 AVX-12 SIMD types (previously gated by the
40+
# `stdarch_x86_avx512` feature).
41+
zerocopy-simd-x86-avx12-1-89-0 = "1.89.0"
42+
3943
# From 1.81.0, Rust supports the `core::error::Error` trait.
4044
zerocopy-core-error-1-81-0 = "1.81.0"
4145

src/impls.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,16 +1026,20 @@ mod simd {
10261026
#[cfg(target_arch = "x86")]
10271027
x86, x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i
10281028
);
1029+
#[cfg(zerocopy_simd_x86_avx12_1_89_0)]
10291030
simd_arch_mod!(
1030-
#[cfg(all(feature = "simd-nightly", target_arch = "x86"))]
1031+
#[cfg(target_arch = "x86")]
1032+
#[cfg_attr(doc_cfg, doc(cfg(rust = "1.89.0")))]
10311033
x86, x86_nightly, __m512bh, __m512, __m512d, __m512i
10321034
);
10331035
simd_arch_mod!(
10341036
#[cfg(target_arch = "x86_64")]
10351037
x86_64, x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i
10361038
);
1039+
#[cfg(zerocopy_simd_x86_avx12_1_89_0)]
10371040
simd_arch_mod!(
1038-
#[cfg(all(feature = "simd-nightly", target_arch = "x86_64"))]
1041+
#[cfg(target_arch = "x86_64")]
1042+
#[cfg_attr(doc_cfg, doc(cfg(rust = "1.89.0")))]
10391043
x86_64, x86_64_nightly, __m512bh, __m512, __m512d, __m512i
10401044
);
10411045
simd_arch_mod!(
@@ -2023,19 +2027,19 @@ mod tests {
20232027
#[cfg(target_arch = "x86")]
20242028
test_simd_arch_mod!(x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i);
20252029

2026-
#[cfg(all(feature = "simd-nightly", target_arch = "x86"))]
2030+
#[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "x86"))]
20272031
test_simd_arch_mod!(x86, __m512bh, __m512, __m512d, __m512i);
20282032

20292033
#[cfg(target_arch = "x86_64")]
20302034
test_simd_arch_mod!(x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i);
20312035

2032-
#[cfg(all(feature = "simd-nightly", target_arch = "x86_64"))]
2036+
#[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "x86_64"))]
20332037
test_simd_arch_mod!(x86_64, __m512bh, __m512, __m512d, __m512i);
20342038

20352039
#[cfg(target_arch = "wasm32")]
20362040
test_simd_arch_mod!(wasm32, v128);
20372041

2038-
#[cfg(all(feature = "simd-nightly", target_arch = "powerpc"))]
2042+
#[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "powerpc"))]
20392043
test_simd_arch_mod!(
20402044
powerpc,
20412045
vector_bool_long,
@@ -2044,7 +2048,7 @@ mod tests {
20442048
vector_unsigned_long
20452049
);
20462050

2047-
#[cfg(all(feature = "simd-nightly", target_arch = "powerpc64"))]
2051+
#[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "powerpc64"))]
20482052
test_simd_arch_mod!(
20492053
powerpc64,
20502054
vector_bool_long,

src/lib.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -303,27 +303,6 @@
303303
clippy::indexing_slicing,
304304
))]
305305
#![cfg_attr(not(any(test, kani, feature = "std")), no_std)]
306-
// NOTE: This attribute should have the effect of causing CI to fail if
307-
// `stdarch_x86_avx512` - which is currently stable in 1.89.0-nightly as of this
308-
// writing on 2025-06-10 - has its stabilization rolled back.
309-
//
310-
// FIXME(#2583): Remove once `stdarch_x86_avx512` is stabilized in 1.89.0, and
311-
// 1.89.0 has been released as stable.
312-
#![cfg_attr(
313-
all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")),
314-
expect(stable_features)
315-
)]
316-
// FIXME(#2583): Remove once `stdarch_x86_avx512` is stabilized in 1.89.0, and
317-
// 1.89.0 has been released as stable. Replace with version detection for 1.89.0
318-
// (see #2574 for a draft implementation).
319-
#![cfg_attr(
320-
all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")),
321-
feature(stdarch_x86_avx512)
322-
)]
323-
#![cfg_attr(
324-
all(feature = "simd-nightly", target_arch = "arm"),
325-
feature(stdarch_arm_dsp, stdarch_arm_neon_intrinsics)
326-
)]
327306
#![cfg_attr(
328307
all(feature = "simd-nightly", any(target_arch = "powerpc", target_arch = "powerpc64")),
329308
feature(stdarch_powerpc)

0 commit comments

Comments
 (0)