]>
git.proxmox.com Git - rustc.git/blob - vendor/packed_simd_2/src/api/into_bits/arch_specific.rs
1 //! `FromBits` and `IntoBits` between portable vector types and the
2 //! architecture-specific vector types.
5 // FIXME: MIPS FromBits/IntoBits
10 /// This macro implements FromBits for the portable and the architecture
11 /// specific vector types.
13 /// The "leaf" case is at the bottom, and the most generic case is at the top.
14 /// The generic case is split into smaller cases recursively.
15 macro_rules
! impl_arch
{
16 ([$arch_head_i
:ident
[$arch_head_tt
:tt
]: $
($arch_head_ty
:ident
),*],
17 $
([$arch_tail_i
:ident
[$arch_tail_tt
:tt
]: $
($arch_tail_ty
:ident
),*]),* |
18 from
: $
($from_ty
:ident
),* | into
: $
($into_ty
:ident
),* |
19 test
: $test_tt
:tt
) => {
21 [$arch_head_i
[$arch_head_tt
]: $
($arch_head_ty
),*] |
27 $
([$arch_tail_i
[$arch_tail_tt
]: $
($arch_tail_ty
),*]),* |
33 ([$arch
:ident
[$arch_tt
:tt
]: $
($arch_ty
:ident
),*] |
34 from
: $
($from_ty
:ident
),* | into
: $
($into_ty
:ident
),* |
35 test
: $test_tt
:tt
) => {
36 // note: if target is "arm", "+v7,+neon" must be enabled
37 // and the std library must be recompiled with them
39 not(target_arch
= "arm"),
40 all(target_feature
= "v7", target_feature
= "neon",
41 any(feature
= "core_arch", libcore_neon
)))
43 // note: if target is "powerpc", "altivec" must be enabled
44 // and the std library must be recompiled with it
46 not(target_arch
= "powerpc"),
47 all(target_feature
= "altivec", feature
= "core_arch"),
49 #[cfg(target_arch = $arch_tt)]
50 use crate::arch
::$arch
::{
55 not(target_arch
= "arm"),
56 all(target_feature
= "v7", target_feature
= "neon",
57 any(feature
= "core_arch", libcore_neon
)))
60 not(target_arch
= "powerpc"),
61 all(target_feature
= "altivec", feature
= "core_arch"),
63 #[cfg(target_arch = $arch_tt)]
64 impl_arch
!($
($arch_ty
),* | $
($from_ty
),* | $
($into_ty
),* |
67 ($arch_head
:ident
, $
($arch_tail
:ident
),* | $
($from_ty
:ident
),*
68 | $
($into_ty
:ident
),* | test
: $test_tt
:tt
) => {
69 impl_arch
!($arch_head
| $
($from_ty
),* | $
($into_ty
),* |
71 impl_arch
!($
($arch_tail
),* | $
($from_ty
),* | $
($into_ty
),* |
74 ($arch_head
:ident
| $
($from_ty
:ident
),* | $
($into_ty
:ident
),* |
75 test
: $test_tt
:tt
) => {
76 impl_from_bits
!($arch_head
[$test_tt
]: $
($from_ty
),*);
77 impl_into_bits
!($arch_head
[$test_tt
]: $
($into_ty
),*);
81 ////////////////////////////////////////////////////////////////////////////////
82 // Implementations for the 64-bit wide vector types:
84 // FIXME: 64-bit single element types
85 // FIXME: arm/aarch float16x4_t missing
101 aarch64
["aarch64"]: int8x8_t
,
128 f32x2
| test
: test_v64
131 ////////////////////////////////////////////////////////////////////////////////
132 // Implementations for the 128-bit wide vector types:
134 // FIXME: arm/aarch float16x8_t missing
135 // FIXME: ppc vector_pixel missing
136 // FIXME: ppc64 vector_Float16 missing
137 // FIXME: ppc64 vector_signed_long_long missing
138 // FIXME: ppc64 vector_unsigned_long_long missing
139 // FIXME: ppc64 vector_bool_long_long missing
140 // FIXME: ppc64 vector_signed___int128 missing
141 // FIXME: ppc64 vector_unsigned___int128 missing
143 [x86
["x86"]: __m128
, __m128i
, __m128d
],
144 [x86_64
["x86_64"]: __m128
, __m128i
, __m128d
],
146 arm
["arm"]: int8x16_t
,
159 aarch64
["aarch64"]: int8x16_t
,
173 powerpc
["powerpc"]: vector_signed_char
,
174 vector_unsigned_char
,
176 vector_unsigned_short
,
182 powerpc64
["powerpc64"]: vector_signed_char
,
183 vector_unsigned_char
,
185 vector_unsigned_short
,
190 vector_unsigned_long
,
208 m128x1
| into
: i8x16
,
219 u128x1
| test
: test_v128
223 [powerpc
["powerpc"]: vector_bool_char
],
224 [powerpc64
["powerpc64"]: vector_bool_char
] | from
: m8x16
,
228 m128x1
| into
: i8x16
,
241 m8x16
| test
: test_v128
245 [powerpc
["powerpc"]: vector_bool_short
],
246 [powerpc64
["powerpc64"]: vector_bool_short
] | from
: m16x8
,
249 m128x1
| into
: i8x16
,
263 m16x8
| test
: test_v128
267 [powerpc
["powerpc"]: vector_bool_int
],
268 [powerpc64
["powerpc64"]: vector_bool_int
] | from
: m32x4
,
270 m128x1
| into
: i8x16
,
285 m32x4
| test
: test_v128
289 [powerpc64
["powerpc64"]: vector_bool_long
] | from
: m64x2
,
290 m128x1
| into
: i8x16
,
306 m64x2
| test
: test_v128
309 ////////////////////////////////////////////////////////////////////////////////
310 // Implementations for the 256-bit wide vector types
313 [x86
["x86"]: __m256
, __m256i
, __m256d
],
314 [x86_64
["x86_64"]: __m256
, __m256i
, __m256d
] | from
: i8x32
,
330 m128x2
| into
: i8x32
,
341 u128x2
| test
: test_v256
344 ////////////////////////////////////////////////////////////////////////////////
345 // FIXME: Implementations for the 512-bit wide vector types