Skip to content
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

Split the stdsimd feature into separate features #1486

Merged
merged 28 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6fb2ab0
Add tracking issue for AVX-512
Amanieu May 3, 2023
d944d8f
Add tracking issue for RTM
Amanieu May 3, 2023
981b44e
Add stability attributes on x86 re-exports
Amanieu May 3, 2023
80016b6
Add tracking issue on `has_cpuid`
Amanieu May 3, 2023
7c90f9c
Revert accidental stabilization of `_mm512_storeu_ps`
Amanieu May 3, 2023
15c59a6
Add tracking issue for RISC-V intrinsics
Amanieu May 3, 2023
ba272a3
Add tracking issue for PowerPC intrinsics
Amanieu May 3, 2023
41cc0f1
Check for missing stability attributes when building outside core
Amanieu May 3, 2023
ba9fbfa
Add tracking issue for `_MM_SHUFFLE`
Amanieu May 3, 2023
4ea3fe3
Add tracking issues for WebAssembly
Amanieu May 4, 2023
63a19fd
Add tracking issue for MIPS intrinsics
Amanieu May 4, 2023
0121a7d
Add tracking issues for feature detection
Amanieu May 4, 2023
9e839f6
Add tracking issue for NVPTX intrinsics
Amanieu May 4, 2023
771cfa0
Add tracking issue for ARM NEON instructions
Amanieu May 8, 2023
c297556
Fix stability attributes for ARM crypto intrinsics
Amanieu Oct 26, 2023
47ef0a2
Fix 'since' in simd_avx512_types stability attribute
Amanieu Oct 26, 2023
c08c928
Add stability attributes for re-exports of AArch64 NEON intrinsics
Amanieu Oct 26, 2023
02d3d32
Add tracking issue for ARM CRC32 intrinsics
Amanieu Oct 26, 2023
ddd9df8
Add tracking issue for AArch64 TME intrinsics
Amanieu Oct 26, 2023
7b7046b
Add tracking issue for AArch64 prefetch intrinsic
Amanieu Oct 26, 2023
257fea9
Add tracking issue for ARM hint intrinsics
Amanieu Oct 26, 2023
23ccc91
Add tracking issue for ARM barrier intrinsics
Amanieu Oct 26, 2023
623305c
Add tracking issue for all remaining unstable NEON intrinsics
Amanieu Oct 26, 2023
60ea44f
Remove ARM udf and dbg intrinsics
Amanieu Oct 26, 2023
0708bdf
Add tracking issue for 32-bit ARM DSP instrinsics
Amanieu Oct 26, 2023
ff24118
Cleanup last uses of the stdsimd feature
Amanieu Oct 26, 2023
35681a9
Fix more missing/incorrect feature specifications
Amanieu Oct 26, 2023
d68e621
Fix various compilation errors
Amanieu Oct 27, 2023
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
2 changes: 0 additions & 2 deletions crates/core_arch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ The `core::arch` module implements architecture-dependent intrinsics (e.g. SIMD)

`core::arch` is available as part of `libcore` and it is re-exported by
`libstd`. Prefer using it via `core::arch` or `std::arch` than via this crate.
Unstable features are often available in nightly Rust via the
`feature(stdsimd)`.

Using `core::arch` via this crate requires nightly Rust, and it can (and does)
break often. The only cases in which you should consider using it via this crate
Expand Down
2 changes: 2 additions & 0 deletions crates/core_arch/src/aarch64/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use stdarch_test::assert_instr;
#[inline]
#[target_feature(enable = "crc")]
#[cfg_attr(test, assert_instr(crc32x))]
#[unstable(feature = "stdarch_arm_crc32", issue = "117215")]
pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 {
crc32x_(crc, data)
}
Expand All @@ -25,6 +26,7 @@ pub unsafe fn __crc32d(crc: u32, data: u64) -> u32 {
#[inline]
#[target_feature(enable = "crc")]
#[cfg_attr(test, assert_instr(crc32cx))]
#[unstable(feature = "stdarch_arm_crc32", issue = "117215")]
pub unsafe fn __crc32cd(crc: u32, data: u64) -> u32 {
crc32cx_(crc, data)
}
Expand Down
5 changes: 5 additions & 0 deletions crates/core_arch/src/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@
#[cfg(target_endian = "little")]
mod neon;
#[cfg(target_endian = "little")]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub use self::neon::*;

mod tme;
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub use self::tme::*;

mod crc;
#[unstable(feature = "stdarch_arm_crc32", issue = "117215")]
pub use self::crc::*;

mod prefetch;
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub use self::prefetch::*;

#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub use super::arm_shared::*;

#[cfg(test)]
Expand Down
84 changes: 84 additions & 0 deletions crates/core_arch/src/aarch64/neon/generated.rs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions crates/core_arch/src/aarch64/neon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#[rustfmt::skip]
mod generated;
#[rustfmt::skip]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub use self::generated::*;

// FIXME: replace neon with asimd
Expand Down Expand Up @@ -3452,6 +3453,7 @@ pub unsafe fn vsriq_n_p64<const N: i32>(a: poly64x2_t, b: poly64x2_t) -> poly64x
#[target_feature(enable = "neon,sm4")]
#[cfg_attr(test, assert_instr(sm3tt1a, IMM2 = 0))]
#[rustc_legacy_const_generics(3)]
#[unstable(feature = "stdarch_neon_sm4", issue = "117226")]
pub unsafe fn vsm3tt1aq_u32<const IMM2: i32>(
a: uint32x4_t,
b: uint32x4_t,
Expand All @@ -3471,6 +3473,7 @@ pub unsafe fn vsm3tt1aq_u32<const IMM2: i32>(
#[target_feature(enable = "neon,sm4")]
#[cfg_attr(test, assert_instr(sm3tt1b, IMM2 = 0))]
#[rustc_legacy_const_generics(3)]
#[unstable(feature = "stdarch_neon_sm4", issue = "117226")]
pub unsafe fn vsm3tt1bq_u32<const IMM2: i32>(
a: uint32x4_t,
b: uint32x4_t,
Expand All @@ -3490,6 +3493,7 @@ pub unsafe fn vsm3tt1bq_u32<const IMM2: i32>(
#[target_feature(enable = "neon,sm4")]
#[cfg_attr(test, assert_instr(sm3tt2a, IMM2 = 0))]
#[rustc_legacy_const_generics(3)]
#[unstable(feature = "stdarch_neon_sm4", issue = "117226")]
pub unsafe fn vsm3tt2aq_u32<const IMM2: i32>(
a: uint32x4_t,
b: uint32x4_t,
Expand All @@ -3509,6 +3513,7 @@ pub unsafe fn vsm3tt2aq_u32<const IMM2: i32>(
#[target_feature(enable = "neon,sm4")]
#[cfg_attr(test, assert_instr(sm3tt2b, IMM2 = 0))]
#[rustc_legacy_const_generics(3)]
#[unstable(feature = "stdarch_neon_sm4", issue = "117226")]
pub unsafe fn vsm3tt2bq_u32<const IMM2: i32>(
a: uint32x4_t,
b: uint32x4_t,
Expand All @@ -3528,6 +3533,7 @@ pub unsafe fn vsm3tt2bq_u32<const IMM2: i32>(
#[target_feature(enable = "neon,sha3")]
#[cfg_attr(test, assert_instr(xar, IMM6 = 0))]
#[rustc_legacy_const_generics(2)]
#[unstable(feature = "stdarch_neon_sha3", issue = "117225")]
pub unsafe fn vxarq_u64<const IMM6: i32>(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
static_assert_uimm_bits!(IMM6, 6);
#[allow(improper_ctypes)]
Expand Down
7 changes: 7 additions & 0 deletions crates/core_arch/src/aarch64/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ extern "unadjusted" {
}

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_READ: i32 = 0;

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_WRITE: i32 = 1;

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY0: i32 = 0;

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY1: i32 = 1;

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY2: i32 = 2;

/// See [`prefetch`](fn._prefetch.html).
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY3: i32 = 3;

/// Fetch the cache line that contains address `p` using the given `RW` and `LOCALITY`.
Expand Down Expand Up @@ -64,6 +70,7 @@ pub const _PREFETCH_LOCALITY3: i32 = 3;
#[cfg_attr(test, assert_instr("prfm pstl2keep", RW = _PREFETCH_WRITE, LOCALITY = _PREFETCH_LOCALITY2))]
#[cfg_attr(test, assert_instr("prfm pstl1keep", RW = _PREFETCH_WRITE, LOCALITY = _PREFETCH_LOCALITY3))]
#[rustc_legacy_const_generics(1, 2)]
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
// FIXME: Replace this with the standard ACLE __pld/__pldx/__pli/__plix intrinsics
pub unsafe fn _prefetch<const RW: i32, const LOCALITY: i32>(p: *const i8) {
// We use the `llvm.prefetch` intrinsic with `cache type` = 1 (data cache).
Expand Down
16 changes: 16 additions & 0 deletions crates/core_arch/src/aarch64/tme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,51 @@ extern "unadjusted" {
}

/// Transaction successfully started.
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMSTART_SUCCESS: u64 = 0x00_u64;

/// Extraction mask for failure reason
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_REASON: u64 = 0x00007FFF_u64;

/// Transaction retry is possible.
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_RTRY: u64 = 1 << 15;

/// Transaction executed a TCANCEL instruction
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_CNCL: u64 = 1 << 16;

/// Transaction aborted because a conflict occurred
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_MEM: u64 = 1 << 17;

/// Fallback error type for any other reason
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_IMP: u64 = 1 << 18;

/// Transaction aborted because a non-permissible operation was attempted
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_ERR: u64 = 1 << 19;

/// Transaction aborted due to read or write set limit was exceeded
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_SIZE: u64 = 1 << 20;

/// Transaction aborted due to transactional nesting level was exceeded
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_NEST: u64 = 1 << 21;

/// Transaction aborted due to a debug trap.
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_DBG: u64 = 1 << 22;

/// Transaction failed from interrupt
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_INT: u64 = 1 << 23;

/// Indicates a TRIVIAL version of TM is available
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub const _TMFAILURE_TRIVIAL: u64 = 1 << 24;

/// Starts a new transaction. When the transaction starts successfully the return value is 0.
Expand All @@ -72,6 +84,7 @@ pub const _TMFAILURE_TRIVIAL: u64 = 1 << 24;
#[inline]
#[target_feature(enable = "tme")]
#[cfg_attr(test, assert_instr(tstart))]
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub unsafe fn __tstart() -> u64 {
aarch64_tstart()
}
Expand All @@ -84,6 +97,7 @@ pub unsafe fn __tstart() -> u64 {
#[inline]
#[target_feature(enable = "tme")]
#[cfg_attr(test, assert_instr(tcommit))]
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub unsafe fn __tcommit() {
aarch64_tcommit()
}
Expand All @@ -95,6 +109,7 @@ pub unsafe fn __tcommit() {
#[target_feature(enable = "tme")]
#[cfg_attr(test, assert_instr(tcancel, IMM16 = 0x0))]
#[rustc_legacy_const_generics(0)]
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub unsafe fn __tcancel<const IMM16: u64>() {
static_assert!(IMM16 <= 65535);
aarch64_tcancel(IMM16);
Expand All @@ -107,6 +122,7 @@ pub unsafe fn __tcancel<const IMM16: u64>() {
#[inline]
#[target_feature(enable = "tme")]
#[cfg_attr(test, assert_instr(ttest))]
#[unstable(feature = "stdarch_aarch64_tme", issue = "117216")]
pub unsafe fn __ttest() -> u64 {
aarch64_ttest()
}
Expand Down
17 changes: 17 additions & 0 deletions crates/core_arch/src/arm/dsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ use crate::mem::transmute;

types! {
/// ARM-specific 32-bit wide vector of two packed `i16`.
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub struct int16x2_t(i16, i16);
/// ARM-specific 32-bit wide vector of two packed `u16`.
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub struct uint16x2_t(u16, u16);
}

Expand Down Expand Up @@ -82,6 +84,7 @@ extern "unadjusted" {
/// where \[0\] is the lower 16 bits and \[1\] is the upper 16 bits.
#[inline]
#[cfg_attr(test, assert_instr(smulbb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
arm_smulbb(transmute(a), transmute(b))
}
Expand All @@ -92,6 +95,7 @@ pub unsafe fn __smulbb(a: int16x2_t, b: int16x2_t) -> i32 {
/// where \[0\] is the lower 16 bits and \[1\] is the upper 16 bits.
#[inline]
#[cfg_attr(test, assert_instr(smultb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
arm_smultb(transmute(a), transmute(b))
}
Expand All @@ -102,6 +106,7 @@ pub unsafe fn __smultb(a: int16x2_t, b: int16x2_t) -> i32 {
/// where \[0\] is the lower 16 bits and \[1\] is the upper 16 bits.
#[inline]
#[cfg_attr(test, assert_instr(smulbt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
arm_smulbt(transmute(a), transmute(b))
}
Expand All @@ -112,6 +117,7 @@ pub unsafe fn __smulbt(a: int16x2_t, b: int16x2_t) -> i32 {
/// where \[0\] is the lower 16 bits and \[1\] is the upper 16 bits.
#[inline]
#[cfg_attr(test, assert_instr(smultt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
arm_smultt(transmute(a), transmute(b))
}
Expand All @@ -123,6 +129,7 @@ pub unsafe fn __smultt(a: int16x2_t, b: int16x2_t) -> i32 {
/// Return the top 32 bits of the 48-bit product
#[inline]
#[cfg_attr(test, assert_instr(smulwb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
arm_smulwb(transmute(a), b)
}
Expand All @@ -134,6 +141,7 @@ pub unsafe fn __smulwb(a: int16x2_t, b: i32) -> i32 {
/// Return the top 32 bits of the 48-bit product
#[inline]
#[cfg_attr(test, assert_instr(smulwt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smulwt(a: int16x2_t, b: i32) -> i32 {
arm_smulwt(transmute(a), b)
}
Expand All @@ -144,6 +152,7 @@ pub unsafe fn __smulwt(a: int16x2_t, b: i32) -> i32 {
/// Sets the Q flag if saturation occurs.
#[inline]
#[cfg_attr(test, assert_instr(qadd))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __qadd(a: i32, b: i32) -> i32 {
arm_qadd(a, b)
}
Expand All @@ -154,6 +163,7 @@ pub unsafe fn __qadd(a: i32, b: i32) -> i32 {
/// Sets the Q flag if saturation occurs.
#[inline]
#[cfg_attr(test, assert_instr(qsub))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __qsub(a: i32, b: i32) -> i32 {
arm_qsub(a, b)
}
Expand All @@ -164,6 +174,7 @@ pub unsafe fn __qsub(a: i32, b: i32) -> i32 {
/// Sets the Q flag if saturation occurs.
#[inline]
#[cfg_attr(test, assert_instr(qadd))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __qdbl(a: i32) -> i32 {
arm_qadd(a, a)
}
Expand All @@ -175,6 +186,7 @@ pub unsafe fn __qdbl(a: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlabb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
arm_smlabb(transmute(a), transmute(b), c)
}
Expand All @@ -186,6 +198,7 @@ pub unsafe fn __smlabb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlabt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
arm_smlabt(transmute(a), transmute(b), c)
}
Expand All @@ -197,6 +210,7 @@ pub unsafe fn __smlabt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlatb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
arm_smlatb(transmute(a), transmute(b), c)
}
Expand All @@ -208,6 +222,7 @@ pub unsafe fn __smlatb(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlatt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
arm_smlatt(transmute(a), transmute(b), c)
}
Expand All @@ -219,6 +234,7 @@ pub unsafe fn __smlatt(a: int16x2_t, b: int16x2_t, c: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlawb))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
arm_smlawb(a, transmute(b), c)
}
Expand All @@ -230,6 +246,7 @@ pub unsafe fn __smlawb(a: i32, b: int16x2_t, c: i32) -> i32 {
/// Sets the Q flag if overflow occurs on the addition.
#[inline]
#[cfg_attr(test, assert_instr(smlawt))]
#[unstable(feature = "stdarch_arm_dsp", issue = "117237")]
pub unsafe fn __smlawt(a: i32, b: int16x2_t, c: i32) -> i32 {
arm_smlawt(a, transmute(b), c)
}
Expand Down
Loading