summaryrefslogtreecommitdiffstats
path: root/third_party/rust/packed_simd/src/codegen.rs
blob: 8a9e971486d7482a413830ca287749b4d0a8e75e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Code-generation utilities

pub(crate) mod bit_manip;
pub(crate) mod llvm;
pub(crate) mod math;
pub(crate) mod reductions;
pub(crate) mod shuffle;
pub(crate) mod shuffle1_dyn;
pub(crate) mod swap_bytes;

macro_rules! impl_simd_array {
    ([$elem_ty:ident; $elem_count:expr]:
     $tuple_id:ident | $($elem_tys:ident),*) => {
        #[derive(Copy, Clone)]
        #[repr(simd)]
        pub struct $tuple_id($(pub(crate) $elem_tys),*);
        //^^^^^^^ leaked through SimdArray

        impl crate::sealed::Seal for [$elem_ty; $elem_count] {}

        impl crate::sealed::SimdArray for [$elem_ty; $elem_count] {
            type Tuple = $tuple_id;
            type T = $elem_ty;
            const N: usize = $elem_count;
            type NT = [u32; $elem_count];
        }

        impl crate::sealed::Seal for $tuple_id {}
        impl crate::sealed::Simd for $tuple_id {
            type Element = $elem_ty;
            const LANES: usize = $elem_count;
            type LanesType = [u32; $elem_count];
        }

    }
}

pub(crate) mod pointer_sized_int;

pub(crate) mod v16;
pub(crate) use self::v16::*;

pub(crate) mod v32;
pub(crate) use self::v32::*;

pub(crate) mod v64;
pub(crate) use self::v64::*;

pub(crate) mod v128;
pub(crate) use self::v128::*;

pub(crate) mod v256;
pub(crate) use self::v256::*;

pub(crate) mod v512;
pub(crate) use self::v512::*;

pub(crate) mod vSize;
pub(crate) use self::vSize::*;

pub(crate) mod vPtr;
pub(crate) use self::vPtr::*;