diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67e507a4a8..a236f69af3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,7 @@ jobs: # These are the names of specific Rust versions detected in # `build.rs`. Each of these represents the minimum Rust version for # which a particular feature is supported. + "zerocopy-simd-x86-avx12-1-89-0", "zerocopy-core-error-1-81-0", "zerocopy-diagnostic-on-unimplemented-1-78-0", "zerocopy-generic-bounds-in-const-fn-1-61-0", @@ -85,6 +86,8 @@ jobs: features: "--all-features" - toolchain: "stable" features: "--all-features" + - toolchain: "zerocopy-simd-x86-avx12-1-89-0" + features: "--all-features" - toolchain: "zerocopy-core-error-1-81-0" features: "--all-features" - toolchain: "zerocopy-diagnostic-on-unimplemented-1-78-0" @@ -108,7 +111,9 @@ jobs: # Exclue any combination of zerocopy-derive and any toolchain version # other than "msrv", "stable", and "nightly". These other versions # exist to exercise zerocopy behavior which differs by toolchain; - # zerocopy-derive doesn't behave different on these toolchains. + # zerocopy-derive doesn't behave differently on these toolchains. + - crate: "zerocopy-derive" + toolchain: "zerocopy-simd-x86-avx12-1-89-0" - crate: "zerocopy-derive" toolchain: "zerocopy-core-error-1-81-0" - crate: "zerocopy-derive" diff --git a/Cargo.toml b/Cargo.toml index e18140c26b..faf084e714 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,10 @@ exclude = [".*"] # used in the codebase to make it less likely for us to make mistakes when # writing `doc_cfg` attributes. +# From 1.89.0, Rust supports x86 AVX-12 SIMD types (previously gated by the +# `stdarch_x86_avx512` feature). +zerocopy-simd-x86-avx12-1-89-0 = "1.89.0" + # From 1.81.0, Rust supports the `core::error::Error` trait. zerocopy-core-error-1-81-0 = "1.81.0" diff --git a/src/impls.rs b/src/impls.rs index 0ed5fb2edf..d163de8cfb 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -1026,16 +1026,20 @@ mod simd { #[cfg(target_arch = "x86")] x86, x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i ); + #[cfg(zerocopy_simd_x86_avx12_1_89_0)] simd_arch_mod!( - #[cfg(all(feature = "simd-nightly", target_arch = "x86"))] + #[cfg(target_arch = "x86")] + #[cfg_attr(doc_cfg, doc(cfg(rust = "1.89.0")))] x86, x86_nightly, __m512bh, __m512, __m512d, __m512i ); simd_arch_mod!( #[cfg(target_arch = "x86_64")] x86_64, x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i ); + #[cfg(zerocopy_simd_x86_avx12_1_89_0)] simd_arch_mod!( - #[cfg(all(feature = "simd-nightly", target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] + #[cfg_attr(doc_cfg, doc(cfg(rust = "1.89.0")))] x86_64, x86_64_nightly, __m512bh, __m512, __m512d, __m512i ); simd_arch_mod!( @@ -2023,19 +2027,19 @@ mod tests { #[cfg(target_arch = "x86")] test_simd_arch_mod!(x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i); - #[cfg(all(feature = "simd-nightly", target_arch = "x86"))] + #[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "x86"))] test_simd_arch_mod!(x86, __m512bh, __m512, __m512d, __m512i); #[cfg(target_arch = "x86_64")] test_simd_arch_mod!(x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i); - #[cfg(all(feature = "simd-nightly", target_arch = "x86_64"))] + #[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "x86_64"))] test_simd_arch_mod!(x86_64, __m512bh, __m512, __m512d, __m512i); #[cfg(target_arch = "wasm32")] test_simd_arch_mod!(wasm32, v128); - #[cfg(all(feature = "simd-nightly", target_arch = "powerpc"))] + #[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "powerpc"))] test_simd_arch_mod!( powerpc, vector_bool_long, @@ -2044,7 +2048,7 @@ mod tests { vector_unsigned_long ); - #[cfg(all(feature = "simd-nightly", target_arch = "powerpc64"))] + #[cfg(all(zerocopy_simd_x86_avx12_1_89_0, target_arch = "powerpc64"))] test_simd_arch_mod!( powerpc64, vector_bool_long, diff --git a/src/lib.rs b/src/lib.rs index bee367ce81..fb4fbf5380 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -303,27 +303,6 @@ clippy::indexing_slicing, ))] #![cfg_attr(not(any(test, kani, feature = "std")), no_std)] -// NOTE: This attribute should have the effect of causing CI to fail if -// `stdarch_x86_avx512` - which is currently stable in 1.89.0-nightly as of this -// writing on 2025-06-10 - has its stabilization rolled back. -// -// FIXME(#2583): Remove once `stdarch_x86_avx512` is stabilized in 1.89.0, and -// 1.89.0 has been released as stable. -#![cfg_attr( - all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")), - expect(stable_features) -)] -// FIXME(#2583): Remove once `stdarch_x86_avx512` is stabilized in 1.89.0, and -// 1.89.0 has been released as stable. Replace with version detection for 1.89.0 -// (see #2574 for a draft implementation). -#![cfg_attr( - all(feature = "simd-nightly", any(target_arch = "x86", target_arch = "x86_64")), - feature(stdarch_x86_avx512) -)] -#![cfg_attr( - all(feature = "simd-nightly", target_arch = "arm"), - feature(stdarch_arm_dsp, stdarch_arm_neon_intrinsics) -)] #![cfg_attr( all(feature = "simd-nightly", any(target_arch = "powerpc", target_arch = "powerpc64")), feature(stdarch_powerpc)