From 62529a9635ae6626ceb54a3e9031ce9737c06688 Mon Sep 17 00:00:00 2001 From: Olasunkanmi Olayinka Date: Mon, 13 May 2024 18:39:27 +0000 Subject: [PATCH] feat: stabilization for stdarch_aarch64_crc32 --- crates/core_arch/src/arm_shared/crc.rs | 90 +++++++++++++++++++++++--- crates/core_arch/src/arm_shared/mod.rs | 9 ++- crates/intrinsic-test/src/main.rs | 2 +- 3 files changed, 89 insertions(+), 12 deletions(-) diff --git a/crates/core_arch/src/arm_shared/crc.rs b/crates/core_arch/src/arm_shared/crc.rs index d8099aba8e..40e2305f34 100644 --- a/crates/core_arch/src/arm_shared/crc.rs +++ b/crates/core_arch/src/arm_shared/crc.rs @@ -58,7 +58,14 @@ use stdarch_test::assert_instr; #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32b))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32b(crc: u32, data: u8) -> u32 { crc32b_(crc, data as u32) } @@ -70,7 +77,14 @@ pub unsafe fn __crc32b(crc: u32, data: u8) -> u32 { #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32h))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32h(crc: u32, data: u16) -> u32 { crc32h_(crc, data as u32) } @@ -82,7 +96,14 @@ pub unsafe fn __crc32h(crc: u32, data: u16) -> u32 { #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32w))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32w(crc: u32, data: u32) -> u32 { crc32w_(crc, data) } @@ -94,7 +115,14 @@ pub unsafe fn __crc32w(crc: u32, data: u32) -> u32 { #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32cb))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32cb(crc: u32, data: u8) -> u32 { crc32cb_(crc, data as u32) } @@ -106,7 +134,14 @@ pub unsafe fn __crc32cb(crc: u32, data: u8) -> u32 { #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32ch))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32ch(crc: u32, data: u16) -> u32 { crc32ch_(crc, data as u32) } @@ -118,7 +153,14 @@ pub unsafe fn __crc32ch(crc: u32, data: u16) -> u32 { #[target_feature(enable = "crc")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))] #[cfg_attr(test, assert_instr(crc32cw))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32cw(crc: u32, data: u32) -> u32 { crc32cw_(crc, data) } @@ -130,7 +172,14 @@ pub unsafe fn __crc32cw(crc: u32, data: u32) -> u32 { #[target_feature(enable = "crc")] #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(crc32x))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 { crc32x_(crc, data) } @@ -142,7 +191,14 @@ pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 { #[target_feature(enable = "crc")] #[cfg(target_arch = "arm")] #[cfg_attr(test, assert_instr(crc32w))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 { // On 32-bit ARM this intrinsic emits a chain of two `crc32_w` instructions // and truncates the data to 32 bits in both clang and gcc @@ -159,7 +215,14 @@ pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 { #[target_feature(enable = "crc")] #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(crc32cx))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32cd(crc: u32, data: u64) -> u32 { crc32cx_(crc, data) } @@ -171,7 +234,14 @@ pub unsafe fn __crc32cd(crc: u32, data: u64) -> u32 { #[target_feature(enable = "crc")] #[cfg(target_arch = "arm")] #[cfg_attr(test, assert_instr(crc32cw))] -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub unsafe fn __crc32cd(crc: u32, data: u64) -> u32 { // On 32-bit ARM this intrinsic emits a chain of two `crc32_cw` instructions // and truncates the data to 32 bits in both clang and gcc diff --git a/crates/core_arch/src/arm_shared/mod.rs b/crates/core_arch/src/arm_shared/mod.rs index 1c183c36ac..9dee6aed3b 100644 --- a/crates/core_arch/src/arm_shared/mod.rs +++ b/crates/core_arch/src/arm_shared/mod.rs @@ -61,7 +61,14 @@ mod hints; pub use self::hints::*; mod crc; -#[unstable(feature = "stdarch_arm_crc32", issue = "117215")] +#[cfg_attr( + target_arch = "arm", + unstable(feature = "stdarch_aarch32_crc32", issue = "125085") +)] +#[cfg_attr( + not(target_arch = "arm"), + stable(feature = "stdarch_aarch64_crc32", since = "1.80.0") +)] pub use crc::*; // NEON intrinsics are currently broken on big-endian, so don't expose them. (#1484) diff --git a/crates/intrinsic-test/src/main.rs b/crates/intrinsic-test/src/main.rs index 9471e1736f..eefb5f921a 100644 --- a/crates/intrinsic-test/src/main.rs +++ b/crates/intrinsic-test/src/main.rs @@ -186,7 +186,7 @@ fn generate_rust_program(notices: &str, intrinsic: &Intrinsic, a32: bool) -> Str r#"{notices}#![feature(simd_ffi)] #![feature(link_llvm_intrinsics)] #![cfg_attr(target_arch = "arm", feature(stdarch_arm_neon_intrinsics))] -#![feature(stdarch_arm_crc32)] +#![cfg_attr(target_arch = "arm", feature(stdarch_aarch32_crc32))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_fcma))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_dotprod))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_i8mm))]