1 /*  Copyright (C) 2012-2014  Povilas Kanapickas <povilas@radix.lt>
2 
3     Distributed under the Boost Software License, Version 1.0.
4         (See accompanying file LICENSE_1_0.txt or copy at
5             http://www.boost.org/LICENSE_1_0.txt)
6 */
7 
8 #ifndef LIBSIMDPP_SIMDPP_TYPES_FWD_H
9 #define LIBSIMDPP_SIMDPP_TYPES_FWD_H
10 
11 #ifndef LIBSIMDPP_SIMD_H
12     #error "This file must be included through simd.h"
13 #endif
14 #include <simdpp/setup_arch.h>
15 #include <simdpp/types/tag.h>
16 
17 /*  This is an internal helper file that contains forward declarations of the
18     vector templates and typedefs of specific vector types urcoah
19 */
20 namespace simdpp {
21 namespace SIMDPP_ARCH_NAMESPACE {
22 
23 namespace detail {
24 //template<int> void construct_eval();
25 } // namespace detail
26 
27 // types
28 template<unsigned N, class E = void> class float32;
29 template<unsigned N, class E = void> class mask_float32;
30 
31 using float32x4 = float32<4>;
32 using float32x8 = float32<8>;
33 using mask_float32x4 = mask_float32<4>;
34 using mask_float32x8 = mask_float32<8>;
35 
36 template<unsigned N, class E = void> class float64;
37 template<unsigned N, class E = void> class mask_float64;
38 
39 using float64x2 = float64<2>;
40 using float64x4 = float64<4>;
41 using mask_float64x2 = mask_float64<2>;
42 using mask_float64x4 = mask_float64<4>;
43 
44 template<unsigned N, class E = void> class int8;
45 template<unsigned N, class E = void> class uint8;
46 template<unsigned N, class E = void> class mask_int8;
47 
48 using int8x16 = int8<16>;
49 using int8x32 = int8<32>;
50 using uint8x16 = uint8<16>;
51 using uint8x32 = uint8<32>;
52 using mask_int8x16 = mask_int8<16>;
53 using mask_int8x32 = mask_int8<32>;
54 
55 template<unsigned N, class E = void> class int16;
56 template<unsigned N, class E = void> class uint16;
57 template<unsigned N, class E = void> class mask_int16;
58 
59 using int16x8 = int16<8>;
60 using int16x16 = int16<16>;
61 using uint16x8 = uint16<8>;
62 using uint16x16 = uint16<16>;
63 using mask_int16x8 = mask_int16<8>;
64 using mask_int16x16 = mask_int16<16>;
65 
66 template<unsigned N, class E = void> class int32;
67 template<unsigned N, class E = void> class uint32;
68 template<unsigned N, class E = void> class mask_int32;
69 
70 using int32x4 = int32<4>;
71 using int32x8 = int32<8>;
72 using uint32x4 = uint32<4>;
73 using uint32x8 = uint32<8>;
74 using mask_int32x4 = mask_int32<4>;
75 using mask_int32x8 = mask_int32<8>;
76 
77 template<unsigned N, class E = void> class int64;
78 template<unsigned N, class E = void> class uint64;
79 template<unsigned N, class E = void> class mask_int64;
80 
81 using int64x2 = int64<2>;
82 using int64x4 = int64<4>;
83 using uint64x2 = uint64<2>;
84 using uint64x4 = uint64<4>;
85 using mask_int64x2 = mask_int64<2>;
86 using mask_int64x4 = mask_int64<4>;
87 
88 #if SIMDPP_USE_AVX512F
89 #define SIMDPP_FAST_FLOAT32_SIZE 16
90 #define SIMDPP_FAST_FLOAT64_SIZE 8
91 #elif SIMDPP_USE_AVX
92 #define SIMDPP_FAST_FLOAT32_SIZE 8
93 #define SIMDPP_FAST_FLOAT64_SIZE 4
94 #elif SIMDPP_USE_SSE2 || SIMDPP_USE_NEON || SIMDPP_USE_ALTIVEC || SIMDPP_USE_MSA || SIMDPP_USE_NULL
95 #define SIMDPP_FAST_FLOAT32_SIZE 4
96 #define SIMDPP_FAST_FLOAT64_SIZE 2
97 #endif
98 
99 #if SIMDPP_USE_AVX512BW
100 #define SIMDPP_FAST_INT8_SIZE 64
101 #define SIMDPP_FAST_INT16_SIZE 32
102 #define SIMDPP_FAST_INT32_SIZE 16
103 #define SIMDPP_FAST_INT64_SIZE 8
104 #elif SIMDPP_USE_AVX512F
105 #define SIMDPP_FAST_INT8_SIZE 32
106 #define SIMDPP_FAST_INT16_SIZE 16
107 #define SIMDPP_FAST_INT32_SIZE 16
108 #define SIMDPP_FAST_INT64_SIZE 8
109 #elif SIMDPP_USE_AVX2
110 #define SIMDPP_FAST_INT8_SIZE 32
111 #define SIMDPP_FAST_INT16_SIZE 16
112 #define SIMDPP_FAST_INT32_SIZE 8
113 #define SIMDPP_FAST_INT64_SIZE 4
114 #elif SIMDPP_USE_SSE2 || SIMDPP_USE_NEON || SIMDPP_USE_ALTIVEC || SIMDPP_USE_MSA || SIMDPP_USE_NULL
115 #define SIMDPP_FAST_INT8_SIZE 16
116 #define SIMDPP_FAST_INT16_SIZE 8
117 #define SIMDPP_FAST_INT32_SIZE 4
118 #define SIMDPP_FAST_INT64_SIZE 2
119 #endif
120 
121 using float32v =           float32<SIMDPP_FAST_FLOAT32_SIZE>;
122 using mask_float32v = mask_float32<SIMDPP_FAST_FLOAT32_SIZE>;
123 using float64v =           float64<SIMDPP_FAST_FLOAT64_SIZE>;
124 using mask_float64v = mask_float64<SIMDPP_FAST_FLOAT64_SIZE>;
125 
126 using int8v =           int8<SIMDPP_FAST_INT8_SIZE>;
127 using uint8v =         uint8<SIMDPP_FAST_INT8_SIZE>;
128 using mask_int8v = mask_int8<SIMDPP_FAST_INT8_SIZE>;
129 
130 using int16v =           int16<SIMDPP_FAST_INT16_SIZE>;
131 using uint16v =         uint16<SIMDPP_FAST_INT16_SIZE>;
132 using mask_int16v = mask_int16<SIMDPP_FAST_INT16_SIZE>;
133 
134 using int32v =           int32<SIMDPP_FAST_INT32_SIZE>;
135 using uint32v =         uint32<SIMDPP_FAST_INT32_SIZE>;
136 using mask_int32v = mask_int32<SIMDPP_FAST_INT32_SIZE>;
137 
138 using int64v =           int64<SIMDPP_FAST_INT64_SIZE>;
139 using uint64v =         uint64<SIMDPP_FAST_INT64_SIZE>;
140 using mask_int64v = mask_int64<SIMDPP_FAST_INT64_SIZE>;
141 
142 using mask_float32v2 = mask_float32<SIMDPP_FAST_FLOAT32_SIZE*2>;
143 using float64v2 =           float64<SIMDPP_FAST_FLOAT64_SIZE*2>;
144 using mask_float64v2 = mask_float64<SIMDPP_FAST_FLOAT64_SIZE*2>;
145 
146 using int8v2 =           int8<SIMDPP_FAST_INT8_SIZE*2>;
147 using uint8v2 =         uint8<SIMDPP_FAST_INT8_SIZE*2>;
148 using mask_int8v2 = mask_int8<SIMDPP_FAST_INT8_SIZE*2>;
149 
150 using int16v2 =           int16<SIMDPP_FAST_INT16_SIZE*2>;
151 using uint16v2 =         uint16<SIMDPP_FAST_INT16_SIZE*2>;
152 using mask_int16v2 = mask_int16<SIMDPP_FAST_INT16_SIZE*2>;
153 
154 using int32v2 =           int32<SIMDPP_FAST_INT32_SIZE*2>;
155 using uint32v2 =         uint32<SIMDPP_FAST_INT32_SIZE*2>;
156 using mask_int32v2 = mask_int32<SIMDPP_FAST_INT32_SIZE*2>;
157 
158 using int64v2 =           int64<SIMDPP_FAST_INT64_SIZE*2>;
159 using uint64v2 =         uint64<SIMDPP_FAST_INT64_SIZE*2>;
160 using mask_int64v2 = mask_int64<SIMDPP_FAST_INT64_SIZE*2>;
161 
162 
163 using float32v4 =           float32<SIMDPP_FAST_FLOAT32_SIZE*4>;
164 using mask_float32v4 = mask_float32<SIMDPP_FAST_FLOAT32_SIZE*4>;
165 using float64v4 =           float64<SIMDPP_FAST_FLOAT64_SIZE*4>;
166 using mask_float64v4 = mask_float64<SIMDPP_FAST_FLOAT64_SIZE*4>;
167 
168 using int8v4 =           int8<SIMDPP_FAST_INT8_SIZE*4>;
169 using uint8v4 =         uint8<SIMDPP_FAST_INT8_SIZE*4>;
170 using mask_int8v4 = mask_int8<SIMDPP_FAST_INT8_SIZE*4>;
171 
172 using int16v4 =           int16<SIMDPP_FAST_INT16_SIZE*4>;
173 using uint16v4 =         uint16<SIMDPP_FAST_INT16_SIZE*4>;
174 using mask_int16v4 = mask_int16<SIMDPP_FAST_INT16_SIZE*4>;
175 
176 using int32v4 =           int32<SIMDPP_FAST_INT32_SIZE*4>;
177 using uint32v4 =         uint32<SIMDPP_FAST_INT32_SIZE*4>;
178 using mask_int32v4 = mask_int32<SIMDPP_FAST_INT32_SIZE*4>;
179 
180 using int64v4 =           int64<SIMDPP_FAST_INT64_SIZE*4>;
181 using uint64v4 =         uint64<SIMDPP_FAST_INT64_SIZE*4>;
182 using mask_int64v4 = mask_int64<SIMDPP_FAST_INT64_SIZE*4>;
183 
184 } // namespace SIMDPP_ARCH_NAMESPACE
185 } // namespace simdpp
186 
187 #endif
188