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

[aarch64] refactor AArch64 intrinsics into its own architecture module #162

Merged
merged 1 commit into from
Oct 29, 2017
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
17 changes: 17 additions & 0 deletions src/aarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! AArch64 intrinsics.
//!
//! The reference for NEON is [ARM's NEON Intrinsics Reference][arm_ref]. The
//! [ARM's NEON Intrinsics Online Database][arm_dat] is also useful.
//!
//! [arm_ref]:
//! http://infocenter.arm.com/help/topic/com.arm.doc.
//! ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf
//! [arm_dat]: https://developer.arm.com/technologies/neon/intrinsics

mod v8;
pub use self::v8::*;

#[cfg(target_feature = "neon")]
mod neon;
#[cfg(target_feature = "neon")]
pub use self::neon::*;
File renamed without changes.
4 changes: 1 addition & 3 deletions src/arm/v8.rs → src/aarch64/v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//! [armv8]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.
//! ddi0487a.k_10775/index.html

pub use super::v7::*;

#[cfg(test)]
use stdsimd_test::assert_instr;

Expand Down Expand Up @@ -59,7 +57,7 @@ pub unsafe fn _cls_u64(x: u64) -> u64 {

#[cfg(test)]
mod tests {
use arm::v8;
use aarch64::v8;

#[test]
fn _rev_u64() {
Expand Down
20 changes: 5 additions & 15 deletions src/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,13 @@
//! ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf
//! [arm_dat]: https://developer.arm.com/technologies/neon/intrinsics

mod v6;
pub use self::v6::*;

mod v7;
pub use self::v7::*;
#[cfg(target_arch = "aarch64")]
pub use self::v8::*;

#[cfg(target_feature = "neon")]
pub use self::v7_neon::*;

#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
pub use self::v8_neon::*;

mod v6;
mod v7;
mod neon;
#[cfg(target_feature = "neon")]
mod v7_neon;

#[cfg(target_arch = "aarch64")]
mod v8;
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
mod v8_neon;
pub use self::neon::*;
File renamed without changes.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ pub mod vendor {

#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub use arm::*;

#[cfg(target_arch = "aarch64")]
pub use aarch64::*;
}

#[macro_use]
Expand All @@ -160,3 +163,5 @@ mod x86;

#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
mod arm;
#[cfg(target_arch = "aarch64")]
mod aarch64;
19 changes: 14 additions & 5 deletions src/x86/avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,9 @@ pub unsafe fn _mm_maskload_epi32(mem_addr: *const i32, mask: i32x4) -> i32x4 {
#[inline(always)]
#[target_feature = "+avx2"]
#[cfg_attr(test, assert_instr(vpmaskmovd))]
pub unsafe fn _mm256_maskload_epi32(mem_addr: *const i32, mask: i32x8) -> i32x8 {
pub unsafe fn _mm256_maskload_epi32(
mem_addr: *const i32, mask: i32x8
) -> i32x8 {
maskloadd256(mem_addr as *const i8, mask)
}

Expand All @@ -775,7 +777,9 @@ pub unsafe fn _mm_maskload_epi64(mem_addr: *const i64, mask: i64x2) -> i64x2 {
#[inline(always)]
#[target_feature = "+avx2"]
#[cfg_attr(test, assert_instr(vpmaskmovq))]
pub unsafe fn _mm256_maskload_epi64(mem_addr: *const i64, mask: i64x4) -> i64x4 {
pub unsafe fn _mm256_maskload_epi64(
mem_addr: *const i64, mask: i64x4
) -> i64x4 {
maskloadq256(mem_addr as *const i8, mask)
}

Expand All @@ -795,7 +799,9 @@ pub unsafe fn _mm_maskstore_epi32(mem_addr: *mut i32, mask: i32x4, a: i32x4) {
#[inline(always)]
#[target_feature = "+avx2"]
#[cfg_attr(test, assert_instr(vpmaskmovd))]
pub unsafe fn _mm256_maskstore_epi32(mem_addr: *mut i32, mask: i32x8, a: i32x8) {
pub unsafe fn _mm256_maskstore_epi32(
mem_addr: *mut i32, mask: i32x8, a: i32x8
) {
maskstored256(mem_addr as *mut i8, mask, a)
}

Expand All @@ -815,7 +821,9 @@ pub unsafe fn _mm_maskstore_epi64(mem_addr: *mut i64, mask: i64x2, a: i64x2) {
#[inline(always)]
#[target_feature = "+avx2"]
#[cfg_attr(test, assert_instr(vpmaskmovq))]
pub unsafe fn _mm256_maskstore_epi64(mem_addr: *mut i64, mask: i64x4, a: i64x4) {
pub unsafe fn _mm256_maskstore_epi64(
mem_addr: *mut i64, mask: i64x4, a: i64x4
) {
maskstoreq256(mem_addr as *mut i8, mask, a)
}

Expand Down Expand Up @@ -1184,7 +1192,8 @@ pub unsafe fn _mm256_shuffle_epi8(a: u8x32, b: u8x32) -> u8x32 {
pshufb(a, b)
}

/// Shuffle 32-bit integers in 128-bit lanes of `a` using the control in `imm8`.
/// Shuffle 32-bit integers in 128-bit lanes of `a` using the control in
/// `imm8`.
///
/// ```rust
/// # #![feature(cfg_target_feature)]
Expand Down
2 changes: 1 addition & 1 deletion stdsimd-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {

pub fn assert_skip_test_ok(name: &str) {
if env::var("STDSIMD_TEST_EVERYTHING").is_err() {
return
return;
}
panic!("skipped test `{}` when it shouldn't be skipped", name);
}