Skip to main content

simply_simd/
static_simd.rs

1use crate::Arch;
2use crate::mask::Mask;
3use crate::register::Simd;
4
5// Static dispatch for identifying lane sizes and number of simd registers.
6cfg_select! {
7    all(target_arch = "x86_64", target_feature = "avx512f", target_feature = "fma") => {
8        use crate::architectures::arch::Avx512;
9        pub type StaticSimd<T> = Simd<T, Avx512>;
10        pub type StaticMask<T> = Mask<T, Avx512>;
11        pub type StaticArch = Avx512;
12    }
13    all(target_arch = "x86_64", target_feature = "avx2", target_feature = "fma") => {
14        use crate::architectures::arch::Avx2;
15        pub type StaticSimd<T> = Simd<T, Avx2>;
16        pub type StaticMask<T> = Mask<T, Avx2>;
17        pub type StaticArch = Avx2;
18    }
19    all(target_arch = "x86_64", target_feature = "sse4.2") => {
20        use crate::architectures::arch::Sse;
21        pub type StaticSimd<T> = Simd<T, Sse>;
22        pub type StaticMask<T> = Mask<T, Sse>;
23        pub type StaticArch = Sse;
24    }
25    all(target_arch = "aarch64", target_feature = "neon") => {
26        use crate::architectures::arch::Neon;
27        pub type StaticSimd<T> = Simd<T, Neon>;
28        pub type StaticMask<T> = Mask<T, Neon>;
29        pub type StaticArch = Neon;
30    }
31    _ => {
32        use crate::architectures::arch::Scalar128;
33        pub type StaticSimd<T> = Simd<T, Scalar128>;
34        pub type StaticMask<T> = Mask<T, Scalar128>;
35        pub type StaticArch = Scalar128;
36    }
37}
38
39pub type ScalarArch = <StaticArch as Arch>::ScalarArch;
40pub type ScalarSimd<T> = Simd<T, ScalarArch>;
41pub type ScalarMask<T> = Mask<T, ScalarArch>;