Debian Codegraph @

third-party/simde/x86/avx512/types.h

raw
1 /* SPDX-License-Identifier: MIT
2 *
3 * Permission is hereby granted, free of charge, to any person
4 * obtaining a copy of this software and associated documentation
5 * files (the "Software"), to deal in the Software without
6 * restriction, including without limitation the rights to use, copy,
7 * modify, merge, publish, distribute, sublicense, and/or sell copies
8 * of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be
12 * included in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Copyright:
24 * 2020 Evan Nemerson <[email protected]>
25 */
26
27 #if !defined(SIMDE_X86_AVX512_TYPES_H)
28 #define SIMDE_X86_AVX512_TYPES_H
29
30 #include "../avx.h"
31
32 HEDLEY_DIAGNOSTIC_PUSH
33 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
34 SIMDE_BEGIN_DECLS_
35
36 /* The problem is that Microsoft doesn't support 64-byte aligned parameters, except for
37 * __m512/__m512i/__m512d. Since our private union has an __m512 member it will be 64-byte
38 * aligned even if we reduce the alignment requirements of other members.
39 *
40 * Even if we're on x86 and use the native AVX-512 types for arguments/return values, the
41 * to/from private functions will break, and I'm not willing to change their APIs to use
42 * pointers (which would also require more verbose code on the caller side) just to make
43 * MSVC happy.
44 *
45 * If you want to use AVX-512 in SIMDe, you'll need to either upgrade to MSVC 2017 or later,
46 * or upgrade to a different compiler (clang-cl, perhaps?). If you have an idea of how to
47 * fix this without requiring API changes (except transparently through macros), patches
48 * are welcome.
49 */
50
51 # if defined(HEDLEY_MSVC_VERSION) && !HEDLEY_MSVC_VERSION_CHECK(19,10,0)
52 # if defined(SIMDE_X86_AVX512F_NATIVE)
53 # undef SIMDE_X86_AVX512F_NATIVE
54 # pragma message("Native AVX-512 support requires MSVC 2017 or later. See comment above (in code) for details.")
55 # endif
56 # define SIMDE_AVX512_ALIGN SIMDE_ALIGN_TO_32
57 # else
58 # define SIMDE_AVX512_ALIGN SIMDE_ALIGN_TO_64
59 # endif
60
61 typedef union {
62 #if defined(SIMDE_VECTOR_SUBSCRIPT)
63 SIMDE_ALIGN_TO_16 int8_t i8 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
64 SIMDE_ALIGN_TO_16 int16_t i16 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
65 SIMDE_ALIGN_TO_16 int32_t i32 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
66 SIMDE_ALIGN_TO_16 int64_t i64 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
67 SIMDE_ALIGN_TO_16 uint8_t u8 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
68 SIMDE_ALIGN_TO_16 uint16_t u16 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
69 SIMDE_ALIGN_TO_16 uint32_t u32 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
70 SIMDE_ALIGN_TO_16 uint64_t u64 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
71 #if defined(SIMDE_HAVE_INT128_)
72 SIMDE_ALIGN_TO_16 simde_int128 i128 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
73 SIMDE_ALIGN_TO_16 simde_uint128 u128 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
74 #endif
75 SIMDE_ALIGN_TO_16 simde_float32 f32 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
76 SIMDE_ALIGN_TO_16 int_fast32_t i32f SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
77 SIMDE_ALIGN_TO_16 uint_fast32_t u32f SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
78 #else
79 SIMDE_ALIGN_TO_16 int8_t i8[16];
80 SIMDE_ALIGN_TO_16 int16_t i16[8];
81 SIMDE_ALIGN_TO_16 int32_t i32[4];
82 SIMDE_ALIGN_TO_16 int64_t i64[2];
83 SIMDE_ALIGN_TO_16 uint8_t u8[16];
84 SIMDE_ALIGN_TO_16 uint16_t u16[8];
85 SIMDE_ALIGN_TO_16 uint32_t u32[4];
86 SIMDE_ALIGN_TO_16 uint64_t u64[2];
87 #if defined(SIMDE_HAVE_INT128_)
88 SIMDE_ALIGN_TO_16 simde_int128 i128[1];
89 SIMDE_ALIGN_TO_16 simde_uint128 u128[1];
90 #endif
91 SIMDE_ALIGN_TO_16 simde_float32 f32[4];
92 SIMDE_ALIGN_TO_16 int_fast32_t i32f[16 / sizeof(int_fast32_t)];
93 SIMDE_ALIGN_TO_16 uint_fast32_t u32f[16 / sizeof(uint_fast32_t)];
94 #endif
95
96 SIMDE_ALIGN_TO_16 simde__m64_private m64_private[2];
97 SIMDE_ALIGN_TO_16 simde__m64 m64[2];
98
99 #if defined(SIMDE_X86_AVX512BF16_NATIVE)
100 SIMDE_ALIGN_TO_16 __m128bh n;
101 #elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
102 SIMDE_ALIGN_TO_16 int8x16_t neon_i8;
103 SIMDE_ALIGN_TO_16 int16x8_t neon_i16;
104 SIMDE_ALIGN_TO_16 int32x4_t neon_i32;
105 SIMDE_ALIGN_TO_16 int64x2_t neon_i64;
106 SIMDE_ALIGN_TO_16 uint8x16_t neon_u8;
107 SIMDE_ALIGN_TO_16 uint16x8_t neon_u16;
108 SIMDE_ALIGN_TO_16 uint32x4_t neon_u32;
109 SIMDE_ALIGN_TO_16 uint64x2_t neon_u64;
110 SIMDE_ALIGN_TO_16 float32x4_t neon_f32;
111 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
112 SIMDE_ALIGN_TO_16 float64x2_t neon_f64;
113 #endif
114 #elif defined(SIMDE_MIPS_MSA_NATIVE)
115 v16i8 msa_i8;
116 v8i16 msa_i16;
117 v4i32 msa_i32;
118 v2i64 msa_i64;
119 v16u8 msa_u8;
120 v8u16 msa_u16;
121 v4u32 msa_u32;
122 v2u64 msa_u64;
123 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
124 SIMDE_ALIGN_TO_16 v128_t wasm_v128;
125 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
126 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8;
127 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16;
128 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32;
129 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8;
130 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16;
131 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed int) altivec_i32;
132 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32;
133 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
134 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64;
135 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed long long) altivec_i64;
136 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64;
137 #endif
138 #endif
139 } simde__m128bh_private;
140
141 typedef union {
142 #if defined(SIMDE_VECTOR_SUBSCRIPT)
143 SIMDE_ALIGN_TO_32 int8_t i8 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
144 SIMDE_ALIGN_TO_32 int16_t i16 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
145 SIMDE_ALIGN_TO_32 int32_t i32 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
146 SIMDE_ALIGN_TO_32 int64_t i64 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
147 SIMDE_ALIGN_TO_32 uint8_t u8 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
148 SIMDE_ALIGN_TO_32 uint16_t u16 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
149 SIMDE_ALIGN_TO_32 uint32_t u32 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
150 SIMDE_ALIGN_TO_32 uint64_t u64 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
151 #if defined(SIMDE_HAVE_INT128_)
152 SIMDE_ALIGN_TO_32 simde_int128 i128 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
153 SIMDE_ALIGN_TO_32 simde_uint128 u128 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
154 #endif
155 SIMDE_ALIGN_TO_32 simde_float32 f32 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
156 SIMDE_ALIGN_TO_32 simde_float64 f64 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
157 SIMDE_ALIGN_TO_32 int_fast32_t i32f SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
158 SIMDE_ALIGN_TO_32 uint_fast32_t u32f SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
159 #else
160 SIMDE_ALIGN_TO_32 int8_t i8[32];
161 SIMDE_ALIGN_TO_32 int16_t i16[16];
162 SIMDE_ALIGN_TO_32 int32_t i32[8];
163 SIMDE_ALIGN_TO_32 int64_t i64[4];
164 SIMDE_ALIGN_TO_32 uint8_t u8[32];
165 SIMDE_ALIGN_TO_32 uint16_t u16[16];
166 SIMDE_ALIGN_TO_32 uint32_t u32[8];
167 SIMDE_ALIGN_TO_32 uint64_t u64[4];
168 SIMDE_ALIGN_TO_32 int_fast32_t i32f[32 / sizeof(int_fast32_t)];
169 SIMDE_ALIGN_TO_32 uint_fast32_t u32f[32 / sizeof(uint_fast32_t)];
170 #if defined(SIMDE_HAVE_INT128_)
171 SIMDE_ALIGN_TO_32 simde_int128 i128[2];
172 SIMDE_ALIGN_TO_32 simde_uint128 u128[2];
173 #endif
174 SIMDE_ALIGN_TO_32 simde_float32 f32[8];
175 SIMDE_ALIGN_TO_32 simde_float64 f64[4];
176 #endif
177
178 SIMDE_ALIGN_TO_32 simde__m128_private m128_private[2];
179 SIMDE_ALIGN_TO_32 simde__m128 m128[2];
180
181 #if defined(SIMDE_X86_BF16_NATIVE)
182 SIMDE_ALIGN_TO_32 __m256bh n;
183 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
184 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8[2];
185 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16[2];
186 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32[2];
187 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8[2];
188 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16[2];
189 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(int) altivec_i32[2];
190 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32[2];
191 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE)
192 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64[2];
193 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(long long) altivec_i64[2];
194 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64[2];
195 #endif
196 #endif
197 } simde__m256bh_private;
198
199 typedef union {
200 #if defined(SIMDE_VECTOR_SUBSCRIPT)
201 SIMDE_AVX512_ALIGN int8_t i8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
202 SIMDE_AVX512_ALIGN int16_t i16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
203 SIMDE_AVX512_ALIGN int32_t i32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
204 SIMDE_AVX512_ALIGN int64_t i64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
205 SIMDE_AVX512_ALIGN uint8_t u8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
206 SIMDE_AVX512_ALIGN uint16_t u16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
207 SIMDE_AVX512_ALIGN uint32_t u32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
208 SIMDE_AVX512_ALIGN uint64_t u64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
209 #if defined(SIMDE_HAVE_INT128_)
210 SIMDE_AVX512_ALIGN simde_int128 i128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
211 SIMDE_AVX512_ALIGN simde_uint128 u128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
212 #endif
213 SIMDE_AVX512_ALIGN simde_float32 f32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
214 SIMDE_AVX512_ALIGN simde_float64 f64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
215 SIMDE_AVX512_ALIGN int_fast32_t i32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
216 SIMDE_AVX512_ALIGN uint_fast32_t u32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
217 #else
218 SIMDE_AVX512_ALIGN int8_t i8[64];
219 SIMDE_AVX512_ALIGN int16_t i16[32];
220 SIMDE_AVX512_ALIGN int32_t i32[16];
221 SIMDE_AVX512_ALIGN int64_t i64[8];
222 SIMDE_AVX512_ALIGN uint8_t u8[64];
223 SIMDE_AVX512_ALIGN uint16_t u16[32];
224 SIMDE_AVX512_ALIGN uint32_t u32[16];
225 SIMDE_AVX512_ALIGN uint64_t u64[8];
226 SIMDE_AVX512_ALIGN int_fast32_t i32f[64 / sizeof(int_fast32_t)];
227 SIMDE_AVX512_ALIGN uint_fast32_t u32f[64 / sizeof(uint_fast32_t)];
228 #if defined(SIMDE_HAVE_INT128_)
229 SIMDE_AVX512_ALIGN simde_int128 i128[4];
230 SIMDE_AVX512_ALIGN simde_uint128 u128[4];
231 #endif
232 SIMDE_AVX512_ALIGN simde_float32 f32[16];
233 SIMDE_AVX512_ALIGN simde_float64 f64[8];
234 #endif
235
236 SIMDE_AVX512_ALIGN simde__m128_private m128_private[4];
237 SIMDE_AVX512_ALIGN simde__m128 m128[4];
238 SIMDE_AVX512_ALIGN simde__m256_private m256_private[2];
239 SIMDE_AVX512_ALIGN simde__m256 m256[2];
240
241 #if defined(SIMDE_X86_AVX512BF16_NATIVE)
242 SIMDE_AVX512_ALIGN __m512bh n;
243 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
244 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8[4];
245 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16[4];
246 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32[4];
247 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8[4];
248 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16[4];
249 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed int) altivec_i32[4];
250 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32[4];
251 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE)
252 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64[4];
253 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed long long) altivec_i64[4];
254 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64[4];
255 #endif
256 #endif
257 } simde__m512bh_private;
258
259 typedef union {
260 #if defined(SIMDE_VECTOR_SUBSCRIPT)
261 SIMDE_AVX512_ALIGN int8_t i8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
262 SIMDE_AVX512_ALIGN int16_t i16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
263 SIMDE_AVX512_ALIGN int32_t i32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
264 SIMDE_AVX512_ALIGN int64_t i64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
265 SIMDE_AVX512_ALIGN uint8_t u8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
266 SIMDE_AVX512_ALIGN uint16_t u16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
267 SIMDE_AVX512_ALIGN uint32_t u32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
268 SIMDE_AVX512_ALIGN uint64_t u64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
269 #if defined(SIMDE_HAVE_INT128_)
270 SIMDE_AVX512_ALIGN simde_int128 i128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
271 SIMDE_AVX512_ALIGN simde_uint128 u128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
272 #endif
273 SIMDE_AVX512_ALIGN simde_float32 f32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
274 SIMDE_AVX512_ALIGN simde_float64 f64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
275 SIMDE_AVX512_ALIGN int_fast32_t i32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
276 SIMDE_AVX512_ALIGN uint_fast32_t u32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
277 #else
278 SIMDE_AVX512_ALIGN int8_t i8[64];
279 SIMDE_AVX512_ALIGN int16_t i16[32];
280 SIMDE_AVX512_ALIGN int32_t i32[16];
281 SIMDE_AVX512_ALIGN int64_t i64[8];
282 SIMDE_AVX512_ALIGN uint8_t u8[64];
283 SIMDE_AVX512_ALIGN uint16_t u16[32];
284 SIMDE_AVX512_ALIGN uint32_t u32[16];
285 SIMDE_AVX512_ALIGN uint64_t u64[8];
286 SIMDE_AVX512_ALIGN int_fast32_t i32f[64 / sizeof(int_fast32_t)];
287 SIMDE_AVX512_ALIGN uint_fast32_t u32f[64 / sizeof(uint_fast32_t)];
288 #if defined(SIMDE_HAVE_INT128_)
289 SIMDE_AVX512_ALIGN simde_int128 i128[4];
290 SIMDE_AVX512_ALIGN simde_uint128 u128[4];
291 #endif
292 SIMDE_AVX512_ALIGN simde_float32 f32[16];
293 SIMDE_AVX512_ALIGN simde_float64 f64[8];
294 #endif
295
296 SIMDE_AVX512_ALIGN simde__m128_private m128_private[4];
297 SIMDE_AVX512_ALIGN simde__m128 m128[4];
298 SIMDE_AVX512_ALIGN simde__m256_private m256_private[2];
299 SIMDE_AVX512_ALIGN simde__m256 m256[2];
300
301 #if defined(SIMDE_X86_AVX512F_NATIVE)
302 SIMDE_AVX512_ALIGN __m512 n;
303 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
304 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8[4];
305 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16[4];
306 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32[4];
307 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8[4];
308 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16[4];
309 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed int) altivec_i32[4];
310 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32[4];
311 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE)
312 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64[4];
313 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed long long) altivec_i64[4];
314 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64[4];
315 #endif
316 #endif
317 } simde__m512_private;
318
319 typedef union {
320 #if defined(SIMDE_VECTOR_SUBSCRIPT)
321 SIMDE_AVX512_ALIGN int8_t i8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
322 SIMDE_AVX512_ALIGN int16_t i16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
323 SIMDE_AVX512_ALIGN int32_t i32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
324 SIMDE_AVX512_ALIGN int64_t i64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
325 SIMDE_AVX512_ALIGN uint8_t u8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
326 SIMDE_AVX512_ALIGN uint16_t u16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
327 SIMDE_AVX512_ALIGN uint32_t u32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
328 SIMDE_AVX512_ALIGN uint64_t u64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
329 #if defined(SIMDE_HAVE_INT128_)
330 SIMDE_AVX512_ALIGN simde_int128 i128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
331 SIMDE_AVX512_ALIGN simde_uint128 u128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
332 #endif
333 SIMDE_AVX512_ALIGN simde_float32 f32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
334 SIMDE_AVX512_ALIGN simde_float64 f64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
335 SIMDE_AVX512_ALIGN int_fast32_t i32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
336 SIMDE_AVX512_ALIGN uint_fast32_t u32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
337 #else
338 SIMDE_AVX512_ALIGN int8_t i8[64];
339 SIMDE_AVX512_ALIGN int16_t i16[32];
340 SIMDE_AVX512_ALIGN int32_t i32[16];
341 SIMDE_AVX512_ALIGN int64_t i64[8];
342 SIMDE_AVX512_ALIGN uint8_t u8[64];
343 SIMDE_AVX512_ALIGN uint16_t u16[32];
344 SIMDE_AVX512_ALIGN uint32_t u32[16];
345 SIMDE_AVX512_ALIGN uint64_t u64[8];
346 #if defined(SIMDE_HAVE_INT128_)
347 SIMDE_AVX512_ALIGN simde_int128 i128[4];
348 SIMDE_AVX512_ALIGN simde_uint128 u128[4];
349 #endif
350 SIMDE_AVX512_ALIGN simde_float32 f32[16];
351 SIMDE_AVX512_ALIGN simde_float64 f64[8];
352 SIMDE_AVX512_ALIGN int_fast32_t i32f[64 / sizeof(int_fast32_t)];
353 SIMDE_AVX512_ALIGN uint_fast32_t u32f[64 / sizeof(uint_fast32_t)];
354 #endif
355
356 SIMDE_AVX512_ALIGN simde__m128d_private m128d_private[4];
357 SIMDE_AVX512_ALIGN simde__m128d m128d[4];
358 SIMDE_AVX512_ALIGN simde__m256d_private m256d_private[2];
359 SIMDE_AVX512_ALIGN simde__m256d m256d[2];
360
361 #if defined(SIMDE_X86_AVX512F_NATIVE)
362 SIMDE_AVX512_ALIGN __m512d n;
363 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
364 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8[4];
365 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16[4];
366 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32[4];
367 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8[4];
368 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16[4];
369 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed int) altivec_i32[4];
370 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32[4];
371 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE)
372 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64[4];
373 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed long long) altivec_i64[4];
374 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64[4];
375 #endif
376 #endif
377 } simde__m512d_private;
378
379 typedef union {
380 #if defined(SIMDE_VECTOR_SUBSCRIPT)
381 SIMDE_AVX512_ALIGN int8_t i8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
382 SIMDE_AVX512_ALIGN int16_t i16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
383 SIMDE_AVX512_ALIGN int32_t i32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
384 SIMDE_AVX512_ALIGN int64_t i64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
385 SIMDE_AVX512_ALIGN uint8_t u8 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
386 SIMDE_AVX512_ALIGN uint16_t u16 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
387 SIMDE_AVX512_ALIGN uint32_t u32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
388 SIMDE_AVX512_ALIGN uint64_t u64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
389 #if defined(SIMDE_HAVE_INT128_)
390 SIMDE_AVX512_ALIGN simde_int128 i128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
391 SIMDE_AVX512_ALIGN simde_uint128 u128 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
392 #endif
393 SIMDE_AVX512_ALIGN simde_float32 f32 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
394 SIMDE_AVX512_ALIGN simde_float64 f64 SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
395 SIMDE_AVX512_ALIGN int_fast32_t i32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
396 SIMDE_AVX512_ALIGN uint_fast32_t u32f SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
397 #else
398 SIMDE_AVX512_ALIGN int8_t i8[64];
399 SIMDE_AVX512_ALIGN int16_t i16[32];
400 SIMDE_AVX512_ALIGN int32_t i32[16];
401 SIMDE_AVX512_ALIGN int64_t i64[8];
402 SIMDE_AVX512_ALIGN uint8_t u8[64];
403 SIMDE_AVX512_ALIGN uint16_t u16[32];
404 SIMDE_AVX512_ALIGN uint32_t u32[16];
405 SIMDE_AVX512_ALIGN uint64_t u64[8];
406 SIMDE_AVX512_ALIGN int_fast32_t i32f[64 / sizeof(int_fast32_t)];
407 SIMDE_AVX512_ALIGN uint_fast32_t u32f[64 / sizeof(uint_fast32_t)];
408 #if defined(SIMDE_HAVE_INT128_)
409 SIMDE_AVX512_ALIGN simde_int128 i128[4];
410 SIMDE_AVX512_ALIGN simde_uint128 u128[4];
411 #endif
412 SIMDE_AVX512_ALIGN simde_float32 f32[16];
413 SIMDE_AVX512_ALIGN simde_float64 f64[8];
414 #endif
415
416 SIMDE_AVX512_ALIGN simde__m128i_private m128i_private[4];
417 SIMDE_AVX512_ALIGN simde__m128i m128i[4];
418 SIMDE_AVX512_ALIGN simde__m256i_private m256i_private[2];
419 SIMDE_AVX512_ALIGN simde__m256i m256i[2];
420
421 #if defined(SIMDE_X86_AVX512F_NATIVE)
422 SIMDE_AVX512_ALIGN __m512i n;
423 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
424 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned char) altivec_u8[4];
425 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned short) altivec_u16[4];
426 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned int) altivec_u32[4];
427 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed char) altivec_i8[4];
428 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed short) altivec_i16[4];
429 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed int) altivec_i32[4];
430 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(float) altivec_f32[4];
431 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE)
432 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(unsigned long long) altivec_u64[4];
433 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(signed long long) altivec_i64[4];
434 SIMDE_ALIGN_TO_16 SIMDE_POWER_ALTIVEC_VECTOR(double) altivec_f64[4];
435 #endif
436 #endif
437 } simde__m512i_private;
438
439 /* Intel uses the same header (immintrin.h) for everything AVX and
440 * later. If native aliases are enabled, and the machine has native
441 * support for AVX imintrin.h will already have been included, which
442 * means simde__m512* will already have been defined. So, even
443 * if the machine doesn't support AVX512F we need to use the native
444 * type; it has already been defined.
445 *
446 * However, we also can't just assume that including immintrin.h does
447 * actually define these. It could be a compiler which supports AVX
448 * but not AVX512F, such as GCC < 4.9 or VS < 2017. That's why we
449 * check to see if _MM_CMPINT_GE is defined; it's part of AVX512F,
450 * so we assume that if it's present AVX-512F has already been
451 * declared.
452 *
453 * Note that the choice of _MM_CMPINT_GE is deliberate; while GCC
454 * uses the preprocessor to define all the _MM_CMPINT_* members,
455 * in most compilers they are simply normal enum members. However,
456 * all compilers I've looked at use an object-like macro for
457 * _MM_CMPINT_GE, which is defined to _MM_CMPINT_NLT. _MM_CMPINT_NLT
458 * is included in case a compiler does the reverse, though I haven't
459 * run into one which does.
460 *
461 * As for the ICC check, unlike other compilers, merely using the
462 * AVX-512 types causes ICC to generate AVX-512 instructions. */
463 #if (defined(_MM_CMPINT_GE) || defined(_MM_CMPINT_NLT)) && (defined(SIMDE_X86_AVX512F_NATIVE) || !defined(HEDLEY_INTEL_VERSION))
464 typedef __m512 simde__m512;
465 typedef __m512i simde__m512i;
466 typedef __m512d simde__m512d;
467
468 typedef __mmask8 simde__mmask8;
469 typedef __mmask16 simde__mmask16;
470 #else
471 #if defined(SIMDE_VECTOR_SUBSCRIPT)
472 typedef simde_float32 simde__m512 SIMDE_AVX512_ALIGN SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
473 typedef int_fast32_t simde__m512i SIMDE_AVX512_ALIGN SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
474 typedef simde_float64 simde__m512d SIMDE_AVX512_ALIGN SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
475 #else
476 typedef simde__m512_private simde__m512;
477 typedef simde__m512i_private simde__m512i;
478 typedef simde__m512d_private simde__m512d;
479 #endif
480
481 typedef uint8_t simde__mmask8;
482 typedef uint16_t simde__mmask16;
483 #endif
484
485 #if (defined(_AVX512BF16INTRIN_H_INCLUDED) || defined(__AVX512BF16INTRIN_H)) && (defined(SIMDE_X86_AVX512BF16_NATIVE) || !defined(HEDLEY_INTEL_VERSION))
486 typedef __m128bh simde__m128bh;
487 typedef __m256bh simde__m256bh;
488 typedef __m512bh simde__m512bh;
489 #else
490 #if defined(SIMDE_VECTOR_SUBSCRIPT)
491 typedef simde_float32 simde__m128bh SIMDE_ALIGN_TO_16 SIMDE_VECTOR(16) SIMDE_MAY_ALIAS;
492 typedef simde_float32 simde__m256bh SIMDE_ALIGN_TO_32 SIMDE_VECTOR(32) SIMDE_MAY_ALIAS;
493 typedef simde_float32 simde__m512bh SIMDE_AVX512_ALIGN SIMDE_VECTOR(64) SIMDE_MAY_ALIAS;
494 #else
495 typedef simde__m128bh_private simde__m128bh;
496 typedef simde__m256bh_private simde__m256bh;
497 typedef simde__m512bh_private simde__m512bh;
498 #endif
499 #endif
500
501 /* These are really part of AVX-512VL / AVX-512BW (in GCC __mmask32 is
502 * in avx512vlintrin.h and __mmask64 is in avx512bwintrin.h, in clang
503 * both are in avx512bwintrin.h), not AVX-512F. However, we don't have
504 * a good (not-compiler-specific) way to detect if these headers have
505 * been included. In compilers which support AVX-512F but not
506 * AVX-512BW/VL (e.g., GCC 4.9) we need typedefs since __mmask{32,64)
507 * won't exist.
508 *
509 * AFAICT __mmask{32,64} are always just typedefs to uint{32,64}_t
510 * in all compilers, so it's safe to use these instead of typedefs to
511 * __mmask{16,32}. If you run into a problem with this please file an
512 * issue and we'll try to figure out a work-around. */
513 typedef uint32_t simde__mmask32;
514 typedef uint64_t simde__mmask64;
515
516 #if !defined(SIMDE_X86_AVX512F_NATIVE) && defined(SIMDE_ENABLE_NATIVE_ALIASES)
517 #if !defined(HEDLEY_INTEL_VERSION)
518 typedef simde__m512 __m512;
519 typedef simde__m512i __m512i;
520 typedef simde__m512d __m512d;
521 #else
522 #define __m512 simde__m512
523 #define __m512i simde__m512i
524 #define __m512d simde__m512d
525 #endif
526 #endif
527
528 #if !defined(SIMDE_X86_AVX512BF16_NATIVE) && defined(SIMDE_ENABLE_NATIVE_ALIASES)
529 #if !defined(HEDLEY_INTEL_VERSION)
530 typedef simde__m128bh __m128bh;
531 typedef simde__m256bh __m256bh;
532 typedef simde__m512bh __m512bh;
533 #else
534 #define __m128bh simde__m128bh
535 #define __m256bh simde__m256bh
536 #define __m512bh simde__m512bh
537 #endif
538 #endif
539
540 HEDLEY_STATIC_ASSERT(16 == sizeof(simde__m128bh), "simde__m128bh size incorrect");
541 HEDLEY_STATIC_ASSERT(16 == sizeof(simde__m128bh_private), "simde__m128bh_private size incorrect");
542 HEDLEY_STATIC_ASSERT(32 == sizeof(simde__m256bh), "simde__m256bh size incorrect");
543 HEDLEY_STATIC_ASSERT(32 == sizeof(simde__m256bh_private), "simde__m256bh_private size incorrect");
544 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512bh), "simde__m512bh size incorrect");
545 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512bh_private), "simde__m512bh_private size incorrect");
546 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512), "simde__m512 size incorrect");
547 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512_private), "simde__m512_private size incorrect");
548 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512i), "simde__m512i size incorrect");
549 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512i_private), "simde__m512i_private size incorrect");
550 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512d), "simde__m512d size incorrect");
551 HEDLEY_STATIC_ASSERT(64 == sizeof(simde__m512d_private), "simde__m512d_private size incorrect");
552 #if defined(SIMDE_CHECK_ALIGNMENT) && defined(SIMDE_ALIGN_OF)
553 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m128bh) == 16, "simde__m128bh is not 16-byte aligned");
554 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m128bh_private) == 16, "simde__m128bh_private is not 16-byte aligned");
555 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m256bh) == 32, "simde__m256bh is not 16-byte aligned");
556 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m256bh_private) == 32, "simde__m256bh_private is not 16-byte aligned");
557 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512bh) == 32, "simde__m512bh is not 32-byte aligned");
558 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512bh_private) == 32, "simde__m512bh_private is not 32-byte aligned");
559 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512) == 32, "simde__m512 is not 32-byte aligned");
560 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512_private) == 32, "simde__m512_private is not 32-byte aligned");
561 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512i) == 32, "simde__m512i is not 32-byte aligned");
562 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512i_private) == 32, "simde__m512i_private is not 32-byte aligned");
563 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512d) == 32, "simde__m512d is not 32-byte aligned");
564 HEDLEY_STATIC_ASSERT(SIMDE_ALIGN_OF(simde__m512d_private) == 32, "simde__m512d_private is not 32-byte aligned");
565 #endif
566
567 SIMDE_FUNCTION_ATTRIBUTES
568 simde__m128bh
569 simde__m128bh_from_private(simde__m128bh_private v) {
570 simde__m128bh r;
571 simde_memcpy(&r, &v, sizeof(r));
572 return r;
573 }
574
575 SIMDE_FUNCTION_ATTRIBUTES
576 simde__m128bh_private
577 simde__m128bh_to_private(simde__m128bh v) {
578 simde__m128bh_private r;
579 simde_memcpy(&r, &v, sizeof(r));
580 return r;
581 }
582
583 SIMDE_FUNCTION_ATTRIBUTES
584 simde__m256bh
585 simde__m256bh_from_private(simde__m256bh_private v) {
586 simde__m256bh r;
587 simde_memcpy(&r, &v, sizeof(r));
588 return r;
589 }
590
591 SIMDE_FUNCTION_ATTRIBUTES
592 simde__m256bh_private
593 simde__m256bh_to_private(simde__m256bh v) {
594 simde__m256bh_private r;
595 simde_memcpy(&r, &v, sizeof(r));
596 return r;
597 }
598
599 SIMDE_FUNCTION_ATTRIBUTES
600 simde__m512bh
601 simde__m512bh_from_private(simde__m512bh_private v) {
602 simde__m512bh r;
603 simde_memcpy(&r, &v, sizeof(r));
604 return r;
605 }
606
607 SIMDE_FUNCTION_ATTRIBUTES
608 simde__m512bh_private
609 simde__m512bh_to_private(simde__m512bh v) {
610 simde__m512bh_private r;
611 simde_memcpy(&r, &v, sizeof(r));
612 return r;
613 }
614
615 SIMDE_FUNCTION_ATTRIBUTES
616 simde__m512
617 simde__m512_from_private(simde__m512_private v) {
618 simde__m512 r;
619 simde_memcpy(&r, &v, sizeof(r));
620 return r;
621 }
622
623 SIMDE_FUNCTION_ATTRIBUTES
624 simde__m512_private
625 simde__m512_to_private(simde__m512 v) {
626 simde__m512_private r;
627 simde_memcpy(&r, &v, sizeof(r));
628 return r;
629 }
630
631 SIMDE_FUNCTION_ATTRIBUTES
632 simde__m512i
633 simde__m512i_from_private(simde__m512i_private v) {
634 simde__m512i r;
635 simde_memcpy(&r, &v, sizeof(r));
636 return r;
637 }
638
639 SIMDE_FUNCTION_ATTRIBUTES
640 simde__m512i_private
641 simde__m512i_to_private(simde__m512i v) {
642 simde__m512i_private r;
643 simde_memcpy(&r, &v, sizeof(r));
644 return r;
645 }
646
647 SIMDE_FUNCTION_ATTRIBUTES
648 simde__m512d
649 simde__m512d_from_private(simde__m512d_private v) {
650 simde__m512d r;
651 simde_memcpy(&r, &v, sizeof(r));
652 return r;
653 }
654
655 SIMDE_FUNCTION_ATTRIBUTES
656 simde__m512d_private
657 simde__m512d_to_private(simde__m512d v) {
658 simde__m512d_private r;
659 simde_memcpy(&r, &v, sizeof(r));
660 return r;
661 }
662
663 SIMDE_END_DECLS_
664 HEDLEY_DIAGNOSTIC_POP
665
666 #endif /* !defined(SIMDE_X86_AVX512_TYPES_H) */