Skip to content

Commit

Permalink
feat: stabilization for stdarch_aarch64_crc32
Browse files Browse the repository at this point in the history
  • Loading branch information
Olasunkanmi Olayinka committed May 13, 2024
1 parent dee4c16 commit 804455d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
30 changes: 20 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,8 @@ 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 +71,8 @@ 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 +84,8 @@ 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 +97,8 @@ 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 +110,8 @@ 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 +123,8 @@ 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 +136,8 @@ 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 +149,8 @@ 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 +167,8 @@ 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 +180,8 @@ 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
3 changes: 2 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,8 @@ 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

0 comments on commit 804455d

Please sign in to comment.