core/portable-simd/crates/core_simd/src/vendor/
arm.rs1#![allow(unused)]
2use crate::simd::*;
3
4#[cfg(target_arch = "arm")]
5use core::arch::arm::*;
6
7#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))]
8use core::arch::aarch64::*;
9
10macro_rules! tuple {
12 ($scalar:ty,$tuple:ty) => {
13 from_transmute! { unsafe Simd<$scalar, { size_of::<$tuple>() / size_of::<$scalar>() }> => $tuple }
14 };
15 ($scalar:ty,$($tuples:ty),*) => {
16 $(tuple! { $scalar, $tuples })*
17 };
18}
19
20#[cfg(all(
21 any(
22 target_arch = "aarch64",
23 target_arch = "arm64ec",
24 all(target_arch = "arm", target_feature = "v7"),
25 ),
26 target_endian = "little"
27))]
28mod neon {
29 use super::*;
30
31 from_transmute! { unsafe u8x8 => uint8x8_t }
32 from_transmute! { unsafe u8x16 => uint8x16_t }
33 from_transmute! { unsafe i8x8 => int8x8_t }
34 from_transmute! { unsafe i8x16 => int8x16_t }
35 from_transmute! { unsafe u8x8 => poly8x8_t }
36 from_transmute! { unsafe u8x16 => poly8x16_t }
37
38 from_transmute! { unsafe u16x4 => uint16x4_t }
39 from_transmute! { unsafe u16x8 => uint16x8_t }
40 from_transmute! { unsafe i16x4 => int16x4_t }
41 from_transmute! { unsafe i16x8 => int16x8_t }
42 from_transmute! { unsafe u16x4 => poly16x4_t }
43 from_transmute! { unsafe u16x8 => poly16x8_t }
44 from_transmute! { unsafe f16x4 => float16x4_t }
45 from_transmute! { unsafe f16x8 => float16x8_t }
46
47 from_transmute! { unsafe u32x2 => uint32x2_t }
48 from_transmute! { unsafe u32x4 => uint32x4_t }
49 from_transmute! { unsafe i32x2 => int32x2_t }
50 from_transmute! { unsafe i32x4 => int32x4_t }
51 from_transmute! { unsafe f32x2 => float32x2_t }
52 from_transmute! { unsafe f32x4 => float32x4_t }
53
54 from_transmute! { unsafe Simd<u64, 1> => uint64x1_t }
55 from_transmute! { unsafe u64x2 => uint64x2_t }
56 from_transmute! { unsafe Simd<i64, 1> => int64x1_t }
57 from_transmute! { unsafe i64x2 => int64x2_t }
58 from_transmute! { unsafe Simd<u64, 1> => poly64x1_t }
59 from_transmute! { unsafe u64x2 => poly64x2_t }
60
61 tuple!(i8, int8x8x2_t, int8x8x3_t, int8x8x4_t);
62 tuple!(i8, int8x16x2_t, int8x16x3_t, int8x16x4_t);
63 tuple!(u8, uint8x8x2_t, uint8x8x3_t, uint8x8x4_t);
64 tuple!(u8, uint8x16x2_t, uint8x16x3_t, uint8x16x4_t);
65 tuple!(u8, poly8x8x2_t, poly8x8x3_t, poly8x8x4_t);
66 tuple!(u8, poly8x16x2_t, poly8x16x3_t, poly8x16x4_t);
67
68 tuple!(i16, int16x4x2_t, int16x4x3_t, int16x4x4_t);
69 tuple!(i16, int16x8x2_t, int16x8x3_t, int16x8x4_t);
70 tuple!(u16, uint16x4x2_t, uint16x4x3_t, uint16x4x4_t);
71 tuple!(u16, uint16x8x2_t, uint16x8x3_t, uint16x8x4_t);
72 tuple!(u16, poly16x4x2_t, poly16x4x3_t, poly16x4x4_t);
73 tuple!(u16, poly16x8x2_t, poly16x8x3_t, poly16x8x4_t);
74 tuple!(f16, float16x4x2_t, float16x4x3_t, float16x4x4_t);
75 tuple!(f16, float16x8x2_t, float16x8x3_t, float16x8x4_t);
76
77 tuple!(i32, int32x2x2_t, int32x2x3_t, int32x2x4_t);
78 tuple!(i32, int32x4x2_t, int32x4x3_t, int32x4x4_t);
79 tuple!(u32, uint32x2x2_t, uint32x2x3_t, uint32x2x4_t);
80 tuple!(u32, uint32x4x2_t, uint32x4x3_t, uint32x4x4_t);
81 tuple!(f32, float32x2x2_t, float32x2x3_t, float32x2x4_t);
82 tuple!(f32, float32x4x2_t, float32x4x3_t, float32x4x4_t);
83
84 tuple!(i64, int64x1x2_t, int64x1x3_t, int64x1x4_t);
85 tuple!(i64, int64x2x2_t, int64x2x3_t, int64x2x4_t);
86 tuple!(u64, uint64x1x2_t, uint64x1x3_t, uint64x1x4_t);
87 tuple!(u64, uint64x2x2_t, uint64x2x3_t, uint64x2x4_t);
88 tuple!(u64, poly64x1x2_t, poly64x1x3_t, poly64x1x4_t);
89 tuple!(u64, poly64x2x2_t, poly64x2x3_t, poly64x2x4_t);
90}
91
92#[cfg(any(
93 all(target_feature = "v6", not(target_feature = "mclass")),
94 all(target_feature = "mclass", target_feature = "dsp"),
95))]
96mod simd32 {
97 use super::*;
98
99 from_transmute! { unsafe Simd<u8, 4> => uint8x4_t }
100 from_transmute! { unsafe Simd<i8, 4> => int8x4_t }
101 from_transmute! { unsafe Simd<u16, 2> => uint16x2_t }
102 from_transmute! { unsafe Simd<i16, 2> => int16x2_t }
103}
104
105#[cfg(all(
106 any(target_arch = "aarch64", target_arch = "arm64ec"),
107 target_endian = "little"
108))]
109mod aarch64 {
110 use super::neon::*;
111 use super::*;
112
113 from_transmute! { unsafe Simd<f64, 1> => float64x1_t }
114 from_transmute! { unsafe f64x2 => float64x2_t }
115
116 tuple!(f64, float64x1x2_t, float64x1x3_t, float64x1x4_t);
117 tuple!(f64, float64x2x2_t, float64x2x3_t, float64x2x4_t);
118}