Debian Codegraph @

third-party/simde/simde-features.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 /* simde-arch.h is used to determine which features are available according
28 to the compiler. However, we want to make it possible to forcibly enable
29 or disable APIs */
30
31 #if !defined(SIMDE_FEATURES_H)
32 #define SIMDE_FEATURES_H
33
34 #include "simde-arch.h"
35 #include "simde-diagnostic.h"
36
37 #if !defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_SVML_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
38 #if defined(SIMDE_ARCH_X86_SVML)
39 #define SIMDE_X86_SVML_NATIVE
40 #endif
41 #endif
42 #if defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
43 #define SIMDE_X86_AVX512F_NATIVE
44 #endif
45
46 #if !defined(SIMDE_X86_AVX512VP2INTERSECT_NATIVE) && !defined(SIMDE_X86_AVX512VP2INTERSECT_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
47 #if defined(SIMDE_ARCH_X86_AVX512VP2INTERSECT)
48 #define SIMDE_X86_AVX512VP2INTERSECT_NATIVE
49 #endif
50 #endif
51 #if defined(SIMDE_X86_AVX512VP2INTERSECT_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
52 #define SIMDE_X86_AVX512F_NATIVE
53 #endif
54
55 #if !defined(SIMDE_X86_AVX512VPOPCNTDQ_NATIVE) && !defined(SIMDE_X86_AVX512VPOPCNTDQ_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
56 #if defined(SIMDE_ARCH_X86_AVX512VPOPCNTDQ)
57 #define SIMDE_X86_AVX512VPOPCNTDQ_NATIVE
58 #endif
59 #endif
60 #if defined(SIMDE_X86_AVX512VPOPCNTDQ_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
61 #define SIMDE_X86_AVX512F_NATIVE
62 #endif
63
64 #if !defined(SIMDE_X86_AVX512BITALG_NATIVE) && !defined(SIMDE_X86_AVX512BITALG_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
65 #if defined(SIMDE_ARCH_X86_AVX512BITALG)
66 #define SIMDE_X86_AVX512BITALG_NATIVE
67 #endif
68 #endif
69 #if defined(SIMDE_X86_AVX512BITALG_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
70 #define SIMDE_X86_AVX512F_NATIVE
71 #endif
72
73 #if !defined(SIMDE_X86_AVX512VBMI_NATIVE) && !defined(SIMDE_X86_AVX512VBMI_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
74 #if defined(SIMDE_ARCH_X86_AVX512VBMI)
75 #define SIMDE_X86_AVX512VBMI_NATIVE
76 #endif
77 #endif
78 #if defined(SIMDE_X86_AVX512VBMI_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
79 #define SIMDE_X86_AVX512F_NATIVE
80 #endif
81
82 #if !defined(SIMDE_X86_AVX512VBMI2_NATIVE) && !defined(SIMDE_X86_AVX512VBMI2_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
83 #if defined(SIMDE_ARCH_X86_AVX512VBMI2)
84 #define SIMDE_X86_AVX512VBMI2_NATIVE
85 #endif
86 #endif
87 #if defined(SIMDE_X86_AVX512VBMI2_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
88 #define SIMDE_X86_AVX512F_NATIVE
89 #endif
90
91 #if !defined(SIMDE_X86_AVX512VNNI_NATIVE) && !defined(SIMDE_X86_AVX512VNNI_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
92 #if defined(SIMDE_ARCH_X86_AVX512VNNI)
93 #define SIMDE_X86_AVX512VNNI_NATIVE
94 #endif
95 #endif
96 #if defined(SIMDE_X86_AVX512VNNI_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
97 #define SIMDE_X86_AVX512F_NATIVE
98 #endif
99
100 #if !defined(SIMDE_X86_AVX5124VNNIW_NATIVE) && !defined(SIMDE_X86_AVX5124VNNIW_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
101 #if defined(SIMDE_ARCH_X86_AVX5124VNNIW)
102 #define SIMDE_X86_AVX5124VNNIW_NATIVE
103 #endif
104 #endif
105 #if defined(SIMDE_X86_AVX5124VNNIW_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
106 #define SIMDE_X86_AVX512F_NATIVE
107 #endif
108
109 #if !defined(SIMDE_X86_AVX512CD_NATIVE) && !defined(SIMDE_X86_AVX512CD_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
110 #if defined(SIMDE_ARCH_X86_AVX512CD)
111 #define SIMDE_X86_AVX512CD_NATIVE
112 #endif
113 #endif
114 #if defined(SIMDE_X86_AVX512CD_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
115 #define SIMDE_X86_AVX512F_NATIVE
116 #endif
117
118 #if !defined(SIMDE_X86_AVX512DQ_NATIVE) && !defined(SIMDE_X86_AVX512DQ_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
119 #if defined(SIMDE_ARCH_X86_AVX512DQ)
120 #define SIMDE_X86_AVX512DQ_NATIVE
121 #endif
122 #endif
123 #if defined(SIMDE_X86_AVX512DQ_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
124 #define SIMDE_X86_AVX512F_NATIVE
125 #endif
126
127 #if !defined(SIMDE_X86_AVX512VL_NATIVE) && !defined(SIMDE_X86_AVX512VL_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
128 #if defined(SIMDE_ARCH_X86_AVX512VL)
129 #define SIMDE_X86_AVX512VL_NATIVE
130 #endif
131 #endif
132 #if defined(SIMDE_X86_AVX512VL_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
133 #define SIMDE_X86_AVX512F_NATIVE
134 #endif
135
136 #if !defined(SIMDE_X86_AVX512BW_NATIVE) && !defined(SIMDE_X86_AVX512BW_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
137 #if defined(SIMDE_ARCH_X86_AVX512BW)
138 #define SIMDE_X86_AVX512BW_NATIVE
139 #endif
140 #endif
141 #if defined(SIMDE_X86_AVX512BW_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
142 #define SIMDE_X86_AVX512F_NATIVE
143 #endif
144
145 #if !defined(SIMDE_X86_AVX512BF16_NATIVE) && !defined(SIMDE_X86_AVX512BF16_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
146 #if defined(SIMDE_ARCH_X86_AVX512BF16)
147 #define SIMDE_X86_AVX512BF16_NATIVE
148 #endif
149 #endif
150 #if defined(SIMDE_X86_AVX512BF16_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
151 #define SIMDE_X86_AVX512F_NATIVE
152 #endif
153
154 #if !defined(SIMDE_X86_AVX512F_NATIVE) && !defined(SIMDE_X86_AVX512F_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
155 #if defined(SIMDE_ARCH_X86_AVX512F)
156 #define SIMDE_X86_AVX512F_NATIVE
157 #endif
158 #endif
159 #if defined(SIMDE_X86_AVX512F_NATIVE) && !defined(SIMDE_X86_AVX2_NATIVE)
160 #define SIMDE_X86_AVX2_NATIVE
161 #endif
162
163 #if !defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_X86_FMA_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
164 #if defined(SIMDE_ARCH_X86_FMA)
165 #define SIMDE_X86_FMA_NATIVE
166 #endif
167 #endif
168 #if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_X86_AVX_NATIVE)
169 #define SIMDE_X86_AVX_NATIVE
170 #endif
171
172 #if !defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_X86_AVX2_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
173 #if defined(SIMDE_ARCH_X86_AVX2)
174 #define SIMDE_X86_AVX2_NATIVE
175 #endif
176 #endif
177 #if defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_X86_AVX_NATIVE)
178 #define SIMDE_X86_AVX_NATIVE
179 #endif
180
181 #if !defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_X86_AVX_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
182 #if defined(SIMDE_ARCH_X86_AVX)
183 #define SIMDE_X86_AVX_NATIVE
184 #endif
185 #endif
186 #if defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_X86_SSE4_1_NATIVE)
187 #define SIMDE_X86_SSE4_2_NATIVE
188 #endif
189
190 #if !defined(SIMDE_X86_XOP_NATIVE) && !defined(SIMDE_X86_XOP_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
191 #if defined(SIMDE_ARCH_X86_XOP)
192 #define SIMDE_X86_XOP_NATIVE
193 #endif
194 #endif
195 #if defined(SIMDE_X86_XOP_NATIVE) && !defined(SIMDE_X86_SSE4_2_NATIVE)
196 #define SIMDE_X86_SSE4_2_NATIVE
197 #endif
198
199 #if !defined(SIMDE_X86_SSE4_2_NATIVE) && !defined(SIMDE_X86_SSE4_2_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
200 #if defined(SIMDE_ARCH_X86_SSE4_2)
201 #define SIMDE_X86_SSE4_2_NATIVE
202 #endif
203 #endif
204 #if defined(SIMDE_X86_SSE4_2_NATIVE) && !defined(SIMDE_X86_SSE4_1_NATIVE)
205 #define SIMDE_X86_SSE4_1_NATIVE
206 #endif
207
208 #if !defined(SIMDE_X86_SSE4_1_NATIVE) && !defined(SIMDE_X86_SSE4_1_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
209 #if defined(SIMDE_ARCH_X86_SSE4_1)
210 #define SIMDE_X86_SSE4_1_NATIVE
211 #endif
212 #endif
213 #if defined(SIMDE_X86_SSE4_1_NATIVE) && !defined(SIMDE_X86_SSSE3_NATIVE)
214 #define SIMDE_X86_SSSE3_NATIVE
215 #endif
216
217 #if !defined(SIMDE_X86_SSSE3_NATIVE) && !defined(SIMDE_X86_SSSE3_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
218 #if defined(SIMDE_ARCH_X86_SSSE3)
219 #define SIMDE_X86_SSSE3_NATIVE
220 #endif
221 #endif
222 #if defined(SIMDE_X86_SSSE3_NATIVE) && !defined(SIMDE_X86_SSE3_NATIVE)
223 #define SIMDE_X86_SSE3_NATIVE
224 #endif
225
226 #if !defined(SIMDE_X86_SSE3_NATIVE) && !defined(SIMDE_X86_SSE3_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
227 #if defined(SIMDE_ARCH_X86_SSE3)
228 #define SIMDE_X86_SSE3_NATIVE
229 #endif
230 #endif
231 #if defined(SIMDE_X86_SSE3_NATIVE) && !defined(SIMDE_X86_SSE2_NATIVE)
232 #define SIMDE_X86_SSE2_NATIVE
233 #endif
234
235 #if !defined(SIMDE_X86_SSE2_NATIVE) && !defined(SIMDE_X86_SSE2_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
236 #if defined(SIMDE_ARCH_X86_SSE2)
237 #define SIMDE_X86_SSE2_NATIVE
238 #endif
239 #endif
240 #if defined(SIMDE_X86_SSE2_NATIVE) && !defined(SIMDE_X86_SSE_NATIVE)
241 #define SIMDE_X86_SSE_NATIVE
242 #endif
243
244 #if !defined(SIMDE_X86_SSE_NATIVE) && !defined(SIMDE_X86_SSE_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
245 #if defined(SIMDE_ARCH_X86_SSE)
246 #define SIMDE_X86_SSE_NATIVE
247 #endif
248 #endif
249
250 #if !defined(SIMDE_X86_MMX_NATIVE) && !defined(SIMDE_X86_MMX_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
251 #if defined(SIMDE_ARCH_X86_MMX)
252 #define SIMDE_X86_MMX_NATIVE
253 #endif
254 #endif
255
256 #if !defined(SIMDE_X86_GFNI_NATIVE) && !defined(SIMDE_X86_GFNI_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
257 #if defined(SIMDE_ARCH_X86_GFNI)
258 #define SIMDE_X86_GFNI_NATIVE
259 #endif
260 #endif
261
262 #if !defined(SIMDE_X86_PCLMUL_NATIVE) && !defined(SIMDE_X86_PCLMUL_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
263 #if defined(SIMDE_ARCH_X86_PCLMUL)
264 #define SIMDE_X86_PCLMUL_NATIVE
265 #endif
266 #endif
267
268 #if !defined(SIMDE_X86_VPCLMULQDQ_NATIVE) && !defined(SIMDE_X86_VPCLMULQDQ_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
269 #if defined(SIMDE_ARCH_X86_VPCLMULQDQ)
270 #define SIMDE_X86_VPCLMULQDQ_NATIVE
271 #endif
272 #endif
273
274 #if !defined(SIMDE_X86_F16C_NATIVE) && !defined(SIMDE_X86_F16C_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
275 #if defined(SIMDE_ARCH_X86_F16C)
276 #define SIMDE_X86_F16C_NATIVE
277 #endif
278 #endif
279
280 #if !defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_SVML_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
281 #if defined(__INTEL_COMPILER)
282 #define SIMDE_X86_SVML_NATIVE
283 #endif
284 #endif
285
286 #if defined(HEDLEY_MSVC_VERSION)
287 #pragma warning(push)
288 #pragma warning(disable:4799)
289 #endif
290
291 #if \
292 defined(SIMDE_X86_AVX_NATIVE) || defined(SIMDE_X86_GFNI_NATIVE)
293 #include <immintrin.h>
294 #elif defined(SIMDE_X86_SSE4_2_NATIVE)
295 #include <nmmintrin.h>
296 #elif defined(SIMDE_X86_SSE4_1_NATIVE)
297 #include <smmintrin.h>
298 #elif defined(SIMDE_X86_SSSE3_NATIVE)
299 #include <tmmintrin.h>
300 #elif defined(SIMDE_X86_SSE3_NATIVE)
301 #include <pmmintrin.h>
302 #elif defined(SIMDE_X86_SSE2_NATIVE)
303 #include <emmintrin.h>
304 #elif defined(SIMDE_X86_SSE_NATIVE)
305 #include <xmmintrin.h>
306 #elif defined(SIMDE_X86_MMX_NATIVE)
307 #include <mmintrin.h>
308 #endif
309
310 #if defined(SIMDE_X86_XOP_NATIVE)
311 #if defined(_MSC_VER)
312 #include <intrin.h>
313 #else
314 #include <x86intrin.h>
315 #endif
316 #endif
317
318 #if defined(HEDLEY_MSVC_VERSION)
319 #pragma warning(pop)
320 #endif
321
322 #if !defined(SIMDE_ARM_NEON_A64V8_NATIVE) && !defined(SIMDE_ARM_NEON_A64V8_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
323 #if defined(SIMDE_ARCH_ARM_NEON) && defined(SIMDE_ARCH_AARCH64) && SIMDE_ARCH_ARM_CHECK(8,0)
324 #define SIMDE_ARM_NEON_A64V8_NATIVE
325 #endif
326 #endif
327 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && !defined(SIMDE_ARM_NEON_A32V8_NATIVE)
328 #define SIMDE_ARM_NEON_A32V8_NATIVE
329 #endif
330
331 #if !defined(SIMDE_ARM_NEON_A32V8_NATIVE) && !defined(SIMDE_ARM_NEON_A32V8_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
332 #if defined(SIMDE_ARCH_ARM_NEON) && SIMDE_ARCH_ARM_CHECK(8,0) && (__ARM_NEON_FP & 0x02)
333 #define SIMDE_ARM_NEON_A32V8_NATIVE
334 #endif
335 #endif
336 #if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && !defined(SIMDE_ARM_NEON_A32V7_NATIVE)
337 #define SIMDE_ARM_NEON_A32V7_NATIVE
338 #endif
339
340 #if !defined(SIMDE_ARM_NEON_A32V7_NATIVE) && !defined(SIMDE_ARM_NEON_A32V7_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
341 #if defined(SIMDE_ARCH_ARM_NEON) && SIMDE_ARCH_ARM_CHECK(7,0)
342 #define SIMDE_ARM_NEON_A32V7_NATIVE
343 #endif
344 #endif
345 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
346 #include <arm_neon.h>
347 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
348 #include <arm_fp16.h>
349 #endif
350 #endif
351
352 #if !defined(SIMDE_ARM_SVE_NATIVE) && !defined(SIMDE_ARM_SVE_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
353 #if defined(SIMDE_ARCH_ARM_SVE)
354 #define SIMDE_ARM_SVE_NATIVE
355 #include <arm_sve.h>
356 #endif
357 #endif
358
359 #if !defined(SIMDE_WASM_SIMD128_NATIVE) && !defined(SIMDE_WASM_SIMD128_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
360 #if defined(SIMDE_ARCH_WASM_SIMD128)
361 #define SIMDE_WASM_SIMD128_NATIVE
362 #endif
363 #endif
364 #if defined(SIMDE_WASM_SIMD128_NATIVE)
365 #include <wasm_simd128.h>
366 #endif
367
368 #if !defined(SIMDE_POWER_ALTIVEC_P9_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P9_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
369 #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(900)
370 #define SIMDE_POWER_ALTIVEC_P9_NATIVE
371 #endif
372 #endif
373 #if defined(SIMDE_POWER_ALTIVEC_P9_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P8)
374 #define SIMDE_POWER_ALTIVEC_P8_NATIVE
375 #endif
376
377 #if !defined(SIMDE_POWER_ALTIVEC_P8_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P8_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
378 #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(800)
379 #define SIMDE_POWER_ALTIVEC_P8_NATIVE
380 #endif
381 #endif
382 #if defined(SIMDE_POWER_ALTIVEC_P8_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P7)
383 #define SIMDE_POWER_ALTIVEC_P7_NATIVE
384 #endif
385
386 #if !defined(SIMDE_POWER_ALTIVEC_P7_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P7_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
387 #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(700)
388 #define SIMDE_POWER_ALTIVEC_P7_NATIVE
389 #endif
390 #endif
391 #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P6)
392 #define SIMDE_POWER_ALTIVEC_P6_NATIVE
393 #endif
394
395 #if !defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P6_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
396 #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(600)
397 #define SIMDE_POWER_ALTIVEC_P6_NATIVE
398 #endif
399 #endif
400 #if defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P5)
401 #define SIMDE_POWER_ALTIVEC_P5_NATIVE
402 #endif
403
404 #if !defined(SIMDE_POWER_ALTIVEC_P5_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P5_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
405 #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(500)
406 #define SIMDE_POWER_ALTIVEC_P5_NATIVE
407 #endif
408 #endif
409
410 #if !defined(SIMDE_ZARCH_ZVECTOR_15_NATIVE) && !defined(SIMDE_ZARCH_ZVECTOR_15_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
411 #if SIMDE_ARCH_ZARCH_CHECK(13) && defined(SIMDE_ARCH_ZARCH_ZVECTOR)
412 #define SIMDE_ZARCH_ZVECTOR_15_NATIVE
413 #endif
414 #endif
415
416 #if !defined(SIMDE_ZARCH_ZVECTOR_14_NATIVE) && !defined(SIMDE_ZARCH_ZVECTOR_14_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
417 #if SIMDE_ARCH_ZARCH_CHECK(12) && defined(SIMDE_ARCH_ZARCH_ZVECTOR)
418 #define SIMDE_ZARCH_ZVECTOR_14_NATIVE
419 #endif
420 #endif
421
422 #if !defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE) && !defined(SIMDE_ZARCH_ZVECTOR_13_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
423 #if SIMDE_ARCH_ZARCH_CHECK(11) && defined(SIMDE_ARCH_ZARCH_ZVECTOR)
424 #define SIMDE_ZARCH_ZVECTOR_13_NATIVE
425 #endif
426 #endif
427
428 #if defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
429 /* AltiVec conflicts with lots of stuff. The bool keyword conflicts
430 * with the bool keyword in C++ and the bool macro in C99+ (defined
431 * in stdbool.h). The vector keyword conflicts with std::vector in
432 * C++ if you are `using std;`.
433 *
434 * Luckily AltiVec allows you to use `__vector`/`__bool`/`__pixel`
435 * instead, but altivec.h will unconditionally define
436 * `vector`/`bool`/`pixel` so we need to work around that.
437 *
438 * Unfortunately this means that if your code uses AltiVec directly
439 * it may break. If this is the case you'll want to define
440 * `SIMDE_POWER_ALTIVEC_NO_UNDEF` before including SIMDe. Or, even
441 * better, port your code to use the double-underscore versions. */
442 #if defined(bool)
443 #undef bool
444 #endif
445
446 #if defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
447 #include <altivec.h>
448
449 #if !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF)
450 #if defined(vector)
451 #undef vector
452 #endif
453 #if defined(pixel)
454 #undef pixel
455 #endif
456 #if defined(bool)
457 #undef bool
458 #endif
459 #endif /* !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF) */
460 #elif defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
461 #include <vecintrin.h>
462 #endif
463
464 /* Use these intsead of vector/pixel/bool in SIMDe. */
465 #define SIMDE_POWER_ALTIVEC_VECTOR(T) __vector T
466 #define SIMDE_POWER_ALTIVEC_PIXEL __pixel
467 #define SIMDE_POWER_ALTIVEC_BOOL __bool
468
469 /* Re-define bool if we're using stdbool.h */
470 #if !defined(__cplusplus) && defined(__bool_true_false_are_defined) && !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF)
471 #define bool _Bool
472 #endif
473 #endif
474
475 #if !defined(SIMDE_MIPS_LOONGSON_MMI_NATIVE) && !defined(SIMDE_MIPS_LOONGSON_MMI_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
476 #if defined(SIMDE_ARCH_MIPS_LOONGSON_MMI)
477 #define SIMDE_MIPS_LOONGSON_MMI_NATIVE 1
478 #endif
479 #endif
480 #if defined(SIMDE_MIPS_LOONGSON_MMI_NATIVE)
481 #include <loongson-mmiintrin.h>
482 #endif
483
484 #if !defined(SIMDE_MIPS_MSA_NATIVE) && !defined(SIMDE_MIPS_MSA_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
485 #if defined(SIMDE_ARCH_MIPS_MSA)
486 #define SIMDE_MIPS_MSA_NATIVE 1
487 #endif
488 #endif
489 #if defined(SIMDE_MIPS_MSA_NATIVE)
490 #include <msa.h>
491 #endif
492
493 /* This is used to determine whether or not to fall back on a vector
494 * function in an earlier ISA extensions, as well as whether
495 * we expected any attempts at vectorization to be fruitful or if we
496 * expect to always be running serial code.
497 *
498 * Note that, for some architectures (okay, *one* architecture) there
499 * can be a split where some types are supported for one vector length
500 * but others only for a shorter length. Therefore, it is possible to
501 * provide separate values for float/int/double types. */
502
503 #if !defined(SIMDE_NATURAL_VECTOR_SIZE)
504 #if defined(SIMDE_X86_AVX512F_NATIVE)
505 #define SIMDE_NATURAL_VECTOR_SIZE (512)
506 #elif defined(SIMDE_X86_AVX2_NATIVE)
507 #define SIMDE_NATURAL_VECTOR_SIZE (256)
508 #elif defined(SIMDE_X86_AVX_NATIVE)
509 #define SIMDE_NATURAL_FLOAT_VECTOR_SIZE (256)
510 #define SIMDE_NATURAL_INT_VECTOR_SIZE (128)
511 #define SIMDE_NATURAL_DOUBLE_VECTOR_SIZE (128)
512 #elif \
513 defined(SIMDE_X86_SSE2_NATIVE) || \
514 defined(SIMDE_ARM_NEON_A32V7_NATIVE) || \
515 defined(SIMDE_WASM_SIMD128_NATIVE) || \
516 defined(SIMDE_POWER_ALTIVEC_P5_NATIVE) || \
517 defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE) || \
518 defined(SIMDE_MIPS_MSA_NATIVE)
519 #define SIMDE_NATURAL_VECTOR_SIZE (128)
520 #elif defined(SIMDE_X86_SSE_NATIVE)
521 #define SIMDE_NATURAL_FLOAT_VECTOR_SIZE (128)
522 #define SIMDE_NATURAL_INT_VECTOR_SIZE (64)
523 #define SIMDE_NATURAL_DOUBLE_VECTOR_SIZE (0)
524 #endif
525
526 #if !defined(SIMDE_NATURAL_VECTOR_SIZE)
527 #if defined(SIMDE_NATURAL_FLOAT_VECTOR_SIZE)
528 #define SIMDE_NATURAL_VECTOR_SIZE SIMDE_NATURAL_FLOAT_VECTOR_SIZE
529 #elif defined(SIMDE_NATURAL_INT_VECTOR_SIZE)
530 #define SIMDE_NATURAL_VECTOR_SIZE SIMDE_NATURAL_INT_VECTOR_SIZE
531 #elif defined(SIMDE_NATURAL_DOUBLE_VECTOR_SIZE)
532 #define SIMDE_NATURAL_VECTOR_SIZE SIMDE_NATURAL_DOUBLE_VECTOR_SIZE
533 #else
534 #define SIMDE_NATURAL_VECTOR_SIZE (0)
535 #endif
536 #endif
537
538 #if !defined(SIMDE_NATURAL_FLOAT_VECTOR_SIZE)
539 #define SIMDE_NATURAL_FLOAT_VECTOR_SIZE SIMDE_NATURAL_VECTOR_SIZE
540 #endif
541 #if !defined(SIMDE_NATURAL_INT_VECTOR_SIZE)
542 #define SIMDE_NATURAL_INT_VECTOR_SIZE SIMDE_NATURAL_VECTOR_SIZE
543 #endif
544 #if !defined(SIMDE_NATURAL_DOUBLE_VECTOR_SIZE)
545 #define SIMDE_NATURAL_DOUBLE_VECTOR_SIZE SIMDE_NATURAL_VECTOR_SIZE
546 #endif
547 #endif
548
549 #define SIMDE_NATURAL_VECTOR_SIZE_LE(x) ((SIMDE_NATURAL_VECTOR_SIZE > 0) && (SIMDE_NATURAL_VECTOR_SIZE <= (x)))
550 #define SIMDE_NATURAL_VECTOR_SIZE_GE(x) ((SIMDE_NATURAL_VECTOR_SIZE > 0) && (SIMDE_NATURAL_VECTOR_SIZE >= (x)))
551 #define SIMDE_NATURAL_FLOAT_VECTOR_SIZE_LE(x) ((SIMDE_NATURAL_FLOAT_VECTOR_SIZE > 0) && (SIMDE_NATURAL_FLOAT_VECTOR_SIZE <= (x)))
552 #define SIMDE_NATURAL_FLOAT_VECTOR_SIZE_GE(x) ((SIMDE_NATURAL_FLOAT_VECTOR_SIZE > 0) && (SIMDE_NATURAL_FLOAT_VECTOR_SIZE >= (x)))
553 #define SIMDE_NATURAL_INT_VECTOR_SIZE_LE(x) ((SIMDE_NATURAL_INT_VECTOR_SIZE > 0) && (SIMDE_NATURAL_INT_VECTOR_SIZE <= (x)))
554 #define SIMDE_NATURAL_INT_VECTOR_SIZE_GE(x) ((SIMDE_NATURAL_INT_VECTOR_SIZE > 0) && (SIMDE_NATURAL_INT_VECTOR_SIZE >= (x)))
555 #define SIMDE_NATURAL_DOUBLE_VECTOR_SIZE_LE(x) ((SIMDE_NATURAL_DOUBLE_VECTOR_SIZE > 0) && (SIMDE_NATURAL_DOUBLE_VECTOR_SIZE <= (x)))
556 #define SIMDE_NATURAL_DOUBLE_VECTOR_SIZE_GE(x) ((SIMDE_NATURAL_DOUBLE_VECTOR_SIZE > 0) && (SIMDE_NATURAL_DOUBLE_VECTOR_SIZE >= (x)))
557
558 /* Native aliases */
559 #if defined(SIMDE_ENABLE_NATIVE_ALIASES)
560 #if !defined(SIMDE_X86_MMX_NATIVE)
561 #define SIMDE_X86_MMX_ENABLE_NATIVE_ALIASES
562 #endif
563 #if !defined(SIMDE_X86_SSE_NATIVE)
564 #define SIMDE_X86_SSE_ENABLE_NATIVE_ALIASES
565 #endif
566 #if !defined(SIMDE_X86_SSE2_NATIVE)
567 #define SIMDE_X86_SSE2_ENABLE_NATIVE_ALIASES
568 #endif
569 #if !defined(SIMDE_X86_SSE3_NATIVE)
570 #define SIMDE_X86_SSE3_ENABLE_NATIVE_ALIASES
571 #endif
572 #if !defined(SIMDE_X86_SSSE3_NATIVE)
573 #define SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES
574 #endif
575 #if !defined(SIMDE_X86_SSE4_1_NATIVE)
576 #define SIMDE_X86_SSE4_1_ENABLE_NATIVE_ALIASES
577 #endif
578 #if !defined(SIMDE_X86_SSE4_2_NATIVE)
579 #define SIMDE_X86_SSE4_2_ENABLE_NATIVE_ALIASES
580 #endif
581 #if !defined(SIMDE_X86_AVX_NATIVE)
582 #define SIMDE_X86_AVX_ENABLE_NATIVE_ALIASES
583 #endif
584 #if !defined(SIMDE_X86_AVX2_NATIVE)
585 #define SIMDE_X86_AVX2_ENABLE_NATIVE_ALIASES
586 #endif
587 #if !defined(SIMDE_X86_FMA_NATIVE)
588 #define SIMDE_X86_FMA_ENABLE_NATIVE_ALIASES
589 #endif
590 #if !defined(SIMDE_X86_AVX512F_NATIVE)
591 #define SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES
592 #endif
593 #if !defined(SIMDE_X86_AVX512VL_NATIVE)
594 #define SIMDE_X86_AVX512VL_ENABLE_NATIVE_ALIASES
595 #endif
596 #if !defined(SIMDE_X86_AVX512VBMI_NATIVE)
597 #define SIMDE_X86_AVX512VBMI_ENABLE_NATIVE_ALIASES
598 #endif
599 #if !defined(SIMDE_X86_AVX512VBMI2_NATIVE)
600 #define SIMDE_X86_AVX512VBMI2_ENABLE_NATIVE_ALIASES
601 #endif
602 #if !defined(SIMDE_X86_AVX512BW_NATIVE)
603 #define SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES
604 #endif
605 #if !defined(SIMDE_X86_AVX512VNNI_NATIVE)
606 #define SIMDE_X86_AVX512VNNI_ENABLE_NATIVE_ALIASES
607 #endif
608 #if !defined(SIMDE_X86_AVX5124VNNIW_NATIVE)
609 #define SIMDE_X86_AVX5124VNNIW_ENABLE_NATIVE_ALIASES
610 #endif
611 #if !defined(SIMDE_X86_AVX512BF16_NATIVE)
612 #define SIMDE_X86_AVX512BF16_ENABLE_NATIVE_ALIASES
613 #endif
614 #if !defined(SIMDE_X86_AVX512BITALG_NATIVE)
615 #define SIMDE_X86_AVX512BITALG_ENABLE_NATIVE_ALIASES
616 #endif
617 #if !defined(SIMDE_X86_AVX512VPOPCNTDQ_NATIVE)
618 #define SIMDE_X86_AVX512VPOPCNTDQ_ENABLE_NATIVE_ALIASES
619 #endif
620 #if !defined(SIMDE_X86_AVX512DQ_NATIVE)
621 #define SIMDE_X86_AVX512DQ_ENABLE_NATIVE_ALIASES
622 #endif
623 #if !defined(SIMDE_X86_AVX512CD_NATIVE)
624 #define SIMDE_X86_AVX512CD_ENABLE_NATIVE_ALIASES
625 #endif
626 #if !defined(SIMDE_X86_GFNI_NATIVE)
627 #define SIMDE_X86_GFNI_ENABLE_NATIVE_ALIASES
628 #endif
629 #if !defined(SIMDE_X86_PCLMUL_NATIVE)
630 #define SIMDE_X86_PCLMUL_ENABLE_NATIVE_ALIASES
631 #endif
632 #if !defined(SIMDE_X86_VPCLMULQDQ_NATIVE)
633 #define SIMDE_X86_VPCLMULQDQ_ENABLE_NATIVE_ALIASES
634 #endif
635 #if !defined(SIMDE_X86_F16C_NATIVE)
636 #define SIMDE_X86_F16C_ENABLE_NATIVE_ALIASES
637 #endif
638
639 #if !defined(SIMDE_ARM_NEON_A32V7_NATIVE)
640 #define SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES
641 #endif
642 #if !defined(SIMDE_ARM_NEON_A32V8_NATIVE)
643 #define SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES
644 #endif
645 #if !defined(SIMDE_ARM_NEON_A64V8_NATIVE)
646 #define SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES
647 #endif
648
649 #if !defined(SIMDE_ARM_SVE_NATIVE)
650 #define SIMDE_ARM_SVE_ENABLE_NATIVE_ALIASES
651 #endif
652
653 #if !defined(SIMDE_WASM_SIMD128_NATIVE)
654 #define SIMDE_WASM_SIMD128_ENABLE_NATIVE_ALIASES
655 #endif
656 #endif
657
658 /* Are floating point values stored using IEEE 754? Knowing
659 * this at during preprocessing is a bit tricky, mostly because what
660 * we're curious about is how values are stored and not whether the
661 * implementation is fully conformant in terms of rounding, NaN
662 * handling, etc.
663 *
664 * For example, if you use -ffast-math or -Ofast on
665 * GCC or clang IEEE 754 isn't strictly followed, therefore IEE 754
666 * support is not advertised (by defining __STDC_IEC_559__).
667 *
668 * However, what we care about is whether it is safe to assume that
669 * floating point values are stored in IEEE 754 format, in which case
670 * we can provide faster implementations of some functions.
671 *
672 * Luckily every vaugely modern architecture I'm aware of uses IEEE 754-
673 * so we just assume IEEE 754 for now. There is a test which verifies
674 * this, if that test fails sowewhere please let us know and we'll add
675 * an exception for that platform. Meanwhile, you can define
676 * SIMDE_NO_IEEE754_STORAGE. */
677 #if !defined(SIMDE_IEEE754_STORAGE) && !defined(SIMDE_NO_IEE754_STORAGE)
678 #define SIMDE_IEEE754_STORAGE
679 #endif
680
681 #if defined(SIMDE_ARCH_ARM_NEON_FP16)
682 #define SIMDE_ARM_NEON_FP16
683 #endif
684
685 #endif /* !defined(SIMDE_FEATURES_H) */