38 #ifndef included_clib_vector_h 39 #define included_clib_vector_h 45 #if defined (__MMX__) || defined (__IWMMXT__) || defined (__aarch64__) 46 #define CLIB_HAVE_VEC64 49 #if defined (__SSE2__) && __GNUC__ >= 4 50 #define CLIB_HAVE_VEC128 53 #if defined (__ALTIVEC__) 54 #define CLIB_HAVE_VEC128 58 #define CLIB_HAVE_VEC256 61 #if defined (__AVX512F__) 62 #define CLIB_HAVE_VEC512 66 #ifdef CLIB_HAVE_VEC128 67 #define CLIB_HAVE_VEC64 70 #define _vector_size(n) __attribute__ ((vector_size (n))) 72 #if defined (__aarch64__) || defined (__arm__) 73 typedef unsigned int u32x4 _vector_size (16);
74 typedef u8 u8x16 _vector_size (16);
75 typedef u16 u16x8 _vector_size (16);
77 typedef u64 u64x2 _vector_size (16);
80 #ifdef CLIB_HAVE_VEC64 82 typedef char i8x8 _vector_size (8);
83 typedef short i16x4 _vector_size (8);
84 typedef int i32x2 _vector_size (8);
87 typedef unsigned char u8x8 _vector_size (8);
88 typedef unsigned short u16x4 _vector_size (8);
89 typedef unsigned int u32x2 _vector_size (8);
92 typedef float f32x2 _vector_size (8);
95 #ifdef CLIB_HAVE_VEC128 97 typedef i8 i8x16 _vector_size (16);
100 typedef long long i64x2 _vector_size (16);
103 typedef u8 u8x16 _vector_size (16);
104 typedef u16 u16x8 _vector_size (16);
105 typedef u32 u32x4 _vector_size (16);
106 typedef u64 u64x2 _vector_size (16);
108 typedef f32 f32x4 _vector_size (16);
109 typedef f64 f64x2 _vector_size (16);
112 typedef i8 i8x32 _vector_size (32);
113 typedef i16 i16x16 _vector_size (32);
114 typedef i32 i32x8 _vector_size (32);
115 typedef long long i64x4 _vector_size (32);
118 typedef u8 u8x32 _vector_size (32);
119 typedef u16 u16x16 _vector_size (32);
120 typedef u32 u32x8 _vector_size (32);
121 typedef u64 u64x4 _vector_size (32);
123 typedef f32 f32x8 _vector_size (32);
124 typedef f64 f64x4 _vector_size (32);
127 #ifdef CLIB_HAVE_VEC512 129 typedef i8 i8x64 _vector_size (64);
130 typedef i16 i16x32 _vector_size (64);
131 typedef i32 i32x16 _vector_size (64);
132 typedef long long i64x8 _vector_size (64);
135 typedef u8 u8x64 _vector_size (64);
136 typedef u16 u16x32 _vector_size (64);
137 typedef u32 u32x16 _vector_size (64);
138 typedef u64 u64x8 _vector_size (64);
140 typedef f32 f32x16 _vector_size (64);
141 typedef f64 f64x8 _vector_size (64);
145 #ifndef CLIB_VECTOR_WORD_BITS 146 #ifdef CLIB_HAVE_VEC128 147 #define CLIB_VECTOR_WORD_BITS 128 149 #define CLIB_VECTOR_WORD_BITS 64 154 #if CLIB_VECTOR_WORD_BITS == 128 155 typedef i8 i8x _vector_size (16);
156 typedef i16 i16x _vector_size (16);
157 typedef i32 i32x _vector_size (16);
158 typedef i64 i64x _vector_size (16);
159 typedef u8 u8x _vector_size (16);
160 typedef u16 u16x _vector_size (16);
161 typedef u32 u32x _vector_size (16);
162 typedef u64 u64x _vector_size (16);
164 #if CLIB_VECTOR_WORD_BITS == 64 165 typedef i8 i8x _vector_size (8);
166 typedef i16 i16x _vector_size (8);
167 typedef i32 i32x _vector_size (8);
168 typedef i64 i64x _vector_size (8);
169 typedef u8 u8x _vector_size (8);
170 typedef u16 u16x _vector_size (8);
171 typedef u32 u32x _vector_size (8);
172 typedef u64 u64x _vector_size (8);
177 #define VECTOR_WORD_TYPE(t) t##x 178 #define VECTOR_WORD_TYPE_LEN(t) (sizeof (VECTOR_WORD_TYPE(t)) / sizeof (t)) 181 #if (defined(CLIB_HAVE_VEC128) || defined(CLIB_HAVE_VEC64)) 186 t as_##t[VECTOR_WORD_TYPE_LEN (t)]; \ 202 #ifdef CLIB_HAVE_VEC64 206 t##x##n as_##t##x##n; \ 208 } t##x##n##_union_t; \ 221 #ifdef CLIB_HAVE_VEC128 225 t##x##n as_##t##x##n; \ 227 } t##x##n##_union_t; \ 245 #if !defined(CLIB_HAVE_VEC128) && !defined(CLIB_HAVE_VEC64) 250 } t##x##n##_union_t; \ 265 #if defined (__SSE2__) && __GNUC__ >= 4 269 #if defined (__ALTIVEC__) 273 #if defined (__IWMMXT__) 277 #if defined (__aarch64__) 281 #if (defined(CLIB_HAVE_VEC128) || defined(CLIB_HAVE_VEC64))