aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsdy <[email protected]>2021-10-07 12:23:36 +0100
committerrsdy <[email protected]>2021-10-07 12:41:53 +0100
commit0a0bb7126e9207d3bb3d9af0f0b5ae646d532cf2 (patch)
tree60a4c85dcc6a705a1ab03580fd401a183fcfd3f8 /src
parentdb436a50c2385550e7a0d54b24c7c6b47a6ca037 (diff)
Implement better target detection for NEON
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs2
-rw-r--r--src/platform.rs18
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 4123a0b..31e5cd6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -94,7 +94,7 @@ mod avx2;
#[cfg(blake3_avx512_ffi)]
#[path = "ffi_avx512.rs"]
mod avx512;
-#[cfg(feature = "neon")]
+#[cfg(blake3_neon)]
#[path = "ffi_neon.rs"]
mod neon;
mod portable;
diff --git a/src/platform.rs b/src/platform.rs
index 1a732c5..00058b1 100644
--- a/src/platform.rs
+++ b/src/platform.rs
@@ -10,7 +10,7 @@ cfg_if::cfg_if! {
pub const MAX_SIMD_DEGREE: usize = 8;
}
}
- } else if #[cfg(feature = "neon")] {
+ } else if #[cfg(blake3_neon)] {
pub const MAX_SIMD_DEGREE: usize = 4;
} else {
pub const MAX_SIMD_DEGREE: usize = 1;
@@ -30,7 +30,7 @@ cfg_if::cfg_if! {
pub const MAX_SIMD_DEGREE_OR_2: usize = 8;
}
}
- } else if #[cfg(feature = "neon")] {
+ } else if #[cfg(blake3_neon)] {
pub const MAX_SIMD_DEGREE_OR_2: usize = 4;
} else {
pub const MAX_SIMD_DEGREE_OR_2: usize = 2;
@@ -49,7 +49,7 @@ pub enum Platform {
#[cfg(blake3_avx512_ffi)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
AVX512,
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
NEON,
}
@@ -76,7 +76,7 @@ impl Platform {
}
// We don't use dynamic feature detection for NEON. If the "neon"
// feature is on, NEON is assumed to be supported.
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
{
return Platform::NEON;
}
@@ -95,7 +95,7 @@ impl Platform {
#[cfg(blake3_avx512_ffi)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
Platform::AVX512 => 16,
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
Platform::NEON => 4,
};
debug_assert!(degree <= MAX_SIMD_DEGREE);
@@ -129,7 +129,7 @@ impl Platform {
crate::avx512::compress_in_place(cv, block, block_len, counter, flags)
},
// No NEON compress_in_place() implementation yet.
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
Platform::NEON => portable::compress_in_place(cv, block, block_len, counter, flags),
}
}
@@ -161,7 +161,7 @@ impl Platform {
crate::avx512::compress_xof(cv, block, block_len, counter, flags)
},
// No NEON compress_xof() implementation yet.
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
Platform::NEON => portable::compress_xof(cv, block, block_len, counter, flags),
}
}
@@ -256,7 +256,7 @@ impl Platform {
)
},
// Assumed to be safe if the "neon" feature is on.
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
Platform::NEON => unsafe {
crate::neon::hash_many(
inputs,
@@ -315,7 +315,7 @@ impl Platform {
}
}
- #[cfg(feature = "neon")]
+ #[cfg(blake3_neon)]
pub fn neon() -> Option<Self> {
// Assumed to be safe if the "neon" feature is on.
Some(Self::NEON)