#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod imp {
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
#[inline]
#[target_feature(enable = "sse2")]
pub(crate) fn load_u32x4(src: &[u32; 4]) -> __m128i {
unsafe { _mm_loadu_si128(src.as_ptr().cast()) }
}
#[inline]
#[target_feature(enable = "sse2")]
pub(crate) fn load_u8x16(src: &[u8; 16]) -> __m128i {
unsafe { _mm_loadu_si128(src.as_ptr().cast()) }
}
#[allow(
dead_code,
reason = "only the AVX2 form reads eight words, and not every build has it"
)]
#[inline]
#[target_feature(enable = "avx")]
pub(crate) fn load_u32x8(src: &[u32; 8]) -> __m256i {
unsafe { _mm256_loadu_si256(src.as_ptr().cast()) }
}
#[inline]
#[target_feature(enable = "sse2")]
pub(crate) fn store_u32x4(dst: &mut [u32; 4], v: __m128i) {
unsafe { _mm_storeu_si128(dst.as_mut_ptr().cast(), v) }
}
}
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
mod imp {
use core::arch::aarch64::*;
#[inline]
#[target_feature(enable = "neon")]
pub(crate) fn load_u32x4(src: &[u32; 4]) -> uint32x4_t {
unsafe { vld1q_u32(src.as_ptr()) }
}
#[inline]
#[target_feature(enable = "neon")]
pub(crate) fn load_u8x16(src: &[u8; 16]) -> uint8x16_t {
unsafe { vld1q_u8(src.as_ptr()) }
}
#[inline]
#[target_feature(enable = "neon")]
pub(crate) fn store_u32x4(dst: &mut [u32; 4], v: uint32x4_t) {
unsafe { vst1q_u32(dst.as_mut_ptr(), v) }
}
}
#[cfg(any(
target_arch = "x86",
target_arch = "x86_64",
all(target_arch = "aarch64", target_feature = "neon")
))]
#[allow(
unused_imports,
reason = "a target without a vector form uses only some"
)]
pub(crate) use imp::*;