Fixes target arch detection.
This commit is contained in:
parent
337844a738
commit
16d544b769
1 changed files with 20 additions and 8 deletions
28
src/simd.rs
28
src/simd.rs
|
|
@ -1,14 +1,14 @@
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
|
||||||
pub use std::arch::aarch64::*;
|
pub use std::arch::aarch64::*;
|
||||||
#[cfg(target_arch = "arm")]
|
#[cfg(all(target_arch = "arm", target_feature = "neon"))]
|
||||||
pub use std::arch::arm::*;
|
pub use std::arch::arm::*;
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
|
||||||
pub use std::arch::wasm32::*;
|
pub use std::arch::wasm32::*;
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(all(target_arch = "x86", target_feature = "sse2"))]
|
||||||
pub use std::arch::x86::*;
|
pub use std::arch::x86::*;
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
|
||||||
pub use std::arch::x86_64::*;
|
pub use std::arch::x86_64::*;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
|
@ -63,9 +63,17 @@ pub union Simd32x2 {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! match_architecture {
|
macro_rules! match_architecture {
|
||||||
($Simd:ident, $native:tt, $fallback:tt,) => {{
|
($Simd:ident, $native:tt, $fallback:tt,) => {{
|
||||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64", target_arch = "wasm32"))]
|
#[cfg(any(
|
||||||
|
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "sse2"),
|
||||||
|
all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "neon"),
|
||||||
|
all(target_arch = "wasm32", target_feature = "simd128"),
|
||||||
|
))]
|
||||||
{ $Simd $native }
|
{ $Simd $native }
|
||||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64", target_arch = "wasm32")))]
|
#[cfg(not(any(
|
||||||
|
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "sse2"),
|
||||||
|
all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "neon"),
|
||||||
|
all(target_arch = "wasm32", target_feature = "simd128"),
|
||||||
|
)))]
|
||||||
unsafe { $Simd $fallback }
|
unsafe { $Simd $fallback }
|
||||||
}};
|
}};
|
||||||
($Simd:ident, $x86:tt, $arm:tt, $web:tt, $fallback:tt,) => {{
|
($Simd:ident, $x86:tt, $arm:tt, $web:tt, $fallback:tt,) => {{
|
||||||
|
|
@ -75,7 +83,11 @@ macro_rules! match_architecture {
|
||||||
unsafe { $Simd $arm }
|
unsafe { $Simd $arm }
|
||||||
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
|
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
|
||||||
unsafe { $Simd $web }
|
unsafe { $Simd $web }
|
||||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64", target_arch = "wasm32")))]
|
#[cfg(not(any(
|
||||||
|
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "sse2"),
|
||||||
|
all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "neon"),
|
||||||
|
all(target_arch = "wasm32", target_feature = "simd128"),
|
||||||
|
)))]
|
||||||
unsafe { $Simd $fallback }
|
unsafe { $Simd $fallback }
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue