mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-05-07 09:46:16 +02:00
Add `no_neon` feature to disable NEON on aarch64
This commit is contained in:
parent
0a0bb7126e
commit
20fd56ac0f
|
@ -73,6 +73,7 @@ no_sse2 = []
|
||||||
no_sse41 = []
|
no_sse41 = []
|
||||||
no_avx2 = []
|
no_avx2 = []
|
||||||
no_avx512 = []
|
no_avx512 = []
|
||||||
|
no_neon = []
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
# Document Hasher::update_rayon on docs.rs.
|
# Document Hasher::update_rayon on docs.rs.
|
||||||
|
|
10
build.rs
10
build.rs
|
@ -17,6 +17,10 @@ fn is_neon() -> bool {
|
||||||
defined("CARGO_FEATURE_NEON")
|
defined("CARGO_FEATURE_NEON")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_no_neon() -> bool {
|
||||||
|
defined("CARGO_FEATURE_NO_NEON")
|
||||||
|
}
|
||||||
|
|
||||||
fn is_ci() -> bool {
|
fn is_ci() -> bool {
|
||||||
defined("BLAKE3_CI")
|
defined("BLAKE3_CI")
|
||||||
}
|
}
|
||||||
|
@ -226,6 +230,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
panic!("It doesn't make sense to enable both \"pure\" and \"neon\".");
|
panic!("It doesn't make sense to enable both \"pure\" and \"neon\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if is_no_neon() && is_neon() {
|
||||||
|
panic!("It doesn't make sense to enable both \"no_neon\" and \"neon\".");
|
||||||
|
}
|
||||||
|
|
||||||
if is_x86_64() || is_x86_32() {
|
if is_x86_64() || is_x86_32() {
|
||||||
let support = c_compiler_support();
|
let support = c_compiler_support();
|
||||||
if is_x86_32() || should_prefer_intrinsics() || is_pure() || support == NoCompiler {
|
if is_x86_32() || should_prefer_intrinsics() || is_pure() || support == NoCompiler {
|
||||||
|
@ -245,7 +253,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_arm() && is_neon()) || (is_aarch64() && !is_pure()) {
|
if (is_arm() && is_neon()) || (!is_no_neon() && !is_pure() && is_aarch64()) {
|
||||||
println!("cargo:rustc-cfg=blake3_neon");
|
println!("cargo:rustc-cfg=blake3_neon");
|
||||||
build_neon_c_intrinsics();
|
build_neon_c_intrinsics();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue