Skip to content

feat: stabilization for stdarch_arm_crc32 #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 80 additions & 10 deletions crates/core_arch/src/arm_shared/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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
Expand All @@ -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)
}
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion crates/core_arch/src/arm_shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion crates/intrinsic-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down