clang 24.0.0git
avxintrin.h
Go to the documentation of this file.
1/*===---- avxintrin.h - AVX intrinsics -------------------------------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __IMMINTRIN_H
11#error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
12#endif
13
14#ifndef __AVXINTRIN_H
15#define __AVXINTRIN_H
16
17typedef double __v4df __attribute__ ((__vector_size__ (32)));
18typedef float __v8sf __attribute__ ((__vector_size__ (32)));
19typedef long long __v4di __attribute__ ((__vector_size__ (32)));
20typedef int __v8si __attribute__ ((__vector_size__ (32)));
21typedef short __v16hi __attribute__ ((__vector_size__ (32)));
22typedef char __v32qi __attribute__ ((__vector_size__ (32)));
23
24/* Unsigned types */
25typedef unsigned long long __v4du __attribute__ ((__vector_size__ (32)));
26typedef unsigned int __v8su __attribute__ ((__vector_size__ (32)));
27typedef unsigned short __v16hu __attribute__ ((__vector_size__ (32)));
28typedef unsigned char __v32qu __attribute__ ((__vector_size__ (32)));
29
30/* We need an explicitly signed variant for char. Note that this shouldn't
31 * appear in the interface though. */
32typedef signed char __v32qs __attribute__((__vector_size__(32)));
33
34typedef float __m256 __attribute__ ((__vector_size__ (32), __aligned__(32)));
35typedef double __m256d __attribute__((__vector_size__(32), __aligned__(32)));
36typedef long long __m256i __attribute__((__vector_size__(32), __aligned__(32)));
37
38typedef float __m256_u __attribute__ ((__vector_size__ (32), __aligned__(1)));
39typedef double __m256d_u __attribute__((__vector_size__(32), __aligned__(1)));
40typedef long long __m256i_u __attribute__((__vector_size__(32), __aligned__(1)));
41
42#ifdef __SSE2__
43/* Both _Float16 and __bf16 require SSE2 being enabled. */
44typedef _Float16 __v16hf __attribute__((__vector_size__(32), __aligned__(32)));
45typedef _Float16 __m256h __attribute__((__vector_size__(32), __aligned__(32)));
46typedef _Float16 __m256h_u __attribute__((__vector_size__(32), __aligned__(1)));
47
48typedef __bf16 __v16bf __attribute__((__vector_size__(32), __aligned__(32)));
49typedef __bf16 __m256bh __attribute__((__vector_size__(32), __aligned__(32)));
50#endif
51
52/* Define the default attributes for the functions in this file. */
53#define __DEFAULT_FN_ATTRS \
54 __attribute__((__always_inline__, __nodebug__, __target__("avx"), \
55 __min_vector_width__(256)))
56#define __DEFAULT_FN_ATTRS128 \
57 __attribute__((__always_inline__, __nodebug__, __target__("avx"), \
58 __min_vector_width__(128)))
59
60#if defined(__cplusplus) && (__cplusplus >= 201103L)
61#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
62#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
63#else
64#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
65#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
66#endif
67
68/* Arithmetic */
69/// Adds two 256-bit vectors of [4 x double].
70///
71/// \headerfile <x86intrin.h>
72///
73/// This intrinsic corresponds to the <c> VADDPD </c> instruction.
74///
75/// \param __a
76/// A 256-bit vector of [4 x double] containing one of the source operands.
77/// \param __b
78/// A 256-bit vector of [4 x double] containing one of the source operands.
79/// \returns A 256-bit vector of [4 x double] containing the sums of both
80/// operands.
81static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
82_mm256_add_pd(__m256d __a, __m256d __b) {
83 return (__m256d)((__v4df)__a+(__v4df)__b);
84}
85
86/// Adds two 256-bit vectors of [8 x float].
87///
88/// \headerfile <x86intrin.h>
89///
90/// This intrinsic corresponds to the <c> VADDPS </c> instruction.
91///
92/// \param __a
93/// A 256-bit vector of [8 x float] containing one of the source operands.
94/// \param __b
95/// A 256-bit vector of [8 x float] containing one of the source operands.
96/// \returns A 256-bit vector of [8 x float] containing the sums of both
97/// operands.
98static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_add_ps(__m256 __a,
99 __m256 __b) {
100 return (__m256)((__v8sf)__a+(__v8sf)__b);
101}
102
103/// Subtracts two 256-bit vectors of [4 x double].
104///
105/// \headerfile <x86intrin.h>
106///
107/// This intrinsic corresponds to the <c> VSUBPD </c> instruction.
108///
109/// \param __a
110/// A 256-bit vector of [4 x double] containing the minuend.
111/// \param __b
112/// A 256-bit vector of [4 x double] containing the subtrahend.
113/// \returns A 256-bit vector of [4 x double] containing the differences between
114/// both operands.
115static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
116_mm256_sub_pd(__m256d __a, __m256d __b) {
117 return (__m256d)((__v4df)__a-(__v4df)__b);
118}
119
120/// Subtracts two 256-bit vectors of [8 x float].
121///
122/// \headerfile <x86intrin.h>
123///
124/// This intrinsic corresponds to the <c> VSUBPS </c> instruction.
125///
126/// \param __a
127/// A 256-bit vector of [8 x float] containing the minuend.
128/// \param __b
129/// A 256-bit vector of [8 x float] containing the subtrahend.
130/// \returns A 256-bit vector of [8 x float] containing the differences between
131/// both operands.
132static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_sub_ps(__m256 __a,
133 __m256 __b) {
134 return (__m256)((__v8sf)__a-(__v8sf)__b);
135}
136
137/// Adds the even-indexed values and subtracts the odd-indexed values of
138/// two 256-bit vectors of [4 x double].
139///
140/// \headerfile <x86intrin.h>
141///
142/// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction.
143///
144/// \param __a
145/// A 256-bit vector of [4 x double] containing the left source operand.
146/// \param __b
147/// A 256-bit vector of [4 x double] containing the right source operand.
148/// \returns A 256-bit vector of [4 x double] containing the alternating sums
149/// and differences between both operands.
150static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
151_mm256_addsub_pd(__m256d __a, __m256d __b) {
152 return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
153}
154
155/// Adds the even-indexed values and subtracts the odd-indexed values of
156/// two 256-bit vectors of [8 x float].
157///
158/// \headerfile <x86intrin.h>
159///
160/// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction.
161///
162/// \param __a
163/// A 256-bit vector of [8 x float] containing the left source operand.
164/// \param __b
165/// A 256-bit vector of [8 x float] containing the right source operand.
166/// \returns A 256-bit vector of [8 x float] containing the alternating sums and
167/// differences between both operands.
168static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
169_mm256_addsub_ps(__m256 __a, __m256 __b) {
170 return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
171}
172
173/// Divides two 256-bit vectors of [4 x double].
174///
175/// \headerfile <x86intrin.h>
176///
177/// This intrinsic corresponds to the <c> VDIVPD </c> instruction.
178///
179/// \param __a
180/// A 256-bit vector of [4 x double] containing the dividend.
181/// \param __b
182/// A 256-bit vector of [4 x double] containing the divisor.
183/// \returns A 256-bit vector of [4 x double] containing the quotients of both
184/// operands.
185static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
186_mm256_div_pd(__m256d __a, __m256d __b) {
187 return (__m256d)((__v4df)__a/(__v4df)__b);
188}
189
190/// Divides two 256-bit vectors of [8 x float].
191///
192/// \headerfile <x86intrin.h>
193///
194/// This intrinsic corresponds to the <c> VDIVPS </c> instruction.
195///
196/// \param __a
197/// A 256-bit vector of [8 x float] containing the dividend.
198/// \param __b
199/// A 256-bit vector of [8 x float] containing the divisor.
200/// \returns A 256-bit vector of [8 x float] containing the quotients of both
201/// operands.
202static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_div_ps(__m256 __a,
203 __m256 __b) {
204 return (__m256)((__v8sf)__a/(__v8sf)__b);
205}
206
207/// Compares two 256-bit vectors of [4 x double] and returns the greater
208/// of each pair of values.
209///
210/// If either value in a comparison is NaN, returns the value from \a __b.
211///
212/// \headerfile <x86intrin.h>
213///
214/// This intrinsic corresponds to the <c> VMAXPD </c> instruction.
215///
216/// \param __a
217/// A 256-bit vector of [4 x double] containing one of the operands.
218/// \param __b
219/// A 256-bit vector of [4 x double] containing one of the operands.
220/// \returns A 256-bit vector of [4 x double] containing the maximum values
221/// between both operands.
222static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
223_mm256_max_pd(__m256d __a, __m256d __b) {
224 return (__m256d)__builtin_ia32_maxpd256((__v4df)__a, (__v4df)__b);
225}
226
227/// Compares two 256-bit vectors of [8 x float] and returns the greater
228/// of each pair of values.
229///
230/// If either value in a comparison is NaN, returns the value from \a __b.
231///
232/// \headerfile <x86intrin.h>
233///
234/// This intrinsic corresponds to the <c> VMAXPS </c> instruction.
235///
236/// \param __a
237/// A 256-bit vector of [8 x float] containing one of the operands.
238/// \param __b
239/// A 256-bit vector of [8 x float] containing one of the operands.
240/// \returns A 256-bit vector of [8 x float] containing the maximum values
241/// between both operands.
242static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_max_ps(__m256 __a,
243 __m256 __b) {
244 return (__m256)__builtin_ia32_maxps256((__v8sf)__a, (__v8sf)__b);
245}
246
247/// Compares two 256-bit vectors of [4 x double] and returns the lesser
248/// of each pair of values.
249///
250/// If either value in a comparison is NaN, returns the value from \a __b.
251///
252/// \headerfile <x86intrin.h>
253///
254/// This intrinsic corresponds to the <c> VMINPD </c> instruction.
255///
256/// \param __a
257/// A 256-bit vector of [4 x double] containing one of the operands.
258/// \param __b
259/// A 256-bit vector of [4 x double] containing one of the operands.
260/// \returns A 256-bit vector of [4 x double] containing the minimum values
261/// between both operands.
262static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
263_mm256_min_pd(__m256d __a, __m256d __b) {
264 return (__m256d)__builtin_ia32_minpd256((__v4df)__a, (__v4df)__b);
265}
266
267/// Compares two 256-bit vectors of [8 x float] and returns the lesser
268/// of each pair of values.
269///
270/// If either value in a comparison is NaN, returns the value from \a __b.
271///
272/// \headerfile <x86intrin.h>
273///
274/// This intrinsic corresponds to the <c> VMINPS </c> instruction.
275///
276/// \param __a
277/// A 256-bit vector of [8 x float] containing one of the operands.
278/// \param __b
279/// A 256-bit vector of [8 x float] containing one of the operands.
280/// \returns A 256-bit vector of [8 x float] containing the minimum values
281/// between both operands.
282static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_min_ps(__m256 __a,
283 __m256 __b) {
284 return (__m256)__builtin_ia32_minps256((__v8sf)__a, (__v8sf)__b);
285}
286
287/// Multiplies two 256-bit vectors of [4 x double].
288///
289/// \headerfile <x86intrin.h>
290///
291/// This intrinsic corresponds to the <c> VMULPD </c> instruction.
292///
293/// \param __a
294/// A 256-bit vector of [4 x double] containing one of the operands.
295/// \param __b
296/// A 256-bit vector of [4 x double] containing one of the operands.
297/// \returns A 256-bit vector of [4 x double] containing the products of both
298/// operands.
299static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
300_mm256_mul_pd(__m256d __a, __m256d __b) {
301 return (__m256d)((__v4df)__a * (__v4df)__b);
302}
303
304/// Multiplies two 256-bit vectors of [8 x float].
305///
306/// \headerfile <x86intrin.h>
307///
308/// This intrinsic corresponds to the <c> VMULPS </c> instruction.
309///
310/// \param __a
311/// A 256-bit vector of [8 x float] containing one of the operands.
312/// \param __b
313/// A 256-bit vector of [8 x float] containing one of the operands.
314/// \returns A 256-bit vector of [8 x float] containing the products of both
315/// operands.
316static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_mul_ps(__m256 __a,
317 __m256 __b) {
318 return (__m256)((__v8sf)__a * (__v8sf)__b);
319}
320
321/// Calculates the square roots of the values in a 256-bit vector of
322/// [4 x double].
323///
324/// \headerfile <x86intrin.h>
325///
326/// This intrinsic corresponds to the <c> VSQRTPD </c> instruction.
327///
328/// \param __a
329/// A 256-bit vector of [4 x double].
330/// \returns A 256-bit vector of [4 x double] containing the square roots of the
331/// values in the operand.
332static __inline __m256d __DEFAULT_FN_ATTRS _mm256_sqrt_pd(__m256d __a) {
333 return __builtin_elementwise_sqrt(__a);
334}
335
336/// Calculates the square roots of the values in a 256-bit vector of
337/// [8 x float].
338///
339/// \headerfile <x86intrin.h>
340///
341/// This intrinsic corresponds to the <c> VSQRTPS </c> instruction.
342///
343/// \param __a
344/// A 256-bit vector of [8 x float].
345/// \returns A 256-bit vector of [8 x float] containing the square roots of the
346/// values in the operand.
347static __inline __m256 __DEFAULT_FN_ATTRS _mm256_sqrt_ps(__m256 __a) {
348 return __builtin_elementwise_sqrt(__a);
349}
350
351/// Calculates the reciprocal square roots of the values in a 256-bit
352/// vector of [8 x float].
353///
354/// \headerfile <x86intrin.h>
355///
356/// This intrinsic corresponds to the <c> VRSQRTPS </c> instruction.
357///
358/// \param __a
359/// A 256-bit vector of [8 x float].
360/// \returns A 256-bit vector of [8 x float] containing the reciprocal square
361/// roots of the values in the operand.
362static __inline __m256 __DEFAULT_FN_ATTRS
364{
365 return (__m256)__builtin_ia32_rsqrtps256((__v8sf)__a);
366}
367
368/// Calculates the reciprocals of the values in a 256-bit vector of
369/// [8 x float].
370///
371/// \headerfile <x86intrin.h>
372///
373/// This intrinsic corresponds to the <c> VRCPPS </c> instruction.
374///
375/// \param __a
376/// A 256-bit vector of [8 x float].
377/// \returns A 256-bit vector of [8 x float] containing the reciprocals of the
378/// values in the operand.
379static __inline __m256 __DEFAULT_FN_ATTRS
381{
382 return (__m256)__builtin_ia32_rcpps256((__v8sf)__a);
383}
384
385/// Rounds the values in a 256-bit vector of [4 x double] as specified
386/// by the byte operand. The source values are rounded to integer values and
387/// returned as 64-bit double-precision floating-point values.
388///
389/// \headerfile <x86intrin.h>
390///
391/// \code
392/// __m256d _mm256_round_pd(__m256d V, const int M);
393/// \endcode
394///
395/// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
396///
397/// \param V
398/// A 256-bit vector of [4 x double].
399/// \param M
400/// An integer value that specifies the rounding operation. \n
401/// Bits [7:4] are reserved. \n
402/// Bit [3] is a precision exception value: \n
403/// 0: A normal PE exception is used. \n
404/// 1: The PE field is not updated. \n
405/// Bit [2] is the rounding control source: \n
406/// 0: Use bits [1:0] of \a M. \n
407/// 1: Use the current MXCSR setting. \n
408/// Bits [1:0] contain the rounding control definition: \n
409/// 00: Nearest. \n
410/// 01: Downward (toward negative infinity). \n
411/// 10: Upward (toward positive infinity). \n
412/// 11: Truncated.
413/// \returns A 256-bit vector of [4 x double] containing the rounded values.
414#define _mm256_round_pd(V, M) \
415 ((__m256d)__builtin_ia32_roundpd256((__v4df)(__m256d)(V), (M)))
416
417/// Rounds the values stored in a 256-bit vector of [8 x float] as
418/// specified by the byte operand. The source values are rounded to integer
419/// values and returned as floating-point values.
420///
421/// \headerfile <x86intrin.h>
422///
423/// \code
424/// __m256 _mm256_round_ps(__m256 V, const int M);
425/// \endcode
426///
427/// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
428///
429/// \param V
430/// A 256-bit vector of [8 x float].
431/// \param M
432/// An integer value that specifies the rounding operation. \n
433/// Bits [7:4] are reserved. \n
434/// Bit [3] is a precision exception value: \n
435/// 0: A normal PE exception is used. \n
436/// 1: The PE field is not updated. \n
437/// Bit [2] is the rounding control source: \n
438/// 0: Use bits [1:0] of \a M. \n
439/// 1: Use the current MXCSR setting. \n
440/// Bits [1:0] contain the rounding control definition: \n
441/// 00: Nearest. \n
442/// 01: Downward (toward negative infinity). \n
443/// 10: Upward (toward positive infinity). \n
444/// 11: Truncated.
445/// \returns A 256-bit vector of [8 x float] containing the rounded values.
446#define _mm256_round_ps(V, M) \
447 ((__m256)__builtin_ia32_roundps256((__v8sf)(__m256)(V), (M)))
448
449/// Rounds up the values stored in a 256-bit vector of [4 x double]. The
450/// source values are rounded up to integer values and returned as 64-bit
451/// double-precision floating-point values.
452///
453/// \headerfile <x86intrin.h>
454///
455/// \code
456/// __m256d _mm256_ceil_pd(__m256d V);
457/// \endcode
458///
459/// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
460///
461/// \param V
462/// A 256-bit vector of [4 x double].
463/// \returns A 256-bit vector of [4 x double] containing the rounded up values.
464#define _mm256_ceil_pd(V) _mm256_round_pd((V), _MM_FROUND_CEIL)
465
466/// Rounds down the values stored in a 256-bit vector of [4 x double].
467/// The source values are rounded down to integer values and returned as
468/// 64-bit double-precision floating-point values.
469///
470/// \headerfile <x86intrin.h>
471///
472/// \code
473/// __m256d _mm256_floor_pd(__m256d V);
474/// \endcode
475///
476/// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
477///
478/// \param V
479/// A 256-bit vector of [4 x double].
480/// \returns A 256-bit vector of [4 x double] containing the rounded down
481/// values.
482#define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)
483
484/// Rounds up the values stored in a 256-bit vector of [8 x float]. The
485/// source values are rounded up to integer values and returned as
486/// floating-point values.
487///
488/// \headerfile <x86intrin.h>
489///
490/// \code
491/// __m256 _mm256_ceil_ps(__m256 V);
492/// \endcode
493///
494/// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
495///
496/// \param V
497/// A 256-bit vector of [8 x float].
498/// \returns A 256-bit vector of [8 x float] containing the rounded up values.
499#define _mm256_ceil_ps(V) _mm256_round_ps((V), _MM_FROUND_CEIL)
500
501/// Rounds down the values stored in a 256-bit vector of [8 x float]. The
502/// source values are rounded down to integer values and returned as
503/// floating-point values.
504///
505/// \headerfile <x86intrin.h>
506///
507/// \code
508/// __m256 _mm256_floor_ps(__m256 V);
509/// \endcode
510///
511/// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
512///
513/// \param V
514/// A 256-bit vector of [8 x float].
515/// \returns A 256-bit vector of [8 x float] containing the rounded down values.
516#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
517
518/* Logical */
519/// Performs a bitwise AND of two 256-bit vectors of [4 x double].
520///
521/// \headerfile <x86intrin.h>
522///
523/// This intrinsic corresponds to the <c> VANDPD </c> instruction.
524///
525/// \param __a
526/// A 256-bit vector of [4 x double] containing one of the source operands.
527/// \param __b
528/// A 256-bit vector of [4 x double] containing one of the source operands.
529/// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
530/// values between both operands.
531static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
532_mm256_and_pd(__m256d __a, __m256d __b)
533{
534 return (__m256d)((__v4du)__a & (__v4du)__b);
535}
536
537/// Performs a bitwise AND of two 256-bit vectors of [8 x float].
538///
539/// \headerfile <x86intrin.h>
540///
541/// This intrinsic corresponds to the <c> VANDPS </c> instruction.
542///
543/// \param __a
544/// A 256-bit vector of [8 x float] containing one of the source operands.
545/// \param __b
546/// A 256-bit vector of [8 x float] containing one of the source operands.
547/// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
548/// values between both operands.
549static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
550_mm256_and_ps(__m256 __a, __m256 __b)
551{
552 return (__m256)((__v8su)__a & (__v8su)__b);
553}
554
555/// Performs a bitwise AND of two 256-bit vectors of [4 x double], using
556/// the one's complement of the values contained in the first source operand.
557///
558/// \headerfile <x86intrin.h>
559///
560/// This intrinsic corresponds to the <c> VANDNPD </c> instruction.
561///
562/// \param __a
563/// A 256-bit vector of [4 x double] containing the left source operand. The
564/// one's complement of this value is used in the bitwise AND.
565/// \param __b
566/// A 256-bit vector of [4 x double] containing the right source operand.
567/// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
568/// values of the second operand and the one's complement of the first
569/// operand.
570static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
571_mm256_andnot_pd(__m256d __a, __m256d __b)
572{
573 return (__m256d)(~(__v4du)__a & (__v4du)__b);
574}
575
576/// Performs a bitwise AND of two 256-bit vectors of [8 x float], using
577/// the one's complement of the values contained in the first source operand.
578///
579/// \headerfile <x86intrin.h>
580///
581/// This intrinsic corresponds to the <c> VANDNPS </c> instruction.
582///
583/// \param __a
584/// A 256-bit vector of [8 x float] containing the left source operand. The
585/// one's complement of this value is used in the bitwise AND.
586/// \param __b
587/// A 256-bit vector of [8 x float] containing the right source operand.
588/// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
589/// values of the second operand and the one's complement of the first
590/// operand.
591static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
592_mm256_andnot_ps(__m256 __a, __m256 __b)
593{
594 return (__m256)(~(__v8su)__a & (__v8su)__b);
595}
596
597/// Performs a bitwise OR of two 256-bit vectors of [4 x double].
598///
599/// \headerfile <x86intrin.h>
600///
601/// This intrinsic corresponds to the <c> VORPD </c> instruction.
602///
603/// \param __a
604/// A 256-bit vector of [4 x double] containing one of the source operands.
605/// \param __b
606/// A 256-bit vector of [4 x double] containing one of the source operands.
607/// \returns A 256-bit vector of [4 x double] containing the bitwise OR of the
608/// values between both operands.
609static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
610_mm256_or_pd(__m256d __a, __m256d __b)
611{
612 return (__m256d)((__v4du)__a | (__v4du)__b);
613}
614
615/// Performs a bitwise OR of two 256-bit vectors of [8 x float].
616///
617/// \headerfile <x86intrin.h>
618///
619/// This intrinsic corresponds to the <c> VORPS </c> instruction.
620///
621/// \param __a
622/// A 256-bit vector of [8 x float] containing one of the source operands.
623/// \param __b
624/// A 256-bit vector of [8 x float] containing one of the source operands.
625/// \returns A 256-bit vector of [8 x float] containing the bitwise OR of the
626/// values between both operands.
627static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
628_mm256_or_ps(__m256 __a, __m256 __b)
629{
630 return (__m256)((__v8su)__a | (__v8su)__b);
631}
632
633/// Performs a bitwise XOR of two 256-bit vectors of [4 x double].
634///
635/// \headerfile <x86intrin.h>
636///
637/// This intrinsic corresponds to the <c> VXORPD </c> instruction.
638///
639/// \param __a
640/// A 256-bit vector of [4 x double] containing one of the source operands.
641/// \param __b
642/// A 256-bit vector of [4 x double] containing one of the source operands.
643/// \returns A 256-bit vector of [4 x double] containing the bitwise XOR of the
644/// values between both operands.
645static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
646_mm256_xor_pd(__m256d __a, __m256d __b)
647{
648 return (__m256d)((__v4du)__a ^ (__v4du)__b);
649}
650
651/// Performs a bitwise XOR of two 256-bit vectors of [8 x float].
652///
653/// \headerfile <x86intrin.h>
654///
655/// This intrinsic corresponds to the <c> VXORPS </c> instruction.
656///
657/// \param __a
658/// A 256-bit vector of [8 x float] containing one of the source operands.
659/// \param __b
660/// A 256-bit vector of [8 x float] containing one of the source operands.
661/// \returns A 256-bit vector of [8 x float] containing the bitwise XOR of the
662/// values between both operands.
663static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
664_mm256_xor_ps(__m256 __a, __m256 __b)
665{
666 return (__m256)((__v8su)__a ^ (__v8su)__b);
667}
668
669/* Horizontal arithmetic */
670/// Horizontally adds the adjacent pairs of values contained in two
671/// 256-bit vectors of [4 x double].
672///
673/// \headerfile <x86intrin.h>
674///
675/// This intrinsic corresponds to the <c> VHADDPD </c> instruction.
676///
677/// \param __a
678/// A 256-bit vector of [4 x double] containing one of the source operands.
679/// The horizontal sums of the values are returned in the even-indexed
680/// elements of a vector of [4 x double].
681/// \param __b
682/// A 256-bit vector of [4 x double] containing one of the source operands.
683/// The horizontal sums of the values are returned in the odd-indexed
684/// elements of a vector of [4 x double].
685/// \returns A 256-bit vector of [4 x double] containing the horizontal sums of
686/// both operands.
687static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
688_mm256_hadd_pd(__m256d __a, __m256d __b) {
689 return (__m256d)__builtin_ia32_haddpd256((__v4df)__a, (__v4df)__b);
690}
691
692/// Horizontally adds the adjacent pairs of values contained in two
693/// 256-bit vectors of [8 x float].
694///
695/// \headerfile <x86intrin.h>
696///
697/// This intrinsic corresponds to the <c> VHADDPS </c> instruction.
698///
699/// \param __a
700/// A 256-bit vector of [8 x float] containing one of the source operands.
701/// The horizontal sums of the values are returned in the elements with
702/// index 0, 1, 4, 5 of a vector of [8 x float].
703/// \param __b
704/// A 256-bit vector of [8 x float] containing one of the source operands.
705/// The horizontal sums of the values are returned in the elements with
706/// index 2, 3, 6, 7 of a vector of [8 x float].
707/// \returns A 256-bit vector of [8 x float] containing the horizontal sums of
708/// both operands.
709static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hadd_ps(__m256 __a,
710 __m256 __b) {
711 return (__m256)__builtin_ia32_haddps256((__v8sf)__a, (__v8sf)__b);
712}
713
714/// Horizontally subtracts the adjacent pairs of values contained in two
715/// 256-bit vectors of [4 x double].
716///
717/// \headerfile <x86intrin.h>
718///
719/// This intrinsic corresponds to the <c> VHSUBPD </c> instruction.
720///
721/// \param __a
722/// A 256-bit vector of [4 x double] containing one of the source operands.
723/// The horizontal differences between the values are returned in the
724/// even-indexed elements of a vector of [4 x double].
725/// \param __b
726/// A 256-bit vector of [4 x double] containing one of the source operands.
727/// The horizontal differences between the values are returned in the
728/// odd-indexed elements of a vector of [4 x double].
729/// \returns A 256-bit vector of [4 x double] containing the horizontal
730/// differences of both operands.
731static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
732_mm256_hsub_pd(__m256d __a, __m256d __b) {
733 return (__m256d)__builtin_ia32_hsubpd256((__v4df)__a, (__v4df)__b);
734}
735
736/// Horizontally subtracts the adjacent pairs of values contained in two
737/// 256-bit vectors of [8 x float].
738///
739/// \headerfile <x86intrin.h>
740///
741/// This intrinsic corresponds to the <c> VHSUBPS </c> instruction.
742///
743/// \param __a
744/// A 256-bit vector of [8 x float] containing one of the source operands.
745/// The horizontal differences between the values are returned in the
746/// elements with index 0, 1, 4, 5 of a vector of [8 x float].
747/// \param __b
748/// A 256-bit vector of [8 x float] containing one of the source operands.
749/// The horizontal differences between the values are returned in the
750/// elements with index 2, 3, 6, 7 of a vector of [8 x float].
751/// \returns A 256-bit vector of [8 x float] containing the horizontal
752/// differences of both operands.
753static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hsub_ps(__m256 __a,
754 __m256 __b) {
755 return (__m256)__builtin_ia32_hsubps256((__v8sf)__a, (__v8sf)__b);
756}
757
758/* Vector permutations */
759/// Copies the values in a 128-bit vector of [2 x double] as specified
760/// by the 128-bit integer vector operand.
761///
762/// \headerfile <x86intrin.h>
763///
764/// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
765///
766/// \param __a
767/// A 128-bit vector of [2 x double].
768/// \param __c
769/// A 128-bit integer vector operand specifying how the values are to be
770/// copied. \n
771/// Bit [1]: \n
772/// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
773/// vector. \n
774/// 1: Bits [127:64] of the source are copied to bits [63:0] of the
775/// returned vector. \n
776/// Bit [65]: \n
777/// 0: Bits [63:0] of the source are copied to bits [127:64] of the
778/// returned vector. \n
779/// 1: Bits [127:64] of the source are copied to bits [127:64] of the
780/// returned vector.
781/// \returns A 128-bit vector of [2 x double] containing the copied values.
782static __inline __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
783_mm_permutevar_pd(__m128d __a, __m128i __c) {
784 return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
785}
786
787/// Copies the values in a 256-bit vector of [4 x double] as specified
788/// by the 256-bit integer vector operand.
789///
790/// \headerfile <x86intrin.h>
791///
792/// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
793///
794/// \param __a
795/// A 256-bit vector of [4 x double].
796/// \param __c
797/// A 256-bit integer vector operand specifying how the values are to be
798/// copied. \n
799/// Bit [1]: \n
800/// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
801/// vector. \n
802/// 1: Bits [127:64] of the source are copied to bits [63:0] of the
803/// returned vector. \n
804/// Bit [65]: \n
805/// 0: Bits [63:0] of the source are copied to bits [127:64] of the
806/// returned vector. \n
807/// 1: Bits [127:64] of the source are copied to bits [127:64] of the
808/// returned vector. \n
809/// Bit [129]: \n
810/// 0: Bits [191:128] of the source are copied to bits [191:128] of the
811/// returned vector. \n
812/// 1: Bits [255:192] of the source are copied to bits [191:128] of the
813/// returned vector. \n
814/// Bit [193]: \n
815/// 0: Bits [191:128] of the source are copied to bits [255:192] of the
816/// returned vector. \n
817/// 1: Bits [255:192] of the source are copied to bits [255:192] of the
818/// returned vector.
819/// \returns A 256-bit vector of [4 x double] containing the copied values.
820static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
821_mm256_permutevar_pd(__m256d __a, __m256i __c) {
822 return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)__a, (__v4di)__c);
823}
824
825/// Copies the values stored in a 128-bit vector of [4 x float] as
826/// specified by the 128-bit integer vector operand.
827///
828/// \headerfile <x86intrin.h>
829///
830/// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
831///
832/// \param __a
833/// A 128-bit vector of [4 x float].
834/// \param __c
835/// A 128-bit integer vector operand specifying how the values are to be
836/// copied. \n
837/// Bits [1:0]: \n
838/// 00: Bits [31:0] of the source are copied to bits [31:0] of the
839/// returned vector. \n
840/// 01: Bits [63:32] of the source are copied to bits [31:0] of the
841/// returned vector. \n
842/// 10: Bits [95:64] of the source are copied to bits [31:0] of the
843/// returned vector. \n
844/// 11: Bits [127:96] of the source are copied to bits [31:0] of the
845/// returned vector. \n
846/// Bits [33:32]: \n
847/// 00: Bits [31:0] of the source are copied to bits [63:32] of the
848/// returned vector. \n
849/// 01: Bits [63:32] of the source are copied to bits [63:32] of the
850/// returned vector. \n
851/// 10: Bits [95:64] of the source are copied to bits [63:32] of the
852/// returned vector. \n
853/// 11: Bits [127:96] of the source are copied to bits [63:32] of the
854/// returned vector. \n
855/// Bits [65:64]: \n
856/// 00: Bits [31:0] of the source are copied to bits [95:64] of the
857/// returned vector. \n
858/// 01: Bits [63:32] of the source are copied to bits [95:64] of the
859/// returned vector. \n
860/// 10: Bits [95:64] of the source are copied to bits [95:64] of the
861/// returned vector. \n
862/// 11: Bits [127:96] of the source are copied to bits [95:64] of the
863/// returned vector. \n
864/// Bits [97:96]: \n
865/// 00: Bits [31:0] of the source are copied to bits [127:96] of the
866/// returned vector. \n
867/// 01: Bits [63:32] of the source are copied to bits [127:96] of the
868/// returned vector. \n
869/// 10: Bits [95:64] of the source are copied to bits [127:96] of the
870/// returned vector. \n
871/// 11: Bits [127:96] of the source are copied to bits [127:96] of the
872/// returned vector.
873/// \returns A 128-bit vector of [4 x float] containing the copied values.
874static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
875_mm_permutevar_ps(__m128 __a, __m128i __c) {
876 return (__m128)__builtin_ia32_vpermilvarps((__v4sf)__a, (__v4si)__c);
877}
878
879/// Copies the values stored in a 256-bit vector of [8 x float] as
880/// specified by the 256-bit integer vector operand.
881///
882/// \headerfile <x86intrin.h>
883///
884/// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
885///
886/// \param __a
887/// A 256-bit vector of [8 x float].
888/// \param __c
889/// A 256-bit integer vector operand specifying how the values are to be
890/// copied. \n
891/// Bits [1:0]: \n
892/// 00: Bits [31:0] of the source are copied to bits [31:0] of the
893/// returned vector. \n
894/// 01: Bits [63:32] of the source are copied to bits [31:0] of the
895/// returned vector. \n
896/// 10: Bits [95:64] of the source are copied to bits [31:0] of the
897/// returned vector. \n
898/// 11: Bits [127:96] of the source are copied to bits [31:0] of the
899/// returned vector. \n
900/// Bits [33:32]: \n
901/// 00: Bits [31:0] of the source are copied to bits [63:32] of the
902/// returned vector. \n
903/// 01: Bits [63:32] of the source are copied to bits [63:32] of the
904/// returned vector. \n
905/// 10: Bits [95:64] of the source are copied to bits [63:32] of the
906/// returned vector. \n
907/// 11: Bits [127:96] of the source are copied to bits [63:32] of the
908/// returned vector. \n
909/// Bits [65:64]: \n
910/// 00: Bits [31:0] of the source are copied to bits [95:64] of the
911/// returned vector. \n
912/// 01: Bits [63:32] of the source are copied to bits [95:64] of the
913/// returned vector. \n
914/// 10: Bits [95:64] of the source are copied to bits [95:64] of the
915/// returned vector. \n
916/// 11: Bits [127:96] of the source are copied to bits [95:64] of the
917/// returned vector. \n
918/// Bits [97:96]: \n
919/// 00: Bits [31:0] of the source are copied to bits [127:96] of the
920/// returned vector. \n
921/// 01: Bits [63:32] of the source are copied to bits [127:96] of the
922/// returned vector. \n
923/// 10: Bits [95:64] of the source are copied to bits [127:96] of the
924/// returned vector. \n
925/// 11: Bits [127:96] of the source are copied to bits [127:96] of the
926/// returned vector. \n
927/// Bits [129:128]: \n
928/// 00: Bits [159:128] of the source are copied to bits [159:128] of the
929/// returned vector. \n
930/// 01: Bits [191:160] of the source are copied to bits [159:128] of the
931/// returned vector. \n
932/// 10: Bits [223:192] of the source are copied to bits [159:128] of the
933/// returned vector. \n
934/// 11: Bits [255:224] of the source are copied to bits [159:128] of the
935/// returned vector. \n
936/// Bits [161:160]: \n
937/// 00: Bits [159:128] of the source are copied to bits [191:160] of the
938/// returned vector. \n
939/// 01: Bits [191:160] of the source are copied to bits [191:160] of the
940/// returned vector. \n
941/// 10: Bits [223:192] of the source are copied to bits [191:160] of the
942/// returned vector. \n
943/// 11: Bits [255:224] of the source are copied to bits [191:160] of the
944/// returned vector. \n
945/// Bits [193:192]: \n
946/// 00: Bits [159:128] of the source are copied to bits [223:192] of the
947/// returned vector. \n
948/// 01: Bits [191:160] of the source are copied to bits [223:192] of the
949/// returned vector. \n
950/// 10: Bits [223:192] of the source are copied to bits [223:192] of the
951/// returned vector. \n
952/// 11: Bits [255:224] of the source are copied to bits [223:192] of the
953/// returned vector. \n
954/// Bits [225:224]: \n
955/// 00: Bits [159:128] of the source are copied to bits [255:224] of the
956/// returned vector. \n
957/// 01: Bits [191:160] of the source are copied to bits [255:224] of the
958/// returned vector. \n
959/// 10: Bits [223:192] of the source are copied to bits [255:224] of the
960/// returned vector. \n
961/// 11: Bits [255:224] of the source are copied to bits [255:224] of the
962/// returned vector.
963/// \returns A 256-bit vector of [8 x float] containing the copied values.
964static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
965_mm256_permutevar_ps(__m256 __a, __m256i __c) {
966 return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)__a, (__v8si)__c);
967}
968
969/// Copies the values in a 128-bit vector of [2 x double] as specified
970/// by the immediate integer operand.
971///
972/// \headerfile <x86intrin.h>
973///
974/// \code
975/// __m128d _mm_permute_pd(__m128d A, const int C);
976/// \endcode
977///
978/// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
979///
980/// \param A
981/// A 128-bit vector of [2 x double].
982/// \param C
983/// An immediate integer operand specifying how the values are to be
984/// copied. \n
985/// Bit [0]: \n
986/// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
987/// vector. \n
988/// 1: Bits [127:64] of the source are copied to bits [63:0] of the
989/// returned vector. \n
990/// Bit [1]: \n
991/// 0: Bits [63:0] of the source are copied to bits [127:64] of the
992/// returned vector. \n
993/// 1: Bits [127:64] of the source are copied to bits [127:64] of the
994/// returned vector.
995/// \returns A 128-bit vector of [2 x double] containing the copied values.
996#define _mm_permute_pd(A, C) \
997 ((__m128d)__builtin_ia32_vpermilpd((__v2df)(__m128d)(A), (int)(C)))
998
999/// Copies the values in a 256-bit vector of [4 x double] as specified by
1000/// the immediate integer operand.
1001///
1002/// \headerfile <x86intrin.h>
1003///
1004/// \code
1005/// __m256d _mm256_permute_pd(__m256d A, const int C);
1006/// \endcode
1007///
1008/// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
1009///
1010/// \param A
1011/// A 256-bit vector of [4 x double].
1012/// \param C
1013/// An immediate integer operand specifying how the values are to be
1014/// copied. \n
1015/// Bit [0]: \n
1016/// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
1017/// vector. \n
1018/// 1: Bits [127:64] of the source are copied to bits [63:0] of the
1019/// returned vector. \n
1020/// Bit [1]: \n
1021/// 0: Bits [63:0] of the source are copied to bits [127:64] of the
1022/// returned vector. \n
1023/// 1: Bits [127:64] of the source are copied to bits [127:64] of the
1024/// returned vector. \n
1025/// Bit [2]: \n
1026/// 0: Bits [191:128] of the source are copied to bits [191:128] of the
1027/// returned vector. \n
1028/// 1: Bits [255:192] of the source are copied to bits [191:128] of the
1029/// returned vector. \n
1030/// Bit [3]: \n
1031/// 0: Bits [191:128] of the source are copied to bits [255:192] of the
1032/// returned vector. \n
1033/// 1: Bits [255:192] of the source are copied to bits [255:192] of the
1034/// returned vector.
1035/// \returns A 256-bit vector of [4 x double] containing the copied values.
1036#define _mm256_permute_pd(A, C) \
1037 ((__m256d)__builtin_ia32_vpermilpd256((__v4df)(__m256d)(A), (int)(C)))
1038
1039/// Copies the values in a 128-bit vector of [4 x float] as specified by
1040/// the immediate integer operand.
1041///
1042/// \headerfile <x86intrin.h>
1043///
1044/// \code
1045/// __m128 _mm_permute_ps(__m128 A, const int C);
1046/// \endcode
1047///
1048/// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1049///
1050/// \param A
1051/// A 128-bit vector of [4 x float].
1052/// \param C
1053/// An immediate integer operand specifying how the values are to be
1054/// copied. \n
1055/// Bits [1:0]: \n
1056/// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1057/// returned vector. \n
1058/// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1059/// returned vector. \n
1060/// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1061/// returned vector. \n
1062/// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1063/// returned vector. \n
1064/// Bits [3:2]: \n
1065/// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1066/// returned vector. \n
1067/// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1068/// returned vector. \n
1069/// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1070/// returned vector. \n
1071/// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1072/// returned vector. \n
1073/// Bits [5:4]: \n
1074/// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1075/// returned vector. \n
1076/// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1077/// returned vector. \n
1078/// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1079/// returned vector. \n
1080/// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1081/// returned vector. \n
1082/// Bits [7:6]: \n
1083/// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1084/// returned vector. \n
1085/// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1086/// returned vector. \n
1087/// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1088/// returned vector. \n
1089/// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1090/// returned vector.
1091/// \returns A 128-bit vector of [4 x float] containing the copied values.
1092#define _mm_permute_ps(A, C) \
1093 ((__m128)__builtin_ia32_vpermilps((__v4sf)(__m128)(A), (int)(C)))
1094
1095/// Copies the values in a 256-bit vector of [8 x float] as specified by
1096/// the immediate integer operand.
1097///
1098/// \headerfile <x86intrin.h>
1099///
1100/// \code
1101/// __m256 _mm256_permute_ps(__m256 A, const int C);
1102/// \endcode
1103///
1104/// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1105///
1106/// \param A
1107/// A 256-bit vector of [8 x float].
1108/// \param C
1109/// An immediate integer operand specifying how the values are to be
1110/// copied. \n
1111/// Bits [1:0]: \n
1112/// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1113/// returned vector. \n
1114/// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1115/// returned vector. \n
1116/// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1117/// returned vector. \n
1118/// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1119/// returned vector. \n
1120/// Bits [3:2]: \n
1121/// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1122/// returned vector. \n
1123/// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1124/// returned vector. \n
1125/// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1126/// returned vector. \n
1127/// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1128/// returned vector. \n
1129/// Bits [5:4]: \n
1130/// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1131/// returned vector. \n
1132/// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1133/// returned vector. \n
1134/// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1135/// returned vector. \n
1136/// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1137/// returned vector. \n
1138/// Bits [7:6]: \n
1139/// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1140/// returned vector. \n
1141/// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1142/// returned vector. \n
1143/// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1144/// returned vector. \n
1145/// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1146/// returned vector. \n
1147/// Bits [1:0]: \n
1148/// 00: Bits [159:128] of the source are copied to bits [159:128] of the
1149/// returned vector. \n
1150/// 01: Bits [191:160] of the source are copied to bits [159:128] of the
1151/// returned vector. \n
1152/// 10: Bits [223:192] of the source are copied to bits [159:128] of the
1153/// returned vector. \n
1154/// 11: Bits [255:224] of the source are copied to bits [159:128] of the
1155/// returned vector. \n
1156/// Bits [3:2]: \n
1157/// 00: Bits [159:128] of the source are copied to bits [191:160] of the
1158/// returned vector. \n
1159/// 01: Bits [191:160] of the source are copied to bits [191:160] of the
1160/// returned vector. \n
1161/// 10: Bits [223:192] of the source are copied to bits [191:160] of the
1162/// returned vector. \n
1163/// 11: Bits [255:224] of the source are copied to bits [191:160] of the
1164/// returned vector. \n
1165/// Bits [5:4]: \n
1166/// 00: Bits [159:128] of the source are copied to bits [223:192] of the
1167/// returned vector. \n
1168/// 01: Bits [191:160] of the source are copied to bits [223:192] of the
1169/// returned vector. \n
1170/// 10: Bits [223:192] of the source are copied to bits [223:192] of the
1171/// returned vector. \n
1172/// 11: Bits [255:224] of the source are copied to bits [223:192] of the
1173/// returned vector. \n
1174/// Bits [7:6]: \n
1175/// 00: Bits [159:128] of the source are copied to bits [255:224] of the
1176/// returned vector. \n
1177/// 01: Bits [191:160] of the source are copied to bits [255:224] of the
1178/// returned vector. \n
1179/// 10: Bits [223:192] of the source are copied to bits [255:224] of the
1180/// returned vector. \n
1181/// 11: Bits [255:224] of the source are copied to bits [255:224] of the
1182/// returned vector.
1183/// \returns A 256-bit vector of [8 x float] containing the copied values.
1184#define _mm256_permute_ps(A, C) \
1185 ((__m256)__builtin_ia32_vpermilps256((__v8sf)(__m256)(A), (int)(C)))
1186
1187/// Permutes 128-bit data values stored in two 256-bit vectors of
1188/// [4 x double], as specified by the immediate integer operand.
1189///
1190/// \headerfile <x86intrin.h>
1191///
1192/// \code
1193/// __m256d _mm256_permute2f128_pd(__m256d V1, __m256d V2, const int M);
1194/// \endcode
1195///
1196/// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1197///
1198/// \param V1
1199/// A 256-bit vector of [4 x double].
1200/// \param V2
1201/// A 256-bit vector of [4 x double.
1202/// \param M
1203/// An immediate integer operand specifying how the values are to be
1204/// permuted. \n
1205/// Bits [1:0]: \n
1206/// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1207/// destination. \n
1208/// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1209/// destination. \n
1210/// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1211/// destination. \n
1212/// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1213/// destination. \n
1214/// Bits [5:4]: \n
1215/// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1216/// destination. \n
1217/// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1218/// destination. \n
1219/// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1220/// destination. \n
1221/// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1222/// destination.
1223/// \returns A 256-bit vector of [4 x double] containing the copied values.
1224#define _mm256_permute2f128_pd(V1, V2, M) \
1225 ((__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)(__m256d)(V1), \
1226 (__v4df)(__m256d)(V2), (int)(M)))
1227
1228/// Permutes 128-bit data values stored in two 256-bit vectors of
1229/// [8 x float], as specified by the immediate integer operand.
1230///
1231/// \headerfile <x86intrin.h>
1232///
1233/// \code
1234/// __m256 _mm256_permute2f128_ps(__m256 V1, __m256 V2, const int M);
1235/// \endcode
1236///
1237/// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1238///
1239/// \param V1
1240/// A 256-bit vector of [8 x float].
1241/// \param V2
1242/// A 256-bit vector of [8 x float].
1243/// \param M
1244/// An immediate integer operand specifying how the values are to be
1245/// permuted. \n
1246/// Bits [1:0]: \n
1247/// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1248/// destination. \n
1249/// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1250/// destination. \n
1251/// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1252/// destination. \n
1253/// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1254/// destination. \n
1255/// Bits [5:4]: \n
1256/// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1257/// destination. \n
1258/// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1259/// destination. \n
1260/// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1261/// destination. \n
1262/// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1263/// destination.
1264/// \returns A 256-bit vector of [8 x float] containing the copied values.
1265#define _mm256_permute2f128_ps(V1, V2, M) \
1266 ((__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)(__m256)(V1), \
1267 (__v8sf)(__m256)(V2), (int)(M)))
1268
1269/// Permutes 128-bit data values stored in two 256-bit integer vectors,
1270/// as specified by the immediate integer operand.
1271///
1272/// \headerfile <x86intrin.h>
1273///
1274/// \code
1275/// __m256i _mm256_permute2f128_si256(__m256i V1, __m256i V2, const int M);
1276/// \endcode
1277///
1278/// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1279///
1280/// \param V1
1281/// A 256-bit integer vector.
1282/// \param V2
1283/// A 256-bit integer vector.
1284/// \param M
1285/// An immediate integer operand specifying how the values are to be copied.
1286/// Bits [1:0]: \n
1287/// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1288/// destination. \n
1289/// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1290/// destination. \n
1291/// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1292/// destination. \n
1293/// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1294/// destination. \n
1295/// Bits [5:4]: \n
1296/// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1297/// destination. \n
1298/// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1299/// destination. \n
1300/// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1301/// destination. \n
1302/// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1303/// destination.
1304/// \returns A 256-bit integer vector containing the copied values.
1305#define _mm256_permute2f128_si256(V1, V2, M) \
1306 ((__m256i)__builtin_ia32_vperm2f128_si256((__v8si)(__m256i)(V1), \
1307 (__v8si)(__m256i)(V2), (int)(M)))
1308
1309/* Vector Blend */
1310/// Merges 64-bit double-precision data values stored in either of the
1311/// two 256-bit vectors of [4 x double], as specified by the immediate
1312/// integer operand.
1313///
1314/// \headerfile <x86intrin.h>
1315///
1316/// \code
1317/// __m256d _mm256_blend_pd(__m256d V1, __m256d V2, const int M);
1318/// \endcode
1319///
1320/// This intrinsic corresponds to the <c> VBLENDPD </c> instruction.
1321///
1322/// \param V1
1323/// A 256-bit vector of [4 x double].
1324/// \param V2
1325/// A 256-bit vector of [4 x double].
1326/// \param M
1327/// An immediate integer operand, with mask bits [3:0] specifying how the
1328/// values are to be copied. The position of the mask bit corresponds to the
1329/// index of a copied value. When a mask bit is 0, the corresponding 64-bit
1330/// element in operand \a V1 is copied to the same position in the
1331/// destination. When a mask bit is 1, the corresponding 64-bit element in
1332/// operand \a V2 is copied to the same position in the destination.
1333/// \returns A 256-bit vector of [4 x double] containing the copied values.
1334#define _mm256_blend_pd(V1, V2, M) \
1335 ((__m256d)__builtin_ia32_blendpd256((__v4df)(__m256d)(V1), \
1336 (__v4df)(__m256d)(V2), (int)(M)))
1337
1338/// Merges 32-bit single-precision data values stored in either of the
1339/// two 256-bit vectors of [8 x float], as specified by the immediate
1340/// integer operand.
1341///
1342/// \headerfile <x86intrin.h>
1343///
1344/// \code
1345/// __m256 _mm256_blend_ps(__m256 V1, __m256 V2, const int M);
1346/// \endcode
1347///
1348/// This intrinsic corresponds to the <c> VBLENDPS </c> instruction.
1349///
1350/// \param V1
1351/// A 256-bit vector of [8 x float].
1352/// \param V2
1353/// A 256-bit vector of [8 x float].
1354/// \param M
1355/// An immediate integer operand, with mask bits [7:0] specifying how the
1356/// values are to be copied. The position of the mask bit corresponds to the
1357/// index of a copied value. When a mask bit is 0, the corresponding 32-bit
1358/// element in operand \a V1 is copied to the same position in the
1359/// destination. When a mask bit is 1, the corresponding 32-bit element in
1360/// operand \a V2 is copied to the same position in the destination.
1361/// \returns A 256-bit vector of [8 x float] containing the copied values.
1362#define _mm256_blend_ps(V1, V2, M) \
1363 ((__m256)__builtin_ia32_blendps256((__v8sf)(__m256)(V1), \
1364 (__v8sf)(__m256)(V2), (int)(M)))
1365
1366/// Merges 64-bit double-precision data values stored in either of the
1367/// two 256-bit vectors of [4 x double], as specified by the 256-bit vector
1368/// operand.
1369///
1370/// \headerfile <x86intrin.h>
1371///
1372/// This intrinsic corresponds to the <c> VBLENDVPD </c> instruction.
1373///
1374/// \param __a
1375/// A 256-bit vector of [4 x double].
1376/// \param __b
1377/// A 256-bit vector of [4 x double].
1378/// \param __c
1379/// A 256-bit vector operand, with mask bits 255, 191, 127, and 63 specifying
1380/// how the values are to be copied. The position of the mask bit corresponds
1381/// to the most significant bit of a copied value. When a mask bit is 0, the
1382/// corresponding 64-bit element in operand \a __a is copied to the same
1383/// position in the destination. When a mask bit is 1, the corresponding
1384/// 64-bit element in operand \a __b is copied to the same position in the
1385/// destination.
1386/// \returns A 256-bit vector of [4 x double] containing the copied values.
1387static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
1388_mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c) {
1389 return (__m256d)__builtin_ia32_blendvpd256(
1390 (__v4df)__a, (__v4df)__b, (__v4df)__c);
1391}
1392
1393/// Merges 32-bit single-precision data values stored in either of the
1394/// two 256-bit vectors of [8 x float], as specified by the 256-bit vector
1395/// operand.
1396///
1397/// \headerfile <x86intrin.h>
1398///
1399/// This intrinsic corresponds to the <c> VBLENDVPS </c> instruction.
1400///
1401/// \param __a
1402/// A 256-bit vector of [8 x float].
1403/// \param __b
1404/// A 256-bit vector of [8 x float].
1405/// \param __c
1406/// A 256-bit vector operand, with mask bits 255, 223, 191, 159, 127, 95, 63,
1407/// and 31 specifying how the values are to be copied. The position of the
1408/// mask bit corresponds to the most significant bit of a copied value. When
1409/// a mask bit is 0, the corresponding 32-bit element in operand \a __a is
1410/// copied to the same position in the destination. When a mask bit is 1, the
1411/// corresponding 32-bit element in operand \a __b is copied to the same
1412/// position in the destination.
1413/// \returns A 256-bit vector of [8 x float] containing the copied values.
1414static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
1415_mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c) {
1416 return (__m256)__builtin_ia32_blendvps256(
1417 (__v8sf)__a, (__v8sf)__b, (__v8sf)__c);
1418}
1419
1420/* Vector Dot Product */
1421/// Computes two dot products in parallel, using the lower and upper
1422/// halves of two [8 x float] vectors as input to the two computations, and
1423/// returning the two dot products in the lower and upper halves of the
1424/// [8 x float] result.
1425///
1426/// The immediate integer operand controls which input elements will
1427/// contribute to the dot product, and where the final results are returned.
1428/// In general, for each dot product, the four corresponding elements of the
1429/// input vectors are multiplied; the first two and second two products are
1430/// summed, then the two sums are added to form the final result.
1431///
1432/// \headerfile <x86intrin.h>
1433///
1434/// \code
1435/// __m256 _mm256_dp_ps(__m256 V1, __m256 V2, const int M);
1436/// \endcode
1437///
1438/// This intrinsic corresponds to the <c> VDPPS </c> instruction.
1439///
1440/// \param V1
1441/// A vector of [8 x float] values, treated as two [4 x float] vectors.
1442/// \param V2
1443/// A vector of [8 x float] values, treated as two [4 x float] vectors.
1444/// \param M
1445/// An immediate integer argument. Bits [7:4] determine which elements of
1446/// the input vectors are used, with bit [4] corresponding to the lowest
1447/// element and bit [7] corresponding to the highest element of each [4 x
1448/// float] subvector. If a bit is set, the corresponding elements from the
1449/// two input vectors are used as an input for dot product; otherwise that
1450/// input is treated as zero. Bits [3:0] determine which elements of the
1451/// result will receive a copy of the final dot product, with bit [0]
1452/// corresponding to the lowest element and bit [3] corresponding to the
1453/// highest element of each [4 x float] subvector. If a bit is set, the dot
1454/// product is returned in the corresponding element; otherwise that element
1455/// is set to zero. The bitmask is applied in the same way to each of the
1456/// two parallel dot product computations.
1457/// \returns A 256-bit vector of [8 x float] containing the two dot products.
1458#define _mm256_dp_ps(V1, V2, M) \
1459 ((__m256)__builtin_ia32_dpps256((__v8sf)(__m256)(V1), \
1460 (__v8sf)(__m256)(V2), (M)))
1461
1462/* Vector shuffle */
1463/// Selects 8 float values from the 256-bit operands of [8 x float], as
1464/// specified by the immediate value operand.
1465///
1466/// The four selected elements in each operand are copied to the destination
1467/// according to the bits specified in the immediate operand. The selected
1468/// elements from the first 256-bit operand are copied to bits [63:0] and
1469/// bits [191:128] of the destination, and the selected elements from the
1470/// second 256-bit operand are copied to bits [127:64] and bits [255:192] of
1471/// the destination. For example, if bits [7:0] of the immediate operand
1472/// contain a value of 0xFF, the 256-bit destination vector would contain the
1473/// following values: b[7], b[7], a[7], a[7], b[3], b[3], a[3], a[3].
1474///
1475/// \headerfile <x86intrin.h>
1476///
1477/// \code
1478/// __m256 _mm256_shuffle_ps(__m256 a, __m256 b, const int mask);
1479/// \endcode
1480///
1481/// This intrinsic corresponds to the <c> VSHUFPS </c> instruction.
1482///
1483/// \param a
1484/// A 256-bit vector of [8 x float]. The four selected elements in this
1485/// operand are copied to bits [63:0] and bits [191:128] in the destination,
1486/// according to the bits specified in the immediate operand.
1487/// \param b
1488/// A 256-bit vector of [8 x float]. The four selected elements in this
1489/// operand are copied to bits [127:64] and bits [255:192] in the
1490/// destination, according to the bits specified in the immediate operand.
1491/// \param mask
1492/// An immediate value containing an 8-bit value specifying which elements to
1493/// copy from \a a and \a b \n.
1494/// Bits [3:0] specify the values copied from operand \a a. \n
1495/// Bits [7:4] specify the values copied from operand \a b. \n
1496/// The destinations within the 256-bit destination are assigned values as
1497/// follows, according to the bit value assignments described below: \n
1498/// Bits [1:0] are used to assign values to bits [31:0] and [159:128] in the
1499/// destination. \n
1500/// Bits [3:2] are used to assign values to bits [63:32] and [191:160] in the
1501/// destination. \n
1502/// Bits [5:4] are used to assign values to bits [95:64] and [223:192] in the
1503/// destination. \n
1504/// Bits [7:6] are used to assign values to bits [127:96] and [255:224] in
1505/// the destination. \n
1506/// Bit value assignments: \n
1507/// 00: Bits [31:0] and [159:128] are copied from the selected operand. \n
1508/// 01: Bits [63:32] and [191:160] are copied from the selected operand. \n
1509/// 10: Bits [95:64] and [223:192] are copied from the selected operand. \n
1510/// 11: Bits [127:96] and [255:224] are copied from the selected operand. \n
1511/// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
1512/// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
1513/// <c>[b6, b4, b2, b0]</c>.
1514/// \returns A 256-bit vector of [8 x float] containing the shuffled values.
1515#define _mm256_shuffle_ps(a, b, mask) \
1516 ((__m256)__builtin_ia32_shufps256((__v8sf)(__m256)(a), \
1517 (__v8sf)(__m256)(b), (int)(mask)))
1518
1519/// Selects four double-precision values from the 256-bit operands of
1520/// [4 x double], as specified by the immediate value operand.
1521///
1522/// The selected elements from the first 256-bit operand are copied to bits
1523/// [63:0] and bits [191:128] in the destination, and the selected elements
1524/// from the second 256-bit operand are copied to bits [127:64] and bits
1525/// [255:192] in the destination. For example, if bits [3:0] of the immediate
1526/// operand contain a value of 0xF, the 256-bit destination vector would
1527/// contain the following values: b[3], a[3], b[1], a[1].
1528///
1529/// \headerfile <x86intrin.h>
1530///
1531/// \code
1532/// __m256d _mm256_shuffle_pd(__m256d a, __m256d b, const int mask);
1533/// \endcode
1534///
1535/// This intrinsic corresponds to the <c> VSHUFPD </c> instruction.
1536///
1537/// \param a
1538/// A 256-bit vector of [4 x double].
1539/// \param b
1540/// A 256-bit vector of [4 x double].
1541/// \param mask
1542/// An immediate value containing 8-bit values specifying which elements to
1543/// copy from \a a and \a b: \n
1544/// Bit [0]=0: Bits [63:0] are copied from \a a to bits [63:0] of the
1545/// destination. \n
1546/// Bit [0]=1: Bits [127:64] are copied from \a a to bits [63:0] of the
1547/// destination. \n
1548/// Bit [1]=0: Bits [63:0] are copied from \a b to bits [127:64] of the
1549/// destination. \n
1550/// Bit [1]=1: Bits [127:64] are copied from \a b to bits [127:64] of the
1551/// destination. \n
1552/// Bit [2]=0: Bits [191:128] are copied from \a a to bits [191:128] of the
1553/// destination. \n
1554/// Bit [2]=1: Bits [255:192] are copied from \a a to bits [191:128] of the
1555/// destination. \n
1556/// Bit [3]=0: Bits [191:128] are copied from \a b to bits [255:192] of the
1557/// destination. \n
1558/// Bit [3]=1: Bits [255:192] are copied from \a b to bits [255:192] of the
1559/// destination.
1560/// \returns A 256-bit vector of [4 x double] containing the shuffled values.
1561#define _mm256_shuffle_pd(a, b, mask) \
1562 ((__m256d)__builtin_ia32_shufpd256((__v4df)(__m256d)(a), \
1563 (__v4df)(__m256d)(b), (int)(mask)))
1564
1565/* Compare */
1566#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */
1567#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */
1568#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */
1569#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */
1570#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */
1571#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */
1572#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */
1573#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */
1574#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */
1575#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */
1576#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */
1577#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */
1578#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */
1579#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */
1580#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */
1581#define _CMP_ORD_S 0x17 /* Ordered (signaling) */
1582#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */
1583#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */
1584#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */
1585#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */
1586#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */
1587#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */
1588#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */
1589#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */
1590
1591/* Below intrinsic defined in emmintrin.h can be used for AVX */
1592/// Compares each of the corresponding double-precision values of two
1593/// 128-bit vectors of [2 x double], using the operation specified by the
1594/// immediate integer operand.
1595///
1596/// Each comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
1597/// If either value in a comparison is NaN, comparisons that are ordered
1598/// return false, and comparisons that are unordered return true.
1599///
1600/// \headerfile <x86intrin.h>
1601///
1602/// \code
1603/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
1604/// \endcode
1605///
1606/// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1607///
1608/// \param a
1609/// A 128-bit vector of [2 x double].
1610/// \param b
1611/// A 128-bit vector of [2 x double].
1612/// \param c
1613/// An immediate integer operand, with bits [4:0] specifying which comparison
1614/// operation to use: \n
1615/// 0x00: Equal (ordered, non-signaling) \n
1616/// 0x01: Less-than (ordered, signaling) \n
1617/// 0x02: Less-than-or-equal (ordered, signaling) \n
1618/// 0x03: Unordered (non-signaling) \n
1619/// 0x04: Not-equal (unordered, non-signaling) \n
1620/// 0x05: Not-less-than (unordered, signaling) \n
1621/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1622/// 0x07: Ordered (non-signaling) \n
1623/// 0x08: Equal (unordered, non-signaling) \n
1624/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1625/// 0x0A: Not-greater-than (unordered, signaling) \n
1626/// 0x0B: False (ordered, non-signaling) \n
1627/// 0x0C: Not-equal (ordered, non-signaling) \n
1628/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1629/// 0x0E: Greater-than (ordered, signaling) \n
1630/// 0x0F: True (unordered, non-signaling) \n
1631/// 0x10: Equal (ordered, signaling) \n
1632/// 0x11: Less-than (ordered, non-signaling) \n
1633/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1634/// 0x13: Unordered (signaling) \n
1635/// 0x14: Not-equal (unordered, signaling) \n
1636/// 0x15: Not-less-than (unordered, non-signaling) \n
1637/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1638/// 0x17: Ordered (signaling) \n
1639/// 0x18: Equal (unordered, signaling) \n
1640/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1641/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1642/// 0x1B: False (ordered, signaling) \n
1643/// 0x1C: Not-equal (ordered, signaling) \n
1644/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1645/// 0x1E: Greater-than (ordered, non-signaling) \n
1646/// 0x1F: True (unordered, signaling)
1647/// \returns A 128-bit vector of [2 x double] containing the comparison results.
1648/// \fn __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c)
1649
1650/* Below intrinsic defined in xmmintrin.h can be used for AVX */
1651/// Compares each of the corresponding values of two 128-bit vectors of
1652/// [4 x float], using the operation specified by the immediate integer
1653/// operand.
1654///
1655/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
1656/// If either value in a comparison is NaN, comparisons that are ordered
1657/// return false, and comparisons that are unordered return true.
1658///
1659/// \headerfile <x86intrin.h>
1660///
1661/// \code
1662/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
1663/// \endcode
1664///
1665/// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1666///
1667/// \param a
1668/// A 128-bit vector of [4 x float].
1669/// \param b
1670/// A 128-bit vector of [4 x float].
1671/// \param c
1672/// An immediate integer operand, with bits [4:0] specifying which comparison
1673/// operation to use: \n
1674/// 0x00: Equal (ordered, non-signaling) \n
1675/// 0x01: Less-than (ordered, signaling) \n
1676/// 0x02: Less-than-or-equal (ordered, signaling) \n
1677/// 0x03: Unordered (non-signaling) \n
1678/// 0x04: Not-equal (unordered, non-signaling) \n
1679/// 0x05: Not-less-than (unordered, signaling) \n
1680/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1681/// 0x07: Ordered (non-signaling) \n
1682/// 0x08: Equal (unordered, non-signaling) \n
1683/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1684/// 0x0A: Not-greater-than (unordered, signaling) \n
1685/// 0x0B: False (ordered, non-signaling) \n
1686/// 0x0C: Not-equal (ordered, non-signaling) \n
1687/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1688/// 0x0E: Greater-than (ordered, signaling) \n
1689/// 0x0F: True (unordered, non-signaling) \n
1690/// 0x10: Equal (ordered, signaling) \n
1691/// 0x11: Less-than (ordered, non-signaling) \n
1692/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1693/// 0x13: Unordered (signaling) \n
1694/// 0x14: Not-equal (unordered, signaling) \n
1695/// 0x15: Not-less-than (unordered, non-signaling) \n
1696/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1697/// 0x17: Ordered (signaling) \n
1698/// 0x18: Equal (unordered, signaling) \n
1699/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1700/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1701/// 0x1B: False (ordered, signaling) \n
1702/// 0x1C: Not-equal (ordered, signaling) \n
1703/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1704/// 0x1E: Greater-than (ordered, non-signaling) \n
1705/// 0x1F: True (unordered, signaling)
1706/// \returns A 128-bit vector of [4 x float] containing the comparison results.
1707/// \fn __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c)
1708
1709/// Compares each of the corresponding double-precision values of two
1710/// 256-bit vectors of [4 x double], using the operation specified by the
1711/// immediate integer operand.
1712///
1713/// Each comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
1714/// If either value in a comparison is NaN, comparisons that are ordered
1715/// return false, and comparisons that are unordered return true.
1716///
1717/// \headerfile <x86intrin.h>
1718///
1719/// \code
1720/// __m256d _mm256_cmp_pd(__m256d a, __m256d b, const int c);
1721/// \endcode
1722///
1723/// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1724///
1725/// \param a
1726/// A 256-bit vector of [4 x double].
1727/// \param b
1728/// A 256-bit vector of [4 x double].
1729/// \param c
1730/// An immediate integer operand, with bits [4:0] specifying which comparison
1731/// operation to use: \n
1732/// 0x00: Equal (ordered, non-signaling) \n
1733/// 0x01: Less-than (ordered, signaling) \n
1734/// 0x02: Less-than-or-equal (ordered, signaling) \n
1735/// 0x03: Unordered (non-signaling) \n
1736/// 0x04: Not-equal (unordered, non-signaling) \n
1737/// 0x05: Not-less-than (unordered, signaling) \n
1738/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1739/// 0x07: Ordered (non-signaling) \n
1740/// 0x08: Equal (unordered, non-signaling) \n
1741/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1742/// 0x0A: Not-greater-than (unordered, signaling) \n
1743/// 0x0B: False (ordered, non-signaling) \n
1744/// 0x0C: Not-equal (ordered, non-signaling) \n
1745/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1746/// 0x0E: Greater-than (ordered, signaling) \n
1747/// 0x0F: True (unordered, non-signaling) \n
1748/// 0x10: Equal (ordered, signaling) \n
1749/// 0x11: Less-than (ordered, non-signaling) \n
1750/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1751/// 0x13: Unordered (signaling) \n
1752/// 0x14: Not-equal (unordered, signaling) \n
1753/// 0x15: Not-less-than (unordered, non-signaling) \n
1754/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1755/// 0x17: Ordered (signaling) \n
1756/// 0x18: Equal (unordered, signaling) \n
1757/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1758/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1759/// 0x1B: False (ordered, signaling) \n
1760/// 0x1C: Not-equal (ordered, signaling) \n
1761/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1762/// 0x1E: Greater-than (ordered, non-signaling) \n
1763/// 0x1F: True (unordered, signaling)
1764/// \returns A 256-bit vector of [4 x double] containing the comparison results.
1765#define _mm256_cmp_pd(a, b, c) \
1766 ((__m256d)__builtin_ia32_cmppd256((__v4df)(__m256d)(a), \
1767 (__v4df)(__m256d)(b), (c)))
1768
1769/// Compares each of the corresponding values of two 256-bit vectors of
1770/// [8 x float], using the operation specified by the immediate integer
1771/// operand.
1772///
1773/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
1774/// If either value in a comparison is NaN, comparisons that are ordered
1775/// return false, and comparisons that are unordered return true.
1776///
1777/// \headerfile <x86intrin.h>
1778///
1779/// \code
1780/// __m256 _mm256_cmp_ps(__m256 a, __m256 b, const int c);
1781/// \endcode
1782///
1783/// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1784///
1785/// \param a
1786/// A 256-bit vector of [8 x float].
1787/// \param b
1788/// A 256-bit vector of [8 x float].
1789/// \param c
1790/// An immediate integer operand, with bits [4:0] specifying which comparison
1791/// operation to use: \n
1792/// 0x00: Equal (ordered, non-signaling) \n
1793/// 0x01: Less-than (ordered, signaling) \n
1794/// 0x02: Less-than-or-equal (ordered, signaling) \n
1795/// 0x03: Unordered (non-signaling) \n
1796/// 0x04: Not-equal (unordered, non-signaling) \n
1797/// 0x05: Not-less-than (unordered, signaling) \n
1798/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1799/// 0x07: Ordered (non-signaling) \n
1800/// 0x08: Equal (unordered, non-signaling) \n
1801/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1802/// 0x0A: Not-greater-than (unordered, signaling) \n
1803/// 0x0B: False (ordered, non-signaling) \n
1804/// 0x0C: Not-equal (ordered, non-signaling) \n
1805/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1806/// 0x0E: Greater-than (ordered, signaling) \n
1807/// 0x0F: True (unordered, non-signaling) \n
1808/// 0x10: Equal (ordered, signaling) \n
1809/// 0x11: Less-than (ordered, non-signaling) \n
1810/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1811/// 0x13: Unordered (signaling) \n
1812/// 0x14: Not-equal (unordered, signaling) \n
1813/// 0x15: Not-less-than (unordered, non-signaling) \n
1814/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1815/// 0x17: Ordered (signaling) \n
1816/// 0x18: Equal (unordered, signaling) \n
1817/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1818/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1819/// 0x1B: False (ordered, signaling) \n
1820/// 0x1C: Not-equal (ordered, signaling) \n
1821/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1822/// 0x1E: Greater-than (ordered, non-signaling) \n
1823/// 0x1F: True (unordered, signaling)
1824/// \returns A 256-bit vector of [8 x float] containing the comparison results.
1825#define _mm256_cmp_ps(a, b, c) \
1826 ((__m256)__builtin_ia32_cmpps256((__v8sf)(__m256)(a), \
1827 (__v8sf)(__m256)(b), (c)))
1828
1829/* Below intrinsic defined in emmintrin.h can be used for AVX */
1830/// Compares each of the corresponding scalar double-precision values of
1831/// two 128-bit vectors of [2 x double], using the operation specified by the
1832/// immediate integer operand.
1833///
1834/// Each comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
1835/// If either value in a comparison is NaN, comparisons that are ordered
1836/// return false, and comparisons that are unordered return true.
1837///
1838/// \headerfile <x86intrin.h>
1839///
1840/// \code
1841/// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c);
1842/// \endcode
1843///
1844/// This intrinsic corresponds to the <c> VCMPSD </c> instruction.
1845///
1846/// \param a
1847/// A 128-bit vector of [2 x double].
1848/// \param b
1849/// A 128-bit vector of [2 x double].
1850/// \param c
1851/// An immediate integer operand, with bits [4:0] specifying which comparison
1852/// operation to use: \n
1853/// 0x00: Equal (ordered, non-signaling) \n
1854/// 0x01: Less-than (ordered, signaling) \n
1855/// 0x02: Less-than-or-equal (ordered, signaling) \n
1856/// 0x03: Unordered (non-signaling) \n
1857/// 0x04: Not-equal (unordered, non-signaling) \n
1858/// 0x05: Not-less-than (unordered, signaling) \n
1859/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1860/// 0x07: Ordered (non-signaling) \n
1861/// 0x08: Equal (unordered, non-signaling) \n
1862/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1863/// 0x0A: Not-greater-than (unordered, signaling) \n
1864/// 0x0B: False (ordered, non-signaling) \n
1865/// 0x0C: Not-equal (ordered, non-signaling) \n
1866/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1867/// 0x0E: Greater-than (ordered, signaling) \n
1868/// 0x0F: True (unordered, non-signaling) \n
1869/// 0x10: Equal (ordered, signaling) \n
1870/// 0x11: Less-than (ordered, non-signaling) \n
1871/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1872/// 0x13: Unordered (signaling) \n
1873/// 0x14: Not-equal (unordered, signaling) \n
1874/// 0x15: Not-less-than (unordered, non-signaling) \n
1875/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1876/// 0x17: Ordered (signaling) \n
1877/// 0x18: Equal (unordered, signaling) \n
1878/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1879/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1880/// 0x1B: False (ordered, signaling) \n
1881/// 0x1C: Not-equal (ordered, signaling) \n
1882/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1883/// 0x1E: Greater-than (ordered, non-signaling) \n
1884/// 0x1F: True (unordered, signaling)
1885/// \returns A 128-bit vector of [2 x double] containing the comparison results.
1886/// \fn __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c)
1887
1888/* Below intrinsic defined in xmmintrin.h can be used for AVX */
1889/// Compares each of the corresponding scalar values of two 128-bit
1890/// vectors of [4 x float], using the operation specified by the immediate
1891/// integer operand.
1892///
1893/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
1894/// If either value in a comparison is NaN, comparisons that are ordered
1895/// return false, and comparisons that are unordered return true.
1896///
1897/// \headerfile <x86intrin.h>
1898///
1899/// \code
1900/// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c);
1901/// \endcode
1902///
1903/// This intrinsic corresponds to the <c> VCMPSS </c> instruction.
1904///
1905/// \param a
1906/// A 128-bit vector of [4 x float].
1907/// \param b
1908/// A 128-bit vector of [4 x float].
1909/// \param c
1910/// An immediate integer operand, with bits [4:0] specifying which comparison
1911/// operation to use: \n
1912/// 0x00: Equal (ordered, non-signaling) \n
1913/// 0x01: Less-than (ordered, signaling) \n
1914/// 0x02: Less-than-or-equal (ordered, signaling) \n
1915/// 0x03: Unordered (non-signaling) \n
1916/// 0x04: Not-equal (unordered, non-signaling) \n
1917/// 0x05: Not-less-than (unordered, signaling) \n
1918/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1919/// 0x07: Ordered (non-signaling) \n
1920/// 0x08: Equal (unordered, non-signaling) \n
1921/// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1922/// 0x0A: Not-greater-than (unordered, signaling) \n
1923/// 0x0B: False (ordered, non-signaling) \n
1924/// 0x0C: Not-equal (ordered, non-signaling) \n
1925/// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1926/// 0x0E: Greater-than (ordered, signaling) \n
1927/// 0x0F: True (unordered, non-signaling) \n
1928/// 0x10: Equal (ordered, signaling) \n
1929/// 0x11: Less-than (ordered, non-signaling) \n
1930/// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1931/// 0x13: Unordered (signaling) \n
1932/// 0x14: Not-equal (unordered, signaling) \n
1933/// 0x15: Not-less-than (unordered, non-signaling) \n
1934/// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1935/// 0x17: Ordered (signaling) \n
1936/// 0x18: Equal (unordered, signaling) \n
1937/// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1938/// 0x1A: Not-greater-than (unordered, non-signaling) \n
1939/// 0x1B: False (ordered, signaling) \n
1940/// 0x1C: Not-equal (ordered, signaling) \n
1941/// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1942/// 0x1E: Greater-than (ordered, non-signaling) \n
1943/// 0x1F: True (unordered, signaling)
1944/// \returns A 128-bit vector of [4 x float] containing the comparison results.
1945/// \fn __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c)
1946
1947/// Takes a [8 x i32] vector and returns the vector element value
1948/// indexed by the immediate constant operand.
1949///
1950/// \headerfile <x86intrin.h>
1951///
1952/// \code
1953/// int _mm256_extract_epi32(__m256i X, const int N);
1954/// \endcode
1955///
1956/// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1957/// instruction.
1958///
1959/// \param X
1960/// A 256-bit vector of [8 x i32].
1961/// \param N
1962/// An immediate integer operand with bits [2:0] determining which vector
1963/// element is extracted and returned.
1964/// \returns A 32-bit integer containing the extracted 32 bits of extended
1965/// packed data.
1966#define _mm256_extract_epi32(X, N) \
1967 ((int)__builtin_ia32_vec_ext_v8si((__v8si)(__m256i)(X), (int)(N)))
1968
1969/// Takes a [16 x i16] vector and returns the vector element value
1970/// indexed by the immediate constant operand.
1971///
1972/// \headerfile <x86intrin.h>
1973///
1974/// \code
1975/// int _mm256_extract_epi16(__m256i X, const int N);
1976/// \endcode
1977///
1978/// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1979/// instruction.
1980///
1981/// \param X
1982/// A 256-bit integer vector of [16 x i16].
1983/// \param N
1984/// An immediate integer operand with bits [3:0] determining which vector
1985/// element is extracted and returned.
1986/// \returns A 32-bit integer containing the extracted 16 bits of zero extended
1987/// packed data.
1988#define _mm256_extract_epi16(X, N) \
1989 ((int)(unsigned short)__builtin_ia32_vec_ext_v16hi((__v16hi)(__m256i)(X), \
1990 (int)(N)))
1991
1992/// Takes a [32 x i8] vector and returns the vector element value
1993/// indexed by the immediate constant operand.
1994///
1995/// \headerfile <x86intrin.h>
1996///
1997/// \code
1998/// int _mm256_extract_epi8(__m256i X, const int N);
1999/// \endcode
2000///
2001/// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2002/// instruction.
2003///
2004/// \param X
2005/// A 256-bit integer vector of [32 x i8].
2006/// \param N
2007/// An immediate integer operand with bits [4:0] determining which vector
2008/// element is extracted and returned.
2009/// \returns A 32-bit integer containing the extracted 8 bits of zero extended
2010/// packed data.
2011#define _mm256_extract_epi8(X, N) \
2012 ((int)(unsigned char)__builtin_ia32_vec_ext_v32qi((__v32qi)(__m256i)(X), \
2013 (int)(N)))
2014
2015#ifdef __x86_64__
2016/// Takes a [4 x i64] vector and returns the vector element value
2017/// indexed by the immediate constant operand.
2018///
2019/// \headerfile <x86intrin.h>
2020///
2021/// \code
2022/// long long _mm256_extract_epi64(__m256i X, const int N);
2023/// \endcode
2024///
2025/// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2026/// instruction.
2027///
2028/// \param X
2029/// A 256-bit integer vector of [4 x i64].
2030/// \param N
2031/// An immediate integer operand with bits [1:0] determining which vector
2032/// element is extracted and returned.
2033/// \returns A 64-bit integer containing the extracted 64 bits of extended
2034/// packed data.
2035#define _mm256_extract_epi64(X, N) \
2036 ((long long)__builtin_ia32_vec_ext_v4di((__v4di)(__m256i)(X), (int)(N)))
2037#endif
2038
2039/// Takes a [8 x i32] vector and replaces the vector element value
2040/// indexed by the immediate constant operand by a new value. Returns the
2041/// modified vector.
2042///
2043/// \headerfile <x86intrin.h>
2044///
2045/// \code
2046/// __m256i _mm256_insert_epi32(__m256i X, int I, const int N);
2047/// \endcode
2048///
2049/// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2050/// instruction.
2051///
2052/// \param X
2053/// A vector of [8 x i32] to be used by the insert operation.
2054/// \param I
2055/// An integer value. The replacement value for the insert operation.
2056/// \param N
2057/// An immediate integer specifying the index of the vector element to be
2058/// replaced.
2059/// \returns A copy of vector \a X, after replacing its element indexed by
2060/// \a N with \a I.
2061#define _mm256_insert_epi32(X, I, N) \
2062 ((__m256i)__builtin_ia32_vec_set_v8si((__v8si)(__m256i)(X), \
2063 (int)(I), (int)(N)))
2064
2065
2066/// Takes a [16 x i16] vector and replaces the vector element value
2067/// indexed by the immediate constant operand with a new value. Returns the
2068/// modified vector.
2069///
2070/// \headerfile <x86intrin.h>
2071///
2072/// \code
2073/// __m256i _mm256_insert_epi16(__m256i X, int I, const int N);
2074/// \endcode
2075///
2076/// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2077/// instruction.
2078///
2079/// \param X
2080/// A vector of [16 x i16] to be used by the insert operation.
2081/// \param I
2082/// An i16 integer value. The replacement value for the insert operation.
2083/// \param N
2084/// An immediate integer specifying the index of the vector element to be
2085/// replaced.
2086/// \returns A copy of vector \a X, after replacing its element indexed by
2087/// \a N with \a I.
2088#define _mm256_insert_epi16(X, I, N) \
2089 ((__m256i)__builtin_ia32_vec_set_v16hi((__v16hi)(__m256i)(X), \
2090 (int)(I), (int)(N)))
2091
2092/// Takes a [32 x i8] vector and replaces the vector element value
2093/// indexed by the immediate constant operand with a new value. Returns the
2094/// modified vector.
2095///
2096/// \headerfile <x86intrin.h>
2097///
2098/// \code
2099/// __m256i _mm256_insert_epi8(__m256i X, int I, const int N);
2100/// \endcode
2101///
2102/// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2103/// instruction.
2104///
2105/// \param X
2106/// A vector of [32 x i8] to be used by the insert operation.
2107/// \param I
2108/// An i8 integer value. The replacement value for the insert operation.
2109/// \param N
2110/// An immediate integer specifying the index of the vector element to be
2111/// replaced.
2112/// \returns A copy of vector \a X, after replacing its element indexed by
2113/// \a N with \a I.
2114#define _mm256_insert_epi8(X, I, N) \
2115 ((__m256i)__builtin_ia32_vec_set_v32qi((__v32qi)(__m256i)(X), \
2116 (int)(I), (int)(N)))
2117
2118#ifdef __x86_64__
2119/// Takes a [4 x i64] vector and replaces the vector element value
2120/// indexed by the immediate constant operand with a new value. Returns the
2121/// modified vector.
2122///
2123/// \headerfile <x86intrin.h>
2124///
2125/// \code
2126/// __m256i _mm256_insert_epi64(__m256i X, int I, const int N);
2127/// \endcode
2128///
2129/// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2130/// instruction.
2131///
2132/// \param X
2133/// A vector of [4 x i64] to be used by the insert operation.
2134/// \param I
2135/// A 64-bit integer value. The replacement value for the insert operation.
2136/// \param N
2137/// An immediate integer specifying the index of the vector element to be
2138/// replaced.
2139/// \returns A copy of vector \a X, after replacing its element indexed by
2140/// \a N with \a I.
2141#define _mm256_insert_epi64(X, I, N) \
2142 ((__m256i)__builtin_ia32_vec_set_v4di((__v4di)(__m256i)(X), \
2143 (long long)(I), (int)(N)))
2144#endif
2145
2146/* Conversion */
2147/// Converts a vector of [4 x i32] into a vector of [4 x double].
2148///
2149/// \headerfile <x86intrin.h>
2150///
2151/// This intrinsic corresponds to the <c> VCVTDQ2PD </c> instruction.
2152///
2153/// \param __a
2154/// A 128-bit integer vector of [4 x i32].
2155/// \returns A 256-bit vector of [4 x double] containing the converted values.
2156static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2158 return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
2159}
2160
2161/// Converts a vector of [8 x i32] into a vector of [8 x float].
2162///
2163/// \headerfile <x86intrin.h>
2164///
2165/// This intrinsic corresponds to the <c> VCVTDQ2PS </c> instruction.
2166///
2167/// \param __a
2168/// A 256-bit integer vector.
2169/// \returns A 256-bit vector of [8 x float] containing the converted values.
2170static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2172 return (__m256)__builtin_convertvector((__v8si)__a, __v8sf);
2173}
2174
2175/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
2176/// [4 x float].
2177///
2178/// \headerfile <x86intrin.h>
2179///
2180/// This intrinsic corresponds to the <c> VCVTPD2PS </c> instruction.
2181///
2182/// \param __a
2183/// A 256-bit vector of [4 x double].
2184/// \returns A 128-bit vector of [4 x float] containing the converted values.
2185static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2187 return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
2188}
2189
2190/// Converts a vector of [8 x float] into a vector of [8 x i32].
2191///
2192/// If a converted value does not fit in a 32-bit integer, raises a
2193/// floating-point invalid exception. If the exception is masked, returns
2194/// the most negative integer.
2195///
2196/// \headerfile <x86intrin.h>
2197///
2198/// This intrinsic corresponds to the <c> VCVTPS2DQ </c> instruction.
2199///
2200/// \param __a
2201/// A 256-bit vector of [8 x float].
2202/// \returns A 256-bit integer vector containing the converted values.
2203static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
2205 return (__m256i)__builtin_ia32_cvtps2dq256((__v8sf)__a);
2206}
2207
2208/// Converts a 128-bit vector of [4 x float] into a 256-bit vector of [4
2209/// x double].
2210///
2211/// \headerfile <x86intrin.h>
2212///
2213/// This intrinsic corresponds to the <c> VCVTPS2PD </c> instruction.
2214///
2215/// \param __a
2216/// A 128-bit vector of [4 x float].
2217/// \returns A 256-bit vector of [4 x double] containing the converted values.
2218static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2220 return (__m256d)__builtin_convertvector((__v4sf)__a, __v4df);
2221}
2222
2223/// Converts a 256-bit vector of [4 x double] into four signed truncated
2224/// (rounded toward zero) 32-bit integers returned in a 128-bit vector of
2225/// [4 x i32].
2226///
2227/// If a converted value does not fit in a 32-bit integer, raises a
2228/// floating-point invalid exception. If the exception is masked, returns
2229/// the most negative integer.
2230///
2231/// \headerfile <x86intrin.h>
2232///
2233/// This intrinsic corresponds to the <c> VCVTTPD2DQ </c> instruction.
2234///
2235/// \param __a
2236/// A 256-bit vector of [4 x double].
2237/// \returns A 128-bit integer vector containing the converted values.
2238static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2240 return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df)__a);
2241}
2242
2243/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
2244/// [4 x i32].
2245///
2246/// If a converted value does not fit in a 32-bit integer, raises a
2247/// floating-point invalid exception. If the exception is masked, returns
2248/// the most negative integer.
2249///
2250/// \headerfile <x86intrin.h>
2251///
2252/// This intrinsic corresponds to the <c> VCVTPD2DQ </c> instruction.
2253///
2254/// \param __a
2255/// A 256-bit vector of [4 x double].
2256/// \returns A 128-bit integer vector containing the converted values.
2257static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2259 return (__m128i)__builtin_ia32_cvtpd2dq256((__v4df)__a);
2260}
2261
2262/// Converts a vector of [8 x float] into eight signed truncated (rounded
2263/// toward zero) 32-bit integers returned in a vector of [8 x i32].
2264///
2265/// If a converted value does not fit in a 32-bit integer, raises a
2266/// floating-point invalid exception. If the exception is masked, returns
2267/// the most negative integer.
2268///
2269/// \headerfile <x86intrin.h>
2270///
2271/// This intrinsic corresponds to the <c> VCVTTPS2DQ </c> instruction.
2272///
2273/// \param __a
2274/// A 256-bit vector of [8 x float].
2275/// \returns A 256-bit integer vector containing the converted values.
2276static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
2278 return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf)__a);
2279}
2280
2281/// Returns the first element of the input vector of [4 x double].
2282///
2283/// \headerfile <x86intrin.h>
2284///
2285/// This intrinsic is a utility function and does not correspond to a specific
2286/// instruction.
2287///
2288/// \param __a
2289/// A 256-bit vector of [4 x double].
2290/// \returns A 64 bit double containing the first element of the input vector.
2291static __inline double __DEFAULT_FN_ATTRS_CONSTEXPR
2293 return __a[0];
2294}
2295
2296/// Returns the first element of the input vector of [8 x i32].
2297///
2298/// \headerfile <x86intrin.h>
2299///
2300/// This intrinsic is a utility function and does not correspond to a specific
2301/// instruction.
2302///
2303/// \param __a
2304/// A 256-bit vector of [8 x i32].
2305/// \returns A 32 bit integer containing the first element of the input vector.
2306static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2308 __v8si __b = (__v8si)__a;
2309 return __b[0];
2310}
2311
2312/// Returns the first element of the input vector of [8 x float].
2313///
2314/// \headerfile <x86intrin.h>
2315///
2316/// This intrinsic is a utility function and does not correspond to a specific
2317/// instruction.
2318///
2319/// \param __a
2320/// A 256-bit vector of [8 x float].
2321/// \returns A 32 bit float containing the first element of the input vector.
2322static __inline float __DEFAULT_FN_ATTRS_CONSTEXPR
2324 return __a[0];
2325}
2326
2327/* Vector replicate */
2328/// Moves and duplicates odd-indexed values from a 256-bit vector of
2329/// [8 x float] to float values in a 256-bit vector of [8 x float].
2330///
2331/// \headerfile <x86intrin.h>
2332///
2333/// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction.
2334///
2335/// \param __a
2336/// A 256-bit vector of [8 x float]. \n
2337/// Bits [255:224] of \a __a are written to bits [255:224] and [223:192] of
2338/// the return value. \n
2339/// Bits [191:160] of \a __a are written to bits [191:160] and [159:128] of
2340/// the return value. \n
2341/// Bits [127:96] of \a __a are written to bits [127:96] and [95:64] of the
2342/// return value. \n
2343/// Bits [63:32] of \a __a are written to bits [63:32] and [31:0] of the
2344/// return value.
2345/// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2346/// values.
2347static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2349{
2350 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 1, 1, 3, 3, 5, 5, 7, 7);
2351}
2352
2353/// Moves and duplicates even-indexed values from a 256-bit vector of
2354/// [8 x float] to float values in a 256-bit vector of [8 x float].
2355///
2356/// \headerfile <x86intrin.h>
2357///
2358/// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction.
2359///
2360/// \param __a
2361/// A 256-bit vector of [8 x float]. \n
2362/// Bits [223:192] of \a __a are written to bits [255:224] and [223:192] of
2363/// the return value. \n
2364/// Bits [159:128] of \a __a are written to bits [191:160] and [159:128] of
2365/// the return value. \n
2366/// Bits [95:64] of \a __a are written to bits [127:96] and [95:64] of the
2367/// return value. \n
2368/// Bits [31:0] of \a __a are written to bits [63:32] and [31:0] of the
2369/// return value.
2370/// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2371/// values.
2372static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2374{
2375 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 0, 2, 2, 4, 4, 6, 6);
2376}
2377
2378/// Moves and duplicates double-precision floating point values from a
2379/// 256-bit vector of [4 x double] to double-precision values in a 256-bit
2380/// vector of [4 x double].
2381///
2382/// \headerfile <x86intrin.h>
2383///
2384/// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction.
2385///
2386/// \param __a
2387/// A 256-bit vector of [4 x double]. \n
2388/// Bits [63:0] of \a __a are written to bits [127:64] and [63:0] of the
2389/// return value. \n
2390/// Bits [191:128] of \a __a are written to bits [255:192] and [191:128] of
2391/// the return value.
2392/// \returns A 256-bit vector of [4 x double] containing the moved and
2393/// duplicated values.
2394static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2396{
2397 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 0, 2, 2);
2398}
2399
2400/* Unpack and Interleave */
2401/// Unpacks the odd-indexed vector elements from two 256-bit vectors of
2402/// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2403///
2404/// \headerfile <x86intrin.h>
2405///
2406/// This intrinsic corresponds to the <c> VUNPCKHPD </c> instruction.
2407///
2408/// \param __a
2409/// A 256-bit floating-point vector of [4 x double]. \n
2410/// Bits [127:64] are written to bits [63:0] of the return value. \n
2411/// Bits [255:192] are written to bits [191:128] of the return value. \n
2412/// \param __b
2413/// A 256-bit floating-point vector of [4 x double]. \n
2414/// Bits [127:64] are written to bits [127:64] of the return value. \n
2415/// Bits [255:192] are written to bits [255:192] of the return value. \n
2416/// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2417static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2418_mm256_unpackhi_pd(__m256d __a, __m256d __b) {
2419 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 1, 5, 1+2, 5+2);
2420}
2421
2422/// Unpacks the even-indexed vector elements from two 256-bit vectors of
2423/// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2424///
2425/// \headerfile <x86intrin.h>
2426///
2427/// This intrinsic corresponds to the <c> VUNPCKLPD </c> instruction.
2428///
2429/// \param __a
2430/// A 256-bit floating-point vector of [4 x double]. \n
2431/// Bits [63:0] are written to bits [63:0] of the return value. \n
2432/// Bits [191:128] are written to bits [191:128] of the return value.
2433/// \param __b
2434/// A 256-bit floating-point vector of [4 x double]. \n
2435/// Bits [63:0] are written to bits [127:64] of the return value. \n
2436/// Bits [191:128] are written to bits [255:192] of the return value. \n
2437/// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2438static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
2439_mm256_unpacklo_pd(__m256d __a, __m256d __b) {
2440 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 0, 4, 0+2, 4+2);
2441}
2442
2443/// Unpacks the 32-bit vector elements 2, 3, 6 and 7 from each of the
2444/// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2445/// vector of [8 x float].
2446///
2447/// \headerfile <x86intrin.h>
2448///
2449/// This intrinsic corresponds to the <c> VUNPCKHPS </c> instruction.
2450///
2451/// \param __a
2452/// A 256-bit vector of [8 x float]. \n
2453/// Bits [95:64] are written to bits [31:0] of the return value. \n
2454/// Bits [127:96] are written to bits [95:64] of the return value. \n
2455/// Bits [223:192] are written to bits [159:128] of the return value. \n
2456/// Bits [255:224] are written to bits [223:192] of the return value.
2457/// \param __b
2458/// A 256-bit vector of [8 x float]. \n
2459/// Bits [95:64] are written to bits [63:32] of the return value. \n
2460/// Bits [127:96] are written to bits [127:96] of the return value. \n
2461/// Bits [223:192] are written to bits [191:160] of the return value. \n
2462/// Bits [255:224] are written to bits [255:224] of the return value.
2463/// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2464static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2465_mm256_unpackhi_ps(__m256 __a, __m256 __b) {
2466 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
2467}
2468
2469/// Unpacks the 32-bit vector elements 0, 1, 4 and 5 from each of the
2470/// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2471/// vector of [8 x float].
2472///
2473/// \headerfile <x86intrin.h>
2474///
2475/// This intrinsic corresponds to the <c> VUNPCKLPS </c> instruction.
2476///
2477/// \param __a
2478/// A 256-bit vector of [8 x float]. \n
2479/// Bits [31:0] are written to bits [31:0] of the return value. \n
2480/// Bits [63:32] are written to bits [95:64] of the return value. \n
2481/// Bits [159:128] are written to bits [159:128] of the return value. \n
2482/// Bits [191:160] are written to bits [223:192] of the return value.
2483/// \param __b
2484/// A 256-bit vector of [8 x float]. \n
2485/// Bits [31:0] are written to bits [63:32] of the return value. \n
2486/// Bits [63:32] are written to bits [127:96] of the return value. \n
2487/// Bits [159:128] are written to bits [191:160] of the return value. \n
2488/// Bits [191:160] are written to bits [255:224] of the return value.
2489/// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2490static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
2491_mm256_unpacklo_ps(__m256 __a, __m256 __b) {
2492 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
2493}
2494
2495/* Bit Test */
2496/// Given two 128-bit floating-point vectors of [2 x double], perform an
2497/// element-by-element comparison of the double-precision element in the
2498/// first source vector and the corresponding element in the second source
2499/// vector.
2500///
2501/// The EFLAGS register is updated as follows: \n
2502/// If there is at least one pair of double-precision elements where the
2503/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2504/// ZF flag is set to 1. \n
2505/// If there is at least one pair of double-precision elements where the
2506/// sign-bit of the first element is 0 and the sign-bit of the second element
2507/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2508/// This intrinsic returns the value of the ZF flag.
2509///
2510/// \headerfile <x86intrin.h>
2511///
2512/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2513///
2514/// \param __a
2515/// A 128-bit vector of [2 x double].
2516/// \param __b
2517/// A 128-bit vector of [2 x double].
2518/// \returns the ZF flag in the EFLAGS register.
2520 __m128d __b) {
2521 return __builtin_ia32_vtestzpd((__v2df)__a, (__v2df)__b);
2522}
2523
2524/// Given two 128-bit floating-point vectors of [2 x double], perform an
2525/// element-by-element comparison of the double-precision element in the
2526/// first source vector and the corresponding element in the second source
2527/// vector.
2528///
2529/// The EFLAGS register is updated as follows: \n
2530/// If there is at least one pair of double-precision elements where the
2531/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2532/// ZF flag is set to 1. \n
2533/// If there is at least one pair of double-precision elements where the
2534/// sign-bit of the first element is 0 and the sign-bit of the second element
2535/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2536/// This intrinsic returns the value of the CF flag.
2537///
2538/// \headerfile <x86intrin.h>
2539///
2540/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2541///
2542/// \param __a
2543/// A 128-bit vector of [2 x double].
2544/// \param __b
2545/// A 128-bit vector of [2 x double].
2546/// \returns the CF flag in the EFLAGS register.
2548 __m128d __b) {
2549 return __builtin_ia32_vtestcpd((__v2df)__a, (__v2df)__b);
2550}
2551
2552/// Given two 128-bit floating-point vectors of [2 x double], perform an
2553/// element-by-element comparison of the double-precision element in the
2554/// first source vector and the corresponding element in the second source
2555/// vector.
2556///
2557/// The EFLAGS register is updated as follows: \n
2558/// If there is at least one pair of double-precision elements where the
2559/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2560/// ZF flag is set to 1. \n
2561/// If there is at least one pair of double-precision elements where the
2562/// sign-bit of the first element is 0 and the sign-bit of the second element
2563/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2564/// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2565/// otherwise it returns 0.
2566///
2567/// \headerfile <x86intrin.h>
2568///
2569/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2570///
2571/// \param __a
2572/// A 128-bit vector of [2 x double].
2573/// \param __b
2574/// A 128-bit vector of [2 x double].
2575/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2576static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR
2577_mm_testnzc_pd(__m128d __a, __m128d __b) {
2578 return __builtin_ia32_vtestnzcpd((__v2df)__a, (__v2df)__b);
2579}
2580
2581/// Given two 128-bit floating-point vectors of [4 x float], perform an
2582/// element-by-element comparison of the single-precision element in the
2583/// first source vector and the corresponding element in the second source
2584/// vector.
2585///
2586/// The EFLAGS register is updated as follows: \n
2587/// If there is at least one pair of single-precision elements where the
2588/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2589/// ZF flag is set to 1. \n
2590/// If there is at least one pair of single-precision elements where the
2591/// sign-bit of the first element is 0 and the sign-bit of the second element
2592/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2593/// This intrinsic returns the value of the ZF flag.
2594///
2595/// \headerfile <x86intrin.h>
2596///
2597/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2598///
2599/// \param __a
2600/// A 128-bit vector of [4 x float].
2601/// \param __b
2602/// A 128-bit vector of [4 x float].
2603/// \returns the ZF flag.
2605 __m128 __b) {
2606 return __builtin_ia32_vtestzps((__v4sf)__a, (__v4sf)__b);
2607}
2608
2609/// Given two 128-bit floating-point vectors of [4 x float], perform an
2610/// element-by-element comparison of the single-precision element in the
2611/// first source vector and the corresponding element in the second source
2612/// vector.
2613///
2614/// The EFLAGS register is updated as follows: \n
2615/// If there is at least one pair of single-precision elements where the
2616/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2617/// ZF flag is set to 1. \n
2618/// If there is at least one pair of single-precision elements where the
2619/// sign-bit of the first element is 0 and the sign-bit of the second element
2620/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2621/// This intrinsic returns the value of the CF flag.
2622///
2623/// \headerfile <x86intrin.h>
2624///
2625/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2626///
2627/// \param __a
2628/// A 128-bit vector of [4 x float].
2629/// \param __b
2630/// A 128-bit vector of [4 x float].
2631/// \returns the CF flag.
2633 __m128 __b) {
2634 return __builtin_ia32_vtestcps((__v4sf)__a, (__v4sf)__b);
2635}
2636
2637/// Given two 128-bit floating-point vectors of [4 x float], perform an
2638/// element-by-element comparison of the single-precision element in the
2639/// first source vector and the corresponding element in the second source
2640/// vector.
2641///
2642/// The EFLAGS register is updated as follows: \n
2643/// If there is at least one pair of single-precision elements where the
2644/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2645/// ZF flag is set to 1. \n
2646/// If there is at least one pair of single-precision elements where the
2647/// sign-bit of the first element is 0 and the sign-bit of the second element
2648/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2649/// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2650/// otherwise it returns 0.
2651///
2652/// \headerfile <x86intrin.h>
2653///
2654/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2655///
2656/// \param __a
2657/// A 128-bit vector of [4 x float].
2658/// \param __b
2659/// A 128-bit vector of [4 x float].
2660/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2662 __m128 __b) {
2663 return __builtin_ia32_vtestnzcps((__v4sf)__a, (__v4sf)__b);
2664}
2665
2666/// Given two 256-bit floating-point vectors of [4 x double], perform an
2667/// element-by-element comparison of the double-precision elements in the
2668/// first source vector and the corresponding elements in the second source
2669/// vector.
2670///
2671/// The EFLAGS register is updated as follows: \n
2672/// If there is at least one pair of double-precision elements where the
2673/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2674/// ZF flag is set to 1. \n
2675/// If there is at least one pair of double-precision elements where the
2676/// sign-bit of the first element is 0 and the sign-bit of the second element
2677/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2678/// This intrinsic returns the value of the ZF flag.
2679///
2680/// \headerfile <x86intrin.h>
2681///
2682/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2683///
2684/// \param __a
2685/// A 256-bit vector of [4 x double].
2686/// \param __b
2687/// A 256-bit vector of [4 x double].
2688/// \returns the ZF flag.
2690 __m256d __b) {
2691 return __builtin_ia32_vtestzpd256((__v4df)__a, (__v4df)__b);
2692}
2693
2694/// Given two 256-bit floating-point vectors of [4 x double], perform an
2695/// element-by-element comparison of the double-precision elements in the
2696/// first source vector and the corresponding elements in the second source
2697/// vector.
2698///
2699/// The EFLAGS register is updated as follows: \n
2700/// If there is at least one pair of double-precision elements where the
2701/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2702/// ZF flag is set to 1. \n
2703/// If there is at least one pair of double-precision elements where the
2704/// sign-bit of the first element is 0 and the sign-bit of the second element
2705/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2706/// This intrinsic returns the value of the CF flag.
2707///
2708/// \headerfile <x86intrin.h>
2709///
2710/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2711///
2712/// \param __a
2713/// A 256-bit vector of [4 x double].
2714/// \param __b
2715/// A 256-bit vector of [4 x double].
2716/// \returns the CF flag.
2718 __m256d __b) {
2719 return __builtin_ia32_vtestcpd256((__v4df)__a, (__v4df)__b);
2720}
2721
2722/// Given two 256-bit floating-point vectors of [4 x double], perform an
2723/// element-by-element comparison of the double-precision elements in the
2724/// first source vector and the corresponding elements in the second source
2725/// vector.
2726///
2727/// The EFLAGS register is updated as follows: \n
2728/// If there is at least one pair of double-precision elements where the
2729/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2730/// ZF flag is set to 1. \n
2731/// If there is at least one pair of double-precision elements where the
2732/// sign-bit of the first element is 0 and the sign-bit of the second element
2733/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2734/// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2735/// otherwise it returns 0.
2736///
2737/// \headerfile <x86intrin.h>
2738///
2739/// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2740///
2741/// \param __a
2742/// A 256-bit vector of [4 x double].
2743/// \param __b
2744/// A 256-bit vector of [4 x double].
2745/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2746static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2747_mm256_testnzc_pd(__m256d __a, __m256d __b) {
2748 return __builtin_ia32_vtestnzcpd256((__v4df)__a, (__v4df)__b);
2749}
2750
2751/// Given two 256-bit floating-point vectors of [8 x float], perform an
2752/// element-by-element comparison of the single-precision element in the
2753/// first source vector and the corresponding element in the second source
2754/// vector.
2755///
2756/// The EFLAGS register is updated as follows: \n
2757/// If there is at least one pair of single-precision elements where the
2758/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2759/// ZF flag is set to 1. \n
2760/// If there is at least one pair of single-precision elements where the
2761/// sign-bit of the first element is 0 and the sign-bit of the second element
2762/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2763/// This intrinsic returns the value of the ZF flag.
2764///
2765/// \headerfile <x86intrin.h>
2766///
2767/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2768///
2769/// \param __a
2770/// A 256-bit vector of [8 x float].
2771/// \param __b
2772/// A 256-bit vector of [8 x float].
2773/// \returns the ZF flag.
2775 __m256 __b) {
2776 return __builtin_ia32_vtestzps256((__v8sf)__a, (__v8sf)__b);
2777}
2778
2779/// Given two 256-bit floating-point vectors of [8 x float], perform an
2780/// element-by-element comparison of the single-precision element in the
2781/// first source vector and the corresponding element in the second source
2782/// vector.
2783///
2784/// The EFLAGS register is updated as follows: \n
2785/// If there is at least one pair of single-precision elements where the
2786/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2787/// ZF flag is set to 1. \n
2788/// If there is at least one pair of single-precision elements where the
2789/// sign-bit of the first element is 0 and the sign-bit of the second element
2790/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2791/// This intrinsic returns the value of the CF flag.
2792///
2793/// \headerfile <x86intrin.h>
2794///
2795/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2796///
2797/// \param __a
2798/// A 256-bit vector of [8 x float].
2799/// \param __b
2800/// A 256-bit vector of [8 x float].
2801/// \returns the CF flag.
2803 __m256 __b) {
2804 return __builtin_ia32_vtestcps256((__v8sf)__a, (__v8sf)__b);
2805}
2806
2807/// Given two 256-bit floating-point vectors of [8 x float], perform an
2808/// element-by-element comparison of the single-precision elements in the
2809/// first source vector and the corresponding elements in the second source
2810/// vector.
2811///
2812/// The EFLAGS register is updated as follows: \n
2813/// If there is at least one pair of single-precision elements where the
2814/// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2815/// ZF flag is set to 1. \n
2816/// If there is at least one pair of single-precision elements where the
2817/// sign-bit of the first element is 0 and the sign-bit of the second element
2818/// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2819/// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2820/// otherwise it returns 0.
2821///
2822/// \headerfile <x86intrin.h>
2823///
2824/// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2825///
2826/// \param __a
2827/// A 256-bit vector of [8 x float].
2828/// \param __b
2829/// A 256-bit vector of [8 x float].
2830/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2832 __m256 __b) {
2833 return __builtin_ia32_vtestnzcps256((__v8sf)__a, (__v8sf)__b);
2834}
2835
2836/// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2837/// of the two source vectors.
2838///
2839/// The EFLAGS register is updated as follows: \n
2840/// If there is at least one pair of bits where both bits are 1, the ZF flag
2841/// is set to 0. Otherwise the ZF flag is set to 1. \n
2842/// If there is at least one pair of bits where the bit from the first source
2843/// vector is 0 and the bit from the second source vector is 1, the CF flag
2844/// is set to 0. Otherwise the CF flag is set to 1. \n
2845/// This intrinsic returns the value of the ZF flag.
2846///
2847/// \headerfile <x86intrin.h>
2848///
2849/// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2850///
2851/// \param __a
2852/// A 256-bit integer vector.
2853/// \param __b
2854/// A 256-bit integer vector.
2855/// \returns the ZF flag.
2856static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2857_mm256_testz_si256(__m256i __a, __m256i __b) {
2858 return __builtin_ia32_ptestz256((__v4di)__a, (__v4di)__b);
2859}
2860
2861/// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2862/// of the two source vectors.
2863///
2864/// The EFLAGS register is updated as follows: \n
2865/// If there is at least one pair of bits where both bits are 1, the ZF flag
2866/// is set to 0. Otherwise the ZF flag is set to 1. \n
2867/// If there is at least one pair of bits where the bit from the first source
2868/// vector is 0 and the bit from the second source vector is 1, the CF flag
2869/// is set to 0. Otherwise the CF flag is set to 1. \n
2870/// This intrinsic returns the value of the CF flag.
2871///
2872/// \headerfile <x86intrin.h>
2873///
2874/// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2875///
2876/// \param __a
2877/// A 256-bit integer vector.
2878/// \param __b
2879/// A 256-bit integer vector.
2880/// \returns the CF flag.
2881static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2882_mm256_testc_si256(__m256i __a, __m256i __b) {
2883 return __builtin_ia32_ptestc256((__v4di)__a, (__v4di)__b);
2884}
2885
2886/// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2887/// of the two source vectors.
2888///
2889/// The EFLAGS register is updated as follows: \n
2890/// If there is at least one pair of bits where both bits are 1, the ZF flag
2891/// is set to 0. Otherwise the ZF flag is set to 1. \n
2892/// If there is at least one pair of bits where the bit from the first source
2893/// vector is 0 and the bit from the second source vector is 1, the CF flag
2894/// is set to 0. Otherwise the CF flag is set to 1. \n
2895/// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2896/// otherwise it returns 0.
2897///
2898/// \headerfile <x86intrin.h>
2899///
2900/// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2901///
2902/// \param __a
2903/// A 256-bit integer vector.
2904/// \param __b
2905/// A 256-bit integer vector.
2906/// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2907static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2908_mm256_testnzc_si256(__m256i __a, __m256i __b) {
2909 return __builtin_ia32_ptestnzc256((__v4di)__a, (__v4di)__b);
2910}
2911
2912/* Vector extract sign mask */
2913/// Extracts the sign bits of double-precision floating point elements
2914/// in a 256-bit vector of [4 x double] and writes them to the lower order
2915/// bits of the return value.
2916///
2917/// \headerfile <x86intrin.h>
2918///
2919/// This intrinsic corresponds to the <c> VMOVMSKPD </c> instruction.
2920///
2921/// \param __a
2922/// A 256-bit vector of [4 x double] containing the double-precision
2923/// floating point values with sign bits to be extracted.
2924/// \returns The sign bits from the operand, written to bits [3:0].
2925static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2927 return __builtin_ia32_movmskpd256((__v4df)__a);
2928}
2929
2930/// Extracts the sign bits of single-precision floating point elements
2931/// in a 256-bit vector of [8 x float] and writes them to the lower order
2932/// bits of the return value.
2933///
2934/// \headerfile <x86intrin.h>
2935///
2936/// This intrinsic corresponds to the <c> VMOVMSKPS </c> instruction.
2937///
2938/// \param __a
2939/// A 256-bit vector of [8 x float] containing the single-precision floating
2940/// point values with sign bits to be extracted.
2941/// \returns The sign bits from the operand, written to bits [7:0].
2942static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR
2944 return __builtin_ia32_movmskps256((__v8sf)__a);
2945}
2946
2947/* Vector __zero */
2948/// Zeroes the contents of all XMM or YMM registers.
2949///
2950/// \headerfile <x86intrin.h>
2951///
2952/// This intrinsic corresponds to the <c> VZEROALL </c> instruction.
2953static __inline void __attribute__((__always_inline__, __nodebug__, __target__("avx")))
2954_mm256_zeroall(void)
2955{
2956 __builtin_ia32_vzeroall();
2957}
2958
2959/// Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
2960///
2961/// \headerfile <x86intrin.h>
2962///
2963/// This intrinsic corresponds to the <c> VZEROUPPER </c> instruction.
2964static __inline void __attribute__((__always_inline__, __nodebug__, __target__("avx")))
2965_mm256_zeroupper(void)
2966{
2967 __builtin_ia32_vzeroupper();
2968}
2969
2970/* Vector load with broadcast */
2971/// Loads a scalar single-precision floating point value from the
2972/// specified address pointed to by \a __a and broadcasts it to the elements
2973/// of a [4 x float] vector.
2974///
2975/// \headerfile <x86intrin.h>
2976///
2977/// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
2978///
2979/// \param __a
2980/// The single-precision floating point value to be broadcast.
2981/// \returns A 128-bit vector of [4 x float] whose 32-bit elements are set
2982/// equal to the broadcast value.
2983static __inline __m128 __DEFAULT_FN_ATTRS128
2985{
2986 struct __mm_broadcast_ss_struct {
2987 float __f;
2988 } __attribute__((__packed__, __may_alias__));
2989 float __f = ((const struct __mm_broadcast_ss_struct*)__a)->__f;
2990 return __extension__ (__m128){ __f, __f, __f, __f };
2991}
2992
2993/// Loads a scalar double-precision floating point value from the
2994/// specified address pointed to by \a __a and broadcasts it to the elements
2995/// of a [4 x double] vector.
2996///
2997/// \headerfile <x86intrin.h>
2998///
2999/// This intrinsic corresponds to the <c> VBROADCASTSD </c> instruction.
3000///
3001/// \param __a
3002/// The double-precision floating point value to be broadcast.
3003/// \returns A 256-bit vector of [4 x double] whose 64-bit elements are set
3004/// equal to the broadcast value.
3005static __inline __m256d __DEFAULT_FN_ATTRS
3007{
3008 struct __mm256_broadcast_sd_struct {
3009 double __d;
3010 } __attribute__((__packed__, __may_alias__));
3011 double __d = ((const struct __mm256_broadcast_sd_struct*)__a)->__d;
3012 return __extension__ (__m256d)(__v4df){ __d, __d, __d, __d };
3013}
3014
3015/// Loads a scalar single-precision floating point value from the
3016/// specified address pointed to by \a __a and broadcasts it to the elements
3017/// of a [8 x float] vector.
3018///
3019/// \headerfile <x86intrin.h>
3020///
3021/// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
3022///
3023/// \param __a
3024/// The single-precision floating point value to be broadcast.
3025/// \returns A 256-bit vector of [8 x float] whose 32-bit elements are set
3026/// equal to the broadcast value.
3027static __inline __m256 __DEFAULT_FN_ATTRS
3029{
3030 struct __mm256_broadcast_ss_struct {
3031 float __f;
3032 } __attribute__((__packed__, __may_alias__));
3033 float __f = ((const struct __mm256_broadcast_ss_struct*)__a)->__f;
3034 return __extension__ (__m256)(__v8sf){ __f, __f, __f, __f, __f, __f, __f, __f };
3035}
3036
3037/// Loads the data from a 128-bit vector of [2 x double] from the
3038/// specified address pointed to by \a __a and broadcasts it to 128-bit
3039/// elements in a 256-bit vector of [4 x double].
3040///
3041/// \headerfile <x86intrin.h>
3042///
3043/// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3044///
3045/// \param __a
3046/// The 128-bit vector of [2 x double] to be broadcast.
3047/// \returns A 256-bit vector of [4 x double] whose 128-bit elements are set
3048/// equal to the broadcast value.
3049static __inline __m256d __DEFAULT_FN_ATTRS
3051{
3052 __m128d __b = _mm_loadu_pd((const double *)__a);
3053 return (__m256d)__builtin_shufflevector((__v2df)__b, (__v2df)__b,
3054 0, 1, 0, 1);
3055}
3056
3057/// Loads the data from a 128-bit vector of [4 x float] from the
3058/// specified address pointed to by \a __a and broadcasts it to 128-bit
3059/// elements in a 256-bit vector of [8 x float].
3060///
3061/// \headerfile <x86intrin.h>
3062///
3063/// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3064///
3065/// \param __a
3066/// The 128-bit vector of [4 x float] to be broadcast.
3067/// \returns A 256-bit vector of [8 x float] whose 128-bit elements are set
3068/// equal to the broadcast value.
3069static __inline __m256 __DEFAULT_FN_ATTRS
3071{
3072 __m128 __b = _mm_loadu_ps((const float *)__a);
3073 return (__m256)__builtin_shufflevector((__v4sf)__b, (__v4sf)__b,
3074 0, 1, 2, 3, 0, 1, 2, 3);
3075}
3076
3077/* SIMD load ops */
3078/// Loads 4 double-precision floating point values from a 32-byte aligned
3079/// memory location pointed to by \a __p into a vector of [4 x double].
3080///
3081/// \headerfile <x86intrin.h>
3082///
3083/// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3084///
3085/// \param __p
3086/// A 32-byte aligned pointer to a memory location containing
3087/// double-precision floating point values.
3088/// \returns A 256-bit vector of [4 x double] containing the moved values.
3089static __inline __m256d __DEFAULT_FN_ATTRS
3090_mm256_load_pd(double const *__p)
3091{
3092 return *(const __m256d *)__p;
3093}
3094
3095/// Loads 8 single-precision floating point values from a 32-byte aligned
3096/// memory location pointed to by \a __p into a vector of [8 x float].
3097///
3098/// \headerfile <x86intrin.h>
3099///
3100/// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3101///
3102/// \param __p
3103/// A 32-byte aligned pointer to a memory location containing float values.
3104/// \returns A 256-bit vector of [8 x float] containing the moved values.
3105static __inline __m256 __DEFAULT_FN_ATTRS
3106_mm256_load_ps(float const *__p)
3107{
3108 return *(const __m256 *)__p;
3109}
3110
3111/// Loads 4 double-precision floating point values from an unaligned
3112/// memory location pointed to by \a __p into a vector of [4 x double].
3113///
3114/// \headerfile <x86intrin.h>
3115///
3116/// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3117///
3118/// \param __p
3119/// A pointer to a memory location containing double-precision floating
3120/// point values.
3121/// \returns A 256-bit vector of [4 x double] containing the moved values.
3122static __inline __m256d __DEFAULT_FN_ATTRS
3123_mm256_loadu_pd(double const *__p)
3124{
3125 struct __loadu_pd {
3126 __m256d_u __v;
3127 } __attribute__((__packed__, __may_alias__));
3128 return ((const struct __loadu_pd*)__p)->__v;
3129}
3130
3131/// Loads 8 single-precision floating point values from an unaligned
3132/// memory location pointed to by \a __p into a vector of [8 x float].
3133///
3134/// \headerfile <x86intrin.h>
3135///
3136/// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3137///
3138/// \param __p
3139/// A pointer to a memory location containing single-precision floating
3140/// point values.
3141/// \returns A 256-bit vector of [8 x float] containing the moved values.
3142static __inline __m256 __DEFAULT_FN_ATTRS
3144{
3145 struct __loadu_ps {
3146 __m256_u __v;
3147 } __attribute__((__packed__, __may_alias__));
3148 return ((const struct __loadu_ps*)__p)->__v;
3149}
3150
3151/// Loads 256 bits of integer data from a 32-byte aligned memory
3152/// location pointed to by \a __p into elements of a 256-bit integer vector.
3153///
3154/// \headerfile <x86intrin.h>
3155///
3156/// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3157///
3158/// \param __p
3159/// A 32-byte aligned pointer to a 256-bit integer vector containing integer
3160/// values.
3161/// \returns A 256-bit integer vector containing the moved values.
3162static __inline __m256i __DEFAULT_FN_ATTRS
3163_mm256_load_si256(__m256i const *__p)
3164{
3165 return *__p;
3166}
3167
3168/// Loads 256 bits of integer data from an unaligned memory location
3169/// pointed to by \a __p into a 256-bit integer vector.
3170///
3171/// \headerfile <x86intrin.h>
3172///
3173/// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3174///
3175/// \param __p
3176/// A pointer to a 256-bit integer vector containing integer values.
3177/// \returns A 256-bit integer vector containing the moved values.
3178static __inline __m256i __DEFAULT_FN_ATTRS
3179_mm256_loadu_si256(__m256i_u const *__p)
3180{
3181 struct __loadu_si256 {
3182 __m256i_u __v;
3183 } __attribute__((__packed__, __may_alias__));
3184 return ((const struct __loadu_si256*)__p)->__v;
3185}
3186
3187/// Loads 256 bits of integer data from an unaligned memory location
3188/// pointed to by \a __p into a 256-bit integer vector. This intrinsic may
3189/// perform better than \c _mm256_loadu_si256 when the data crosses a cache
3190/// line boundary.
3191///
3192/// \headerfile <x86intrin.h>
3193///
3194/// This intrinsic corresponds to the <c> VLDDQU </c> instruction.
3195///
3196/// \param __p
3197/// A pointer to a 256-bit integer vector containing integer values.
3198/// \returns A 256-bit integer vector containing the moved values.
3199static __inline __m256i __DEFAULT_FN_ATTRS
3200_mm256_lddqu_si256(__m256i_u const *__p)
3201{
3202 return (__m256i)__builtin_ia32_lddqu256((char const *)__p);
3203}
3204
3205/* SIMD store ops */
3206/// Stores double-precision floating point values from a 256-bit vector
3207/// of [4 x double] to a 32-byte aligned memory location pointed to by
3208/// \a __p.
3209///
3210/// \headerfile <x86intrin.h>
3211///
3212/// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3213///
3214/// \param __p
3215/// A 32-byte aligned pointer to a memory location that will receive the
3216/// double-precision floaing point values.
3217/// \param __a
3218/// A 256-bit vector of [4 x double] containing the values to be moved.
3219static __inline void __DEFAULT_FN_ATTRS
3220_mm256_store_pd(double *__p, __m256d __a)
3221{
3222 *(__m256d *)__p = __a;
3223}
3224
3225/// Stores single-precision floating point values from a 256-bit vector
3226/// of [8 x float] to a 32-byte aligned memory location pointed to by \a __p.
3227///
3228/// \headerfile <x86intrin.h>
3229///
3230/// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3231///
3232/// \param __p
3233/// A 32-byte aligned pointer to a memory location that will receive the
3234/// float values.
3235/// \param __a
3236/// A 256-bit vector of [8 x float] containing the values to be moved.
3237static __inline void __DEFAULT_FN_ATTRS
3238_mm256_store_ps(float *__p, __m256 __a)
3239{
3240 *(__m256 *)__p = __a;
3241}
3242
3243/// Stores double-precision floating point values from a 256-bit vector
3244/// of [4 x double] to an unaligned memory location pointed to by \a __p.
3245///
3246/// \headerfile <x86intrin.h>
3247///
3248/// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3249///
3250/// \param __p
3251/// A pointer to a memory location that will receive the double-precision
3252/// floating point values.
3253/// \param __a
3254/// A 256-bit vector of [4 x double] containing the values to be moved.
3255static __inline void __DEFAULT_FN_ATTRS
3256_mm256_storeu_pd(double *__p, __m256d __a)
3257{
3258 struct __storeu_pd {
3259 __m256d_u __v;
3260 } __attribute__((__packed__, __may_alias__));
3261 ((struct __storeu_pd*)__p)->__v = __a;
3262}
3263
3264/// Stores single-precision floating point values from a 256-bit vector
3265/// of [8 x float] to an unaligned memory location pointed to by \a __p.
3266///
3267/// \headerfile <x86intrin.h>
3268///
3269/// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3270///
3271/// \param __p
3272/// A pointer to a memory location that will receive the float values.
3273/// \param __a
3274/// A 256-bit vector of [8 x float] containing the values to be moved.
3275static __inline void __DEFAULT_FN_ATTRS
3276_mm256_storeu_ps(float *__p, __m256 __a)
3277{
3278 struct __storeu_ps {
3279 __m256_u __v;
3280 } __attribute__((__packed__, __may_alias__));
3281 ((struct __storeu_ps*)__p)->__v = __a;
3282}
3283
3284/// Stores integer values from a 256-bit integer vector to a 32-byte
3285/// aligned memory location pointed to by \a __p.
3286///
3287/// \headerfile <x86intrin.h>
3288///
3289/// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3290///
3291/// \param __p
3292/// A 32-byte aligned pointer to a memory location that will receive the
3293/// integer values.
3294/// \param __a
3295/// A 256-bit integer vector containing the values to be moved.
3296static __inline void __DEFAULT_FN_ATTRS
3297_mm256_store_si256(__m256i *__p, __m256i __a)
3298{
3299 *__p = __a;
3300}
3301
3302/// Stores integer values from a 256-bit integer vector to an unaligned
3303/// memory location pointed to by \a __p.
3304///
3305/// \headerfile <x86intrin.h>
3306///
3307/// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3308///
3309/// \param __p
3310/// A pointer to a memory location that will receive the integer values.
3311/// \param __a
3312/// A 256-bit integer vector containing the values to be moved.
3313static __inline void __DEFAULT_FN_ATTRS
3314_mm256_storeu_si256(__m256i_u *__p, __m256i __a)
3315{
3316 struct __storeu_si256 {
3317 __m256i_u __v;
3318 } __attribute__((__packed__, __may_alias__));
3319 ((struct __storeu_si256*)__p)->__v = __a;
3320}
3321
3322/* Conditional load ops */
3323/// Conditionally loads double-precision floating point elements from a
3324/// memory location pointed to by \a __p into a 128-bit vector of
3325/// [2 x double], depending on the mask bits associated with each data
3326/// element.
3327///
3328/// \headerfile <x86intrin.h>
3329///
3330/// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3331///
3332/// \param __p
3333/// A pointer to a memory location that contains the double-precision
3334/// floating point values.
3335/// \param __m
3336/// A 128-bit integer vector containing the mask. The most significant bit of
3337/// each data element represents the mask bits. If a mask bit is zero, the
3338/// corresponding value in the memory location is not loaded and the
3339/// corresponding field in the return value is set to zero.
3340/// \returns A 128-bit vector of [2 x double] containing the loaded values.
3341static __inline __m128d __DEFAULT_FN_ATTRS128
3342_mm_maskload_pd(double const *__p, __m128i __m)
3343{
3344 return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2di)__m);
3345}
3346
3347/// Conditionally loads double-precision floating point elements from a
3348/// memory location pointed to by \a __p into a 256-bit vector of
3349/// [4 x double], depending on the mask bits associated with each data
3350/// element.
3351///
3352/// \headerfile <x86intrin.h>
3353///
3354/// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3355///
3356/// \param __p
3357/// A pointer to a memory location that contains the double-precision
3358/// floating point values.
3359/// \param __m
3360/// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3361/// significant bit of each quadword element represents the mask bits. If a
3362/// mask bit is zero, the corresponding value in the memory location is not
3363/// loaded and the corresponding field in the return value is set to zero.
3364/// \returns A 256-bit vector of [4 x double] containing the loaded values.
3365static __inline __m256d __DEFAULT_FN_ATTRS
3366_mm256_maskload_pd(double const *__p, __m256i __m)
3367{
3368 return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)__p,
3369 (__v4di)__m);
3370}
3371
3372/// Conditionally loads single-precision floating point elements from a
3373/// memory location pointed to by \a __p into a 128-bit vector of
3374/// [4 x float], depending on the mask bits associated with each data
3375/// element.
3376///
3377/// \headerfile <x86intrin.h>
3378///
3379/// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3380///
3381/// \param __p
3382/// A pointer to a memory location that contains the single-precision
3383/// floating point values.
3384/// \param __m
3385/// A 128-bit integer vector containing the mask. The most significant bit of
3386/// each data element represents the mask bits. If a mask bit is zero, the
3387/// corresponding value in the memory location is not loaded and the
3388/// corresponding field in the return value is set to zero.
3389/// \returns A 128-bit vector of [4 x float] containing the loaded values.
3390static __inline __m128 __DEFAULT_FN_ATTRS128
3391_mm_maskload_ps(float const *__p, __m128i __m)
3392{
3393 return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4si)__m);
3394}
3395
3396/// Conditionally loads single-precision floating point elements from a
3397/// memory location pointed to by \a __p into a 256-bit vector of
3398/// [8 x float], depending on the mask bits associated with each data
3399/// element.
3400///
3401/// \headerfile <x86intrin.h>
3402///
3403/// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3404///
3405/// \param __p
3406/// A pointer to a memory location that contains the single-precision
3407/// floating point values.
3408/// \param __m
3409/// A 256-bit integer vector of [8 x dword] containing the mask. The most
3410/// significant bit of each dword element represents the mask bits. If a mask
3411/// bit is zero, the corresponding value in the memory location is not loaded
3412/// and the corresponding field in the return value is set to zero.
3413/// \returns A 256-bit vector of [8 x float] containing the loaded values.
3414static __inline __m256 __DEFAULT_FN_ATTRS
3415_mm256_maskload_ps(float const *__p, __m256i __m)
3416{
3417 return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8si)__m);
3418}
3419
3420/* Conditional store ops */
3421/// Moves single-precision floating point values from a 256-bit vector
3422/// of [8 x float] to a memory location pointed to by \a __p, according to
3423/// the specified mask.
3424///
3425/// \headerfile <x86intrin.h>
3426///
3427/// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3428///
3429/// \param __p
3430/// A pointer to a memory location that will receive the float values.
3431/// \param __m
3432/// A 256-bit integer vector of [8 x dword] containing the mask. The most
3433/// significant bit of each dword element in the mask vector represents the
3434/// mask bits. If a mask bit is zero, the corresponding value from vector
3435/// \a __a is not stored and the corresponding field in the memory location
3436/// pointed to by \a __p is not changed.
3437/// \param __a
3438/// A 256-bit vector of [8 x float] containing the values to be stored.
3439static __inline void __DEFAULT_FN_ATTRS
3440_mm256_maskstore_ps(float *__p, __m256i __m, __m256 __a)
3441{
3442 __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8si)__m, (__v8sf)__a);
3443}
3444
3445/// Moves double-precision values from a 128-bit vector of [2 x double]
3446/// to a memory location pointed to by \a __p, according to the specified
3447/// mask.
3448///
3449/// \headerfile <x86intrin.h>
3450///
3451/// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3452///
3453/// \param __p
3454/// A pointer to a memory location that will receive the float values.
3455/// \param __m
3456/// A 128-bit integer vector containing the mask. The most significant bit of
3457/// each field in the mask vector represents the mask bits. If a mask bit is
3458/// zero, the corresponding value from vector \a __a is not stored and the
3459/// corresponding field in the memory location pointed to by \a __p is not
3460/// changed.
3461/// \param __a
3462/// A 128-bit vector of [2 x double] containing the values to be stored.
3463static __inline void __DEFAULT_FN_ATTRS128
3464_mm_maskstore_pd(double *__p, __m128i __m, __m128d __a)
3465{
3466 __builtin_ia32_maskstorepd((__v2df *)__p, (__v2di)__m, (__v2df)__a);
3467}
3468
3469/// Moves double-precision values from a 256-bit vector of [4 x double]
3470/// to a memory location pointed to by \a __p, according to the specified
3471/// mask.
3472///
3473/// \headerfile <x86intrin.h>
3474///
3475/// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3476///
3477/// \param __p
3478/// A pointer to a memory location that will receive the float values.
3479/// \param __m
3480/// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3481/// significant bit of each quadword element in the mask vector represents
3482/// the mask bits. If a mask bit is zero, the corresponding value from vector
3483/// __a is not stored and the corresponding field in the memory location
3484/// pointed to by \a __p is not changed.
3485/// \param __a
3486/// A 256-bit vector of [4 x double] containing the values to be stored.
3487static __inline void __DEFAULT_FN_ATTRS
3488_mm256_maskstore_pd(double *__p, __m256i __m, __m256d __a)
3489{
3490 __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4di)__m, (__v4df)__a);
3491}
3492
3493/// Moves single-precision floating point values from a 128-bit vector
3494/// of [4 x float] to a memory location pointed to by \a __p, according to
3495/// the specified mask.
3496///
3497/// \headerfile <x86intrin.h>
3498///
3499/// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3500///
3501/// \param __p
3502/// A pointer to a memory location that will receive the float values.
3503/// \param __m
3504/// A 128-bit integer vector containing the mask. The most significant bit of
3505/// each field in the mask vector represents the mask bits. If a mask bit is
3506/// zero, the corresponding value from vector __a is not stored and the
3507/// corresponding field in the memory location pointed to by \a __p is not
3508/// changed.
3509/// \param __a
3510/// A 128-bit vector of [4 x float] containing the values to be stored.
3511static __inline void __DEFAULT_FN_ATTRS128
3512_mm_maskstore_ps(float *__p, __m128i __m, __m128 __a)
3513{
3514 __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4si)__m, (__v4sf)__a);
3515}
3516
3517/* Cacheability support ops */
3518/// Moves integer data from a 256-bit integer vector to a 32-byte
3519/// aligned memory location. To minimize caching, the data is flagged as
3520/// non-temporal (unlikely to be used again soon).
3521///
3522/// \headerfile <x86intrin.h>
3523///
3524/// This intrinsic corresponds to the <c> VMOVNTDQ </c> instruction.
3525///
3526/// \param __a
3527/// A pointer to a 32-byte aligned memory location that will receive the
3528/// integer values.
3529/// \param __b
3530/// A 256-bit integer vector containing the values to be moved.
3531static __inline void __DEFAULT_FN_ATTRS
3533{
3534 typedef __v4di __v4di_aligned __attribute__((aligned(32)));
3535 __builtin_nontemporal_store((__v4di_aligned)__b, (__v4di_aligned*)__a);
3536}
3537
3538/// Moves double-precision values from a 256-bit vector of [4 x double]
3539/// to a 32-byte aligned memory location. To minimize caching, the data is
3540/// flagged as non-temporal (unlikely to be used again soon).
3541///
3542/// \headerfile <x86intrin.h>
3543///
3544/// This intrinsic corresponds to the <c> VMOVNTPD </c> instruction.
3545///
3546/// \param __a
3547/// A pointer to a 32-byte aligned memory location that will receive the
3548/// double-precision floating-point values.
3549/// \param __b
3550/// A 256-bit vector of [4 x double] containing the values to be moved.
3551static __inline void __DEFAULT_FN_ATTRS
3552_mm256_stream_pd(void *__a, __m256d __b)
3553{
3554 typedef __v4df __v4df_aligned __attribute__((aligned(32)));
3555 __builtin_nontemporal_store((__v4df_aligned)__b, (__v4df_aligned*)__a);
3556}
3557
3558/// Moves single-precision floating point values from a 256-bit vector
3559/// of [8 x float] to a 32-byte aligned memory location. To minimize
3560/// caching, the data is flagged as non-temporal (unlikely to be used again
3561/// soon).
3562///
3563/// \headerfile <x86intrin.h>
3564///
3565/// This intrinsic corresponds to the <c> VMOVNTPS </c> instruction.
3566///
3567/// \param __p
3568/// A pointer to a 32-byte aligned memory location that will receive the
3569/// single-precision floating point values.
3570/// \param __a
3571/// A 256-bit vector of [8 x float] containing the values to be moved.
3572static __inline void __DEFAULT_FN_ATTRS
3574{
3575 typedef __v8sf __v8sf_aligned __attribute__((aligned(32)));
3576 __builtin_nontemporal_store((__v8sf_aligned)__a, (__v8sf_aligned*)__p);
3577}
3578
3579/* Create vectors */
3580/// Create a 256-bit vector of [4 x double] with undefined values.
3581///
3582/// \headerfile <x86intrin.h>
3583///
3584/// This intrinsic has no corresponding instruction.
3585///
3586/// \returns A 256-bit vector of [4 x double] containing undefined values.
3587static __inline__ __m256d __DEFAULT_FN_ATTRS
3589{
3590 return (__m256d)__builtin_ia32_undef256();
3591}
3592
3593/// Create a 256-bit vector of [8 x float] with undefined values.
3594///
3595/// \headerfile <x86intrin.h>
3596///
3597/// This intrinsic has no corresponding instruction.
3598///
3599/// \returns A 256-bit vector of [8 x float] containing undefined values.
3600static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_undefined_ps(void) {
3601 return (__m256)__builtin_ia32_undef256();
3602}
3603
3604/// Create a 256-bit integer vector with undefined values.
3605///
3606/// \headerfile <x86intrin.h>
3607///
3608/// This intrinsic has no corresponding instruction.
3609///
3610/// \returns A 256-bit integer vector containing undefined values.
3611static __inline__ __m256i __DEFAULT_FN_ATTRS
3613{
3614 return (__m256i)__builtin_ia32_undef256();
3615}
3616
3617/// Constructs a 256-bit floating-point vector of [4 x double]
3618/// initialized with the specified double-precision floating-point values.
3619///
3620/// \headerfile <x86intrin.h>
3621///
3622/// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3623/// instruction.
3624///
3625/// \param __a
3626/// A double-precision floating-point value used to initialize bits [255:192]
3627/// of the result.
3628/// \param __b
3629/// A double-precision floating-point value used to initialize bits [191:128]
3630/// of the result.
3631/// \param __c
3632/// A double-precision floating-point value used to initialize bits [127:64]
3633/// of the result.
3634/// \param __d
3635/// A double-precision floating-point value used to initialize bits [63:0]
3636/// of the result.
3637/// \returns An initialized 256-bit floating-point vector of [4 x double].
3638static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
3639_mm256_set_pd(double __a, double __b, double __c, double __d)
3640{
3641 return __extension__ (__m256d){ __d, __c, __b, __a };
3642}
3643
3644/// Constructs a 256-bit floating-point vector of [8 x float] initialized
3645/// with the specified single-precision floating-point values.
3646///
3647/// \headerfile <x86intrin.h>
3648///
3649/// This intrinsic is a utility function and does not correspond to a specific
3650/// instruction.
3651///
3652/// \param __a
3653/// A single-precision floating-point value used to initialize bits [255:224]
3654/// of the result.
3655/// \param __b
3656/// A single-precision floating-point value used to initialize bits [223:192]
3657/// of the result.
3658/// \param __c
3659/// A single-precision floating-point value used to initialize bits [191:160]
3660/// of the result.
3661/// \param __d
3662/// A single-precision floating-point value used to initialize bits [159:128]
3663/// of the result.
3664/// \param __e
3665/// A single-precision floating-point value used to initialize bits [127:96]
3666/// of the result.
3667/// \param __f
3668/// A single-precision floating-point value used to initialize bits [95:64]
3669/// of the result.
3670/// \param __g
3671/// A single-precision floating-point value used to initialize bits [63:32]
3672/// of the result.
3673/// \param __h
3674/// A single-precision floating-point value used to initialize bits [31:0]
3675/// of the result.
3676/// \returns An initialized 256-bit floating-point vector of [8 x float].
3677static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
3678_mm256_set_ps(float __a, float __b, float __c, float __d,
3679 float __e, float __f, float __g, float __h)
3680{
3681 return __extension__ (__m256){ __h, __g, __f, __e, __d, __c, __b, __a };
3682}
3683
3684/// Constructs a 256-bit integer vector initialized with the specified
3685/// 32-bit integral values.
3686///
3687/// \headerfile <x86intrin.h>
3688///
3689/// This intrinsic is a utility function and does not correspond to a specific
3690/// instruction.
3691///
3692/// \param __i0
3693/// A 32-bit integral value used to initialize bits [255:224] of the result.
3694/// \param __i1
3695/// A 32-bit integral value used to initialize bits [223:192] of the result.
3696/// \param __i2
3697/// A 32-bit integral value used to initialize bits [191:160] of the result.
3698/// \param __i3
3699/// A 32-bit integral value used to initialize bits [159:128] of the result.
3700/// \param __i4
3701/// A 32-bit integral value used to initialize bits [127:96] of the result.
3702/// \param __i5
3703/// A 32-bit integral value used to initialize bits [95:64] of the result.
3704/// \param __i6
3705/// A 32-bit integral value used to initialize bits [63:32] of the result.
3706/// \param __i7
3707/// A 32-bit integral value used to initialize bits [31:0] of the result.
3708/// \returns An initialized 256-bit integer vector.
3709static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
3710_mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
3711 int __i4, int __i5, int __i6, int __i7)
3712{
3713 return __extension__ (__m256i)(__v8si){ __i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0 };
3714}
3715
3716/// Constructs a 256-bit integer vector initialized with the specified
3717/// 16-bit integral values.
3718///
3719/// \headerfile <x86intrin.h>
3720///
3721/// This intrinsic is a utility function and does not correspond to a specific
3722/// instruction.
3723///
3724/// \param __w15
3725/// A 16-bit integral value used to initialize bits [255:240] of the result.
3726/// \param __w14
3727/// A 16-bit integral value used to initialize bits [239:224] of the result.
3728/// \param __w13
3729/// A 16-bit integral value used to initialize bits [223:208] of the result.
3730/// \param __w12
3731/// A 16-bit integral value used to initialize bits [207:192] of the result.
3732/// \param __w11
3733/// A 16-bit integral value used to initialize bits [191:176] of the result.
3734/// \param __w10
3735/// A 16-bit integral value used to initialize bits [175:160] of the result.
3736/// \param __w09
3737/// A 16-bit integral value used to initialize bits [159:144] of the result.
3738/// \param __w08
3739/// A 16-bit integral value used to initialize bits [143:128] of the result.
3740/// \param __w07
3741/// A 16-bit integral value used to initialize bits [127:112] of the result.
3742/// \param __w06
3743/// A 16-bit integral value used to initialize bits [111:96] of the result.
3744/// \param __w05
3745/// A 16-bit integral value used to initialize bits [95:80] of the result.
3746/// \param __w04
3747/// A 16-bit integral value used to initialize bits [79:64] of the result.
3748/// \param __w03
3749/// A 16-bit integral value used to initialize bits [63:48] of the result.
3750/// \param __w02
3751/// A 16-bit integral value used to initialize bits [47:32] of the result.
3752/// \param __w01
3753/// A 16-bit integral value used to initialize bits [31:16] of the result.
3754/// \param __w00
3755/// A 16-bit integral value used to initialize bits [15:0] of the result.
3756/// \returns An initialized 256-bit integer vector.
3757static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
3758_mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
3759 short __w11, short __w10, short __w09, short __w08,
3760 short __w07, short __w06, short __w05, short __w04,
3761 short __w03, short __w02, short __w01, short __w00)
3762{
3763 return __extension__ (__m256i)(__v16hi){ __w00, __w01, __w02, __w03, __w04, __w05, __w06,
3764 __w07, __w08, __w09, __w10, __w11, __w12, __w13, __w14, __w15 };
3765}
3766
3767/// Constructs a 256-bit integer vector initialized with the specified
3768/// 8-bit integral values.
3769///
3770/// \headerfile <x86intrin.h>
3771///
3772/// This intrinsic is a utility function and does not correspond to a specific
3773/// instruction.
3774///
3775/// \param __b31
3776/// An 8-bit integral value used to initialize bits [255:248] of the result.
3777/// \param __b30
3778/// An 8-bit integral value used to initialize bits [247:240] of the result.
3779/// \param __b29
3780/// An 8-bit integral value used to initialize bits [239:232] of the result.
3781/// \param __b28
3782/// An 8-bit integral value used to initialize bits [231:224] of the result.
3783/// \param __b27
3784/// An 8-bit integral value used to initialize bits [223:216] of the result.
3785/// \param __b26
3786/// An 8-bit integral value used to initialize bits [215:208] of the result.
3787/// \param __b25
3788/// An 8-bit integral value used to initialize bits [207:200] of the result.
3789/// \param __b24
3790/// An 8-bit integral value used to initialize bits [199:192] of the result.
3791/// \param __b23
3792/// An 8-bit integral value used to initialize bits [191:184] of the result.
3793/// \param __b22
3794/// An 8-bit integral value used to initialize bits [183:176] of the result.
3795/// \param __b21
3796/// An 8-bit integral value used to initialize bits [175:168] of the result.
3797/// \param __b20
3798/// An 8-bit integral value used to initialize bits [167:160] of the result.
3799/// \param __b19
3800/// An 8-bit integral value used to initialize bits [159:152] of the result.
3801/// \param __b18
3802/// An 8-bit integral value used to initialize bits [151:144] of the result.
3803/// \param __b17
3804/// An 8-bit integral value used to initialize bits [143:136] of the result.
3805/// \param __b16
3806/// An 8-bit integral value used to initialize bits [135:128] of the result.
3807/// \param __b15
3808/// An 8-bit integral value used to initialize bits [127:120] of the result.
3809/// \param __b14
3810/// An 8-bit integral value used to initialize bits [119:112] of the result.
3811/// \param __b13
3812/// An 8-bit integral value used to initialize bits [111:104] of the result.
3813/// \param __b12
3814/// An 8-bit integral value used to initialize bits [103:96] of the result.
3815/// \param __b11
3816/// An 8-bit integral value used to initialize bits [95:88] of the result.
3817/// \param __b10
3818/// An 8-bit integral value used to initialize bits [87:80] of the result.
3819/// \param __b09
3820/// An 8-bit integral value used to initialize bits [79:72] of the result.
3821/// \param __b08
3822/// An 8-bit integral value used to initialize bits [71:64] of the result.
3823/// \param __b07
3824/// An 8-bit integral value used to initialize bits [63:56] of the result.
3825/// \param __b06
3826/// An 8-bit integral value used to initialize bits [55:48] of the result.
3827/// \param __b05
3828/// An 8-bit integral value used to initialize bits [47:40] of the result.
3829/// \param __b04
3830/// An 8-bit integral value used to initialize bits [39:32] of the result.
3831/// \param __b03
3832/// An 8-bit integral value used to initialize bits [31:24] of the result.
3833/// \param __b02
3834/// An 8-bit integral value used to initialize bits [23:16] of the result.
3835/// \param __b01
3836/// An 8-bit integral value used to initialize bits [15:8] of the result.
3837/// \param __b00
3838/// An 8-bit integral value used to initialize bits [7:0] of the result.
3839/// \returns An initialized 256-bit integer vector.
3840static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
3841_mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
3842 char __b27, char __b26, char __b25, char __b24,
3843 char __b23, char __b22, char __b21, char __b20,
3844 char __b19, char __b18, char __b17, char __b16,
3845 char __b15, char __b14, char __b13, char __b12,
3846 char __b11, char __b10, char __b09, char __b08,
3847 char __b07, char __b06, char __b05, char __b04,
3848 char __b03, char __b02, char __b01, char __b00)
3849{
3850 return __extension__ (__m256i)(__v32qi){
3851 __b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
3852 __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
3853 __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
3854 __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31
3855 };
3856}
3857
3858/// Constructs a 256-bit integer vector initialized with the specified
3859/// 64-bit integral values.
3860///
3861/// \headerfile <x86intrin.h>
3862///
3863/// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
3864/// instruction.
3865///
3866/// \param __a
3867/// A 64-bit integral value used to initialize bits [255:192] of the result.
3868/// \param __b
3869/// A 64-bit integral value used to initialize bits [191:128] of the result.
3870/// \param __c
3871/// A 64-bit integral value used to initialize bits [127:64] of the result.
3872/// \param __d
3873/// A 64-bit integral value used to initialize bits [63:0] of the result.
3874/// \returns An initialized 256-bit integer vector.
3875static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
3876_mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
3877{
3878 return __extension__ (__m256i)(__v4di){ __d, __c, __b, __a };
3879}
3880
3881/* Create vectors with elements in reverse order */
3882/// Constructs a 256-bit floating-point vector of [4 x double],
3883/// initialized in reverse order with the specified double-precision
3884/// floating-point values.
3885///
3886/// \headerfile <x86intrin.h>
3887///
3888/// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3889/// instruction.
3890///
3891/// \param __a
3892/// A double-precision floating-point value used to initialize bits [63:0]
3893/// of the result.
3894/// \param __b
3895/// A double-precision floating-point value used to initialize bits [127:64]
3896/// of the result.
3897/// \param __c
3898/// A double-precision floating-point value used to initialize bits [191:128]
3899/// of the result.
3900/// \param __d
3901/// A double-precision floating-point value used to initialize bits [255:192]
3902/// of the result.
3903/// \returns An initialized 256-bit floating-point vector of [4 x double].
3904static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
3905_mm256_setr_pd(double __a, double __b, double __c, double __d)
3906{
3907 return _mm256_set_pd(__d, __c, __b, __a);
3908}
3909
3910/// Constructs a 256-bit floating-point vector of [8 x float],
3911/// initialized in reverse order with the specified single-precision
3912/// float-point values.
3913///
3914/// \headerfile <x86intrin.h>
3915///
3916/// This intrinsic is a utility function and does not correspond to a specific
3917/// instruction.
3918///
3919/// \param __a
3920/// A single-precision floating-point value used to initialize bits [31:0]
3921/// of the result.
3922/// \param __b
3923/// A single-precision floating-point value used to initialize bits [63:32]
3924/// of the result.
3925/// \param __c
3926/// A single-precision floating-point value used to initialize bits [95:64]
3927/// of the result.
3928/// \param __d
3929/// A single-precision floating-point value used to initialize bits [127:96]
3930/// of the result.
3931/// \param __e
3932/// A single-precision floating-point value used to initialize bits [159:128]
3933/// of the result.
3934/// \param __f
3935/// A single-precision floating-point value used to initialize bits [191:160]
3936/// of the result.
3937/// \param __g
3938/// A single-precision floating-point value used to initialize bits [223:192]
3939/// of the result.
3940/// \param __h
3941/// A single-precision floating-point value used to initialize bits [255:224]
3942/// of the result.
3943/// \returns An initialized 256-bit floating-point vector of [8 x float].
3944static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
3945_mm256_setr_ps(float __a, float __b, float __c, float __d,
3946 float __e, float __f, float __g, float __h)
3947{
3948 return _mm256_set_ps(__h, __g, __f, __e, __d, __c, __b, __a);
3949}
3950
3951/// Constructs a 256-bit integer vector, initialized in reverse order
3952/// with the specified 32-bit integral values.
3953///
3954/// \headerfile <x86intrin.h>
3955///
3956/// This intrinsic is a utility function and does not correspond to a specific
3957/// instruction.
3958///
3959/// \param __i0
3960/// A 32-bit integral value used to initialize bits [31:0] of the result.
3961/// \param __i1
3962/// A 32-bit integral value used to initialize bits [63:32] of the result.
3963/// \param __i2
3964/// A 32-bit integral value used to initialize bits [95:64] of the result.
3965/// \param __i3
3966/// A 32-bit integral value used to initialize bits [127:96] of the result.
3967/// \param __i4
3968/// A 32-bit integral value used to initialize bits [159:128] of the result.
3969/// \param __i5
3970/// A 32-bit integral value used to initialize bits [191:160] of the result.
3971/// \param __i6
3972/// A 32-bit integral value used to initialize bits [223:192] of the result.
3973/// \param __i7
3974/// A 32-bit integral value used to initialize bits [255:224] of the result.
3975/// \returns An initialized 256-bit integer vector.
3976static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
3977_mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
3978 int __i4, int __i5, int __i6, int __i7)
3979{
3980 return _mm256_set_epi32(__i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0);
3981}
3982
3983/// Constructs a 256-bit integer vector, initialized in reverse order
3984/// with the specified 16-bit integral values.
3985///
3986/// \headerfile <x86intrin.h>
3987///
3988/// This intrinsic is a utility function and does not correspond to a specific
3989/// instruction.
3990///
3991/// \param __w15
3992/// A 16-bit integral value used to initialize bits [15:0] of the result.
3993/// \param __w14
3994/// A 16-bit integral value used to initialize bits [31:16] of the result.
3995/// \param __w13
3996/// A 16-bit integral value used to initialize bits [47:32] of the result.
3997/// \param __w12
3998/// A 16-bit integral value used to initialize bits [63:48] of the result.
3999/// \param __w11
4000/// A 16-bit integral value used to initialize bits [79:64] of the result.
4001/// \param __w10
4002/// A 16-bit integral value used to initialize bits [95:80] of the result.
4003/// \param __w09
4004/// A 16-bit integral value used to initialize bits [111:96] of the result.
4005/// \param __w08
4006/// A 16-bit integral value used to initialize bits [127:112] of the result.
4007/// \param __w07
4008/// A 16-bit integral value used to initialize bits [143:128] of the result.
4009/// \param __w06
4010/// A 16-bit integral value used to initialize bits [159:144] of the result.
4011/// \param __w05
4012/// A 16-bit integral value used to initialize bits [175:160] of the result.
4013/// \param __w04
4014/// A 16-bit integral value used to initialize bits [191:176] of the result.
4015/// \param __w03
4016/// A 16-bit integral value used to initialize bits [207:192] of the result.
4017/// \param __w02
4018/// A 16-bit integral value used to initialize bits [223:208] of the result.
4019/// \param __w01
4020/// A 16-bit integral value used to initialize bits [239:224] of the result.
4021/// \param __w00
4022/// A 16-bit integral value used to initialize bits [255:240] of the result.
4023/// \returns An initialized 256-bit integer vector.
4024static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4025_mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
4026 short __w11, short __w10, short __w09, short __w08,
4027 short __w07, short __w06, short __w05, short __w04,
4028 short __w03, short __w02, short __w01, short __w00)
4029{
4030 return _mm256_set_epi16(__w00, __w01, __w02, __w03,
4031 __w04, __w05, __w06, __w07,
4032 __w08, __w09, __w10, __w11,
4033 __w12, __w13, __w14, __w15);
4034}
4035
4036/// Constructs a 256-bit integer vector, initialized in reverse order
4037/// with the specified 8-bit integral values.
4038///
4039/// \headerfile <x86intrin.h>
4040///
4041/// This intrinsic is a utility function and does not correspond to a specific
4042/// instruction.
4043///
4044/// \param __b31
4045/// An 8-bit integral value used to initialize bits [7:0] of the result.
4046/// \param __b30
4047/// An 8-bit integral value used to initialize bits [15:8] of the result.
4048/// \param __b29
4049/// An 8-bit integral value used to initialize bits [23:16] of the result.
4050/// \param __b28
4051/// An 8-bit integral value used to initialize bits [31:24] of the result.
4052/// \param __b27
4053/// An 8-bit integral value used to initialize bits [39:32] of the result.
4054/// \param __b26
4055/// An 8-bit integral value used to initialize bits [47:40] of the result.
4056/// \param __b25
4057/// An 8-bit integral value used to initialize bits [55:48] of the result.
4058/// \param __b24
4059/// An 8-bit integral value used to initialize bits [63:56] of the result.
4060/// \param __b23
4061/// An 8-bit integral value used to initialize bits [71:64] of the result.
4062/// \param __b22
4063/// An 8-bit integral value used to initialize bits [79:72] of the result.
4064/// \param __b21
4065/// An 8-bit integral value used to initialize bits [87:80] of the result.
4066/// \param __b20
4067/// An 8-bit integral value used to initialize bits [95:88] of the result.
4068/// \param __b19
4069/// An 8-bit integral value used to initialize bits [103:96] of the result.
4070/// \param __b18
4071/// An 8-bit integral value used to initialize bits [111:104] of the result.
4072/// \param __b17
4073/// An 8-bit integral value used to initialize bits [119:112] of the result.
4074/// \param __b16
4075/// An 8-bit integral value used to initialize bits [127:120] of the result.
4076/// \param __b15
4077/// An 8-bit integral value used to initialize bits [135:128] of the result.
4078/// \param __b14
4079/// An 8-bit integral value used to initialize bits [143:136] of the result.
4080/// \param __b13
4081/// An 8-bit integral value used to initialize bits [151:144] of the result.
4082/// \param __b12
4083/// An 8-bit integral value used to initialize bits [159:152] of the result.
4084/// \param __b11
4085/// An 8-bit integral value used to initialize bits [167:160] of the result.
4086/// \param __b10
4087/// An 8-bit integral value used to initialize bits [175:168] of the result.
4088/// \param __b09
4089/// An 8-bit integral value used to initialize bits [183:176] of the result.
4090/// \param __b08
4091/// An 8-bit integral value used to initialize bits [191:184] of the result.
4092/// \param __b07
4093/// An 8-bit integral value used to initialize bits [199:192] of the result.
4094/// \param __b06
4095/// An 8-bit integral value used to initialize bits [207:200] of the result.
4096/// \param __b05
4097/// An 8-bit integral value used to initialize bits [215:208] of the result.
4098/// \param __b04
4099/// An 8-bit integral value used to initialize bits [223:216] of the result.
4100/// \param __b03
4101/// An 8-bit integral value used to initialize bits [231:224] of the result.
4102/// \param __b02
4103/// An 8-bit integral value used to initialize bits [239:232] of the result.
4104/// \param __b01
4105/// An 8-bit integral value used to initialize bits [247:240] of the result.
4106/// \param __b00
4107/// An 8-bit integral value used to initialize bits [255:248] of the result.
4108/// \returns An initialized 256-bit integer vector.
4109static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4110_mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
4111 char __b27, char __b26, char __b25, char __b24,
4112 char __b23, char __b22, char __b21, char __b20,
4113 char __b19, char __b18, char __b17, char __b16,
4114 char __b15, char __b14, char __b13, char __b12,
4115 char __b11, char __b10, char __b09, char __b08,
4116 char __b07, char __b06, char __b05, char __b04,
4117 char __b03, char __b02, char __b01, char __b00)
4118{
4119 return _mm256_set_epi8(__b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
4120 __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
4121 __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
4122 __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31);
4123}
4124
4125/// Constructs a 256-bit integer vector, initialized in reverse order
4126/// with the specified 64-bit integral values.
4127///
4128/// \headerfile <x86intrin.h>
4129///
4130/// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
4131/// instruction.
4132///
4133/// \param __a
4134/// A 64-bit integral value used to initialize bits [63:0] of the result.
4135/// \param __b
4136/// A 64-bit integral value used to initialize bits [127:64] of the result.
4137/// \param __c
4138/// A 64-bit integral value used to initialize bits [191:128] of the result.
4139/// \param __d
4140/// A 64-bit integral value used to initialize bits [255:192] of the result.
4141/// \returns An initialized 256-bit integer vector.
4142static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4143_mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
4144{
4145 return _mm256_set_epi64x(__d, __c, __b, __a);
4146}
4147
4148/* Create vectors with repeated elements */
4149/// Constructs a 256-bit floating-point vector of [4 x double], with each
4150/// of the four double-precision floating-point vector elements set to the
4151/// specified double-precision floating-point value.
4152///
4153/// \headerfile <x86intrin.h>
4154///
4155/// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4156///
4157/// \param __w
4158/// A double-precision floating-point value used to initialize each vector
4159/// element of the result.
4160/// \returns An initialized 256-bit floating-point vector of [4 x double].
4161static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4163{
4164 return _mm256_set_pd(__w, __w, __w, __w);
4165}
4166
4167/// Constructs a 256-bit floating-point vector of [8 x float], with each
4168/// of the eight single-precision floating-point vector elements set to the
4169/// specified single-precision floating-point value.
4170///
4171/// \headerfile <x86intrin.h>
4172///
4173/// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4174/// instruction.
4175///
4176/// \param __w
4177/// A single-precision floating-point value used to initialize each vector
4178/// element of the result.
4179/// \returns An initialized 256-bit floating-point vector of [8 x float].
4180static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4182{
4183 return _mm256_set_ps(__w, __w, __w, __w, __w, __w, __w, __w);
4184}
4185
4186/// Constructs a 256-bit integer vector of [8 x i32], with each of the
4187/// 32-bit integral vector elements set to the specified 32-bit integral
4188/// value.
4189///
4190/// \headerfile <x86intrin.h>
4191///
4192/// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4193/// instruction.
4194///
4195/// \param __i
4196/// A 32-bit integral value used to initialize each vector element of the
4197/// result.
4198/// \returns An initialized 256-bit integer vector of [8 x i32].
4199static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4201{
4202 return _mm256_set_epi32(__i, __i, __i, __i, __i, __i, __i, __i);
4203}
4204
4205/// Constructs a 256-bit integer vector of [16 x i16], with each of the
4206/// 16-bit integral vector elements set to the specified 16-bit integral
4207/// value.
4208///
4209/// \headerfile <x86intrin.h>
4210///
4211/// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4212///
4213/// \param __w
4214/// A 16-bit integral value used to initialize each vector element of the
4215/// result.
4216/// \returns An initialized 256-bit integer vector of [16 x i16].
4217static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4219{
4220 return _mm256_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w,
4221 __w, __w, __w, __w, __w, __w, __w, __w);
4222}
4223
4224/// Constructs a 256-bit integer vector of [32 x i8], with each of the
4225/// 8-bit integral vector elements set to the specified 8-bit integral value.
4226///
4227/// \headerfile <x86intrin.h>
4228///
4229/// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4230///
4231/// \param __b
4232/// An 8-bit integral value used to initialize each vector element of the
4233/// result.
4234/// \returns An initialized 256-bit integer vector of [32 x i8].
4235static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4237{
4238 return _mm256_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b,
4239 __b, __b, __b, __b, __b, __b, __b, __b,
4240 __b, __b, __b, __b, __b, __b, __b, __b,
4241 __b, __b, __b, __b, __b, __b, __b, __b);
4242}
4243
4244/// Constructs a 256-bit integer vector of [4 x i64], with each of the
4245/// 64-bit integral vector elements set to the specified 64-bit integral
4246/// value.
4247///
4248/// \headerfile <x86intrin.h>
4249///
4250/// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4251///
4252/// \param __q
4253/// A 64-bit integral value used to initialize each vector element of the
4254/// result.
4255/// \returns An initialized 256-bit integer vector of [4 x i64].
4256static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4258{
4259 return _mm256_set_epi64x(__q, __q, __q, __q);
4260}
4261
4262/* Create __zeroed vectors */
4263/// Constructs a 256-bit floating-point vector of [4 x double] with all
4264/// vector elements initialized to zero.
4265///
4266/// \headerfile <x86intrin.h>
4267///
4268/// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4269///
4270/// \returns A 256-bit vector of [4 x double] with all elements set to zero.
4272 return __extension__(__m256d){0.0, 0.0, 0.0, 0.0};
4273}
4274
4275/// Constructs a 256-bit floating-point vector of [8 x float] with all
4276/// vector elements initialized to zero.
4277///
4278/// \headerfile <x86intrin.h>
4279///
4280/// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4281///
4282/// \returns A 256-bit vector of [8 x float] with all elements set to zero.
4284 return __extension__ (__m256){ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
4285}
4286
4287/// Constructs a 256-bit integer vector initialized to zero.
4288///
4289/// \headerfile <x86intrin.h>
4290///
4291/// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4292///
4293/// \returns A 256-bit integer vector initialized to zero.
4294static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4296 return __extension__ (__m256i)(__v4di){ 0, 0, 0, 0 };
4297}
4298
4299/* Cast between vector types */
4300/// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4301/// floating-point vector of [8 x float].
4302///
4303/// \headerfile <x86intrin.h>
4304///
4305/// This intrinsic has no corresponding instruction.
4306///
4307/// \param __a
4308/// A 256-bit floating-point vector of [4 x double].
4309/// \returns A 256-bit floating-point vector of [8 x float] containing the same
4310/// bitwise pattern as the parameter.
4311static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4313{
4314 return (__m256)__a;
4315}
4316
4317/// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4318/// integer vector.
4319///
4320/// \headerfile <x86intrin.h>
4321///
4322/// This intrinsic has no corresponding instruction.
4323///
4324/// \param __a
4325/// A 256-bit floating-point vector of [4 x double].
4326/// \returns A 256-bit integer vector containing the same bitwise pattern as the
4327/// parameter.
4328static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4330{
4331 return (__m256i)__a;
4332}
4333
4334/// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4335/// floating-point vector of [4 x double].
4336///
4337/// \headerfile <x86intrin.h>
4338///
4339/// This intrinsic has no corresponding instruction.
4340///
4341/// \param __a
4342/// A 256-bit floating-point vector of [8 x float].
4343/// \returns A 256-bit floating-point vector of [4 x double] containing the same
4344/// bitwise pattern as the parameter.
4345static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4347{
4348 return (__m256d)__a;
4349}
4350
4351/// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4352/// integer vector.
4353///
4354/// \headerfile <x86intrin.h>
4355///
4356/// This intrinsic has no corresponding instruction.
4357///
4358/// \param __a
4359/// A 256-bit floating-point vector of [8 x float].
4360/// \returns A 256-bit integer vector containing the same bitwise pattern as the
4361/// parameter.
4362static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4364{
4365 return (__m256i)__a;
4366}
4367
4368/// Casts a 256-bit integer vector into a 256-bit floating-point vector
4369/// of [8 x float].
4370///
4371/// \headerfile <x86intrin.h>
4372///
4373/// This intrinsic has no corresponding instruction.
4374///
4375/// \param __a
4376/// A 256-bit integer vector.
4377/// \returns A 256-bit floating-point vector of [8 x float] containing the same
4378/// bitwise pattern as the parameter.
4379static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4381{
4382 return (__m256)__a;
4383}
4384
4385/// Casts a 256-bit integer vector into a 256-bit floating-point vector
4386/// of [4 x double].
4387///
4388/// \headerfile <x86intrin.h>
4389///
4390/// This intrinsic has no corresponding instruction.
4391///
4392/// \param __a
4393/// A 256-bit integer vector.
4394/// \returns A 256-bit floating-point vector of [4 x double] containing the same
4395/// bitwise pattern as the parameter.
4396static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4398{
4399 return (__m256d)__a;
4400}
4401
4402/// Returns the lower 128 bits of a 256-bit floating-point vector of
4403/// [4 x double] as a 128-bit floating-point vector of [2 x double].
4404///
4405/// \headerfile <x86intrin.h>
4406///
4407/// This intrinsic has no corresponding instruction.
4408///
4409/// \param __a
4410/// A 256-bit floating-point vector of [4 x double].
4411/// \returns A 128-bit floating-point vector of [2 x double] containing the
4412/// lower 128 bits of the parameter.
4413static __inline __m128d __DEFAULT_FN_ATTRS_CONSTEXPR
4415{
4416 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 1);
4417}
4418
4419/// Returns the lower 128 bits of a 256-bit floating-point vector of
4420/// [8 x float] as a 128-bit floating-point vector of [4 x float].
4421///
4422/// \headerfile <x86intrin.h>
4423///
4424/// This intrinsic has no corresponding instruction.
4425///
4426/// \param __a
4427/// A 256-bit floating-point vector of [8 x float].
4428/// \returns A 128-bit floating-point vector of [4 x float] containing the
4429/// lower 128 bits of the parameter.
4430static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
4432{
4433 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 1, 2, 3);
4434}
4435
4436/// Truncates a 256-bit integer vector into a 128-bit integer vector.
4437///
4438/// \headerfile <x86intrin.h>
4439///
4440/// This intrinsic has no corresponding instruction.
4441///
4442/// \param __a
4443/// A 256-bit integer vector.
4444/// \returns A 128-bit integer vector containing the lower 128 bits of the
4445/// parameter.
4446static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4448{
4449 return __builtin_shufflevector((__v4di)__a, (__v4di)__a, 0, 1);
4450}
4451
4452/// Constructs a 256-bit floating-point vector of [4 x double] from a
4453/// 128-bit floating-point vector of [2 x double].
4454///
4455/// The lower 128 bits contain the value of the source vector. The contents
4456/// of the upper 128 bits are undefined.
4457///
4458/// \headerfile <x86intrin.h>
4459///
4460/// This intrinsic has no corresponding instruction.
4461///
4462/// \param __a
4463/// A 128-bit vector of [2 x double].
4464/// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4465/// contain the value of the parameter. The contents of the upper 128 bits
4466/// are undefined.
4467static __inline __m256d __DEFAULT_FN_ATTRS
4469{
4470 return __builtin_shufflevector(
4471 (__v2df)__a, (__v2df)__builtin_nondeterministic_value(__a), 0, 1, 2, 3);
4472}
4473
4474/// Constructs a 256-bit floating-point vector of [8 x float] from a
4475/// 128-bit floating-point vector of [4 x float].
4476///
4477/// The lower 128 bits contain the value of the source vector. The contents
4478/// of the upper 128 bits are undefined.
4479///
4480/// \headerfile <x86intrin.h>
4481///
4482/// This intrinsic has no corresponding instruction.
4483///
4484/// \param __a
4485/// A 128-bit vector of [4 x float].
4486/// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4487/// contain the value of the parameter. The contents of the upper 128 bits
4488/// are undefined.
4489static __inline __m256 __DEFAULT_FN_ATTRS
4491{
4492 return __builtin_shufflevector((__v4sf)__a,
4493 (__v4sf)__builtin_nondeterministic_value(__a),
4494 0, 1, 2, 3, 4, 5, 6, 7);
4495}
4496
4497/// Constructs a 256-bit integer vector from a 128-bit integer vector.
4498///
4499/// The lower 128 bits contain the value of the source vector. The contents
4500/// of the upper 128 bits are undefined.
4501///
4502/// \headerfile <x86intrin.h>
4503///
4504/// This intrinsic has no corresponding instruction.
4505///
4506/// \param __a
4507/// A 128-bit integer vector.
4508/// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4509/// the parameter. The contents of the upper 128 bits are undefined.
4510static __inline __m256i __DEFAULT_FN_ATTRS
4512{
4513 return __builtin_shufflevector(
4514 (__v2di)__a, (__v2di)__builtin_nondeterministic_value(__a), 0, 1, 2, 3);
4515}
4516
4517/// Constructs a 256-bit floating-point vector of [4 x double] from a
4518/// 128-bit floating-point vector of [2 x double]. The lower 128 bits
4519/// contain the value of the source vector. The upper 128 bits are set
4520/// to zero.
4521///
4522/// \headerfile <x86intrin.h>
4523///
4524/// This intrinsic has no corresponding instruction.
4525///
4526/// \param __a
4527/// A 128-bit vector of [2 x double].
4528/// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4529/// contain the value of the parameter. The upper 128 bits are set to zero.
4530static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4532 return __builtin_shufflevector((__v2df)__a, (__v2df)_mm_setzero_pd(), 0, 1, 2, 3);
4533}
4534
4535/// Constructs a 256-bit floating-point vector of [8 x float] from a
4536/// 128-bit floating-point vector of [4 x float]. The lower 128 bits contain
4537/// the value of the source vector. The upper 128 bits are set to zero.
4538///
4539/// \headerfile <x86intrin.h>
4540///
4541/// This intrinsic has no corresponding instruction.
4542///
4543/// \param __a
4544/// A 128-bit vector of [4 x float].
4545/// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4546/// contain the value of the parameter. The upper 128 bits are set to zero.
4547static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4549 return __builtin_shufflevector((__v4sf)__a, (__v4sf)_mm_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7);
4550}
4551
4552/// Constructs a 256-bit integer vector from a 128-bit integer vector.
4553/// The lower 128 bits contain the value of the source vector. The upper
4554/// 128 bits are set to zero.
4555///
4556/// \headerfile <x86intrin.h>
4557///
4558/// This intrinsic has no corresponding instruction.
4559///
4560/// \param __a
4561/// A 128-bit integer vector.
4562/// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4563/// the parameter. The upper 128 bits are set to zero.
4564static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4566 return __builtin_shufflevector((__v2di)__a, (__v2di)_mm_setzero_si128(), 0, 1, 2, 3);
4567}
4568
4569/*
4570 Vector insert.
4571 We use macros rather than inlines because we only want to accept
4572 invocations where the immediate M is a constant expression.
4573*/
4574/// Constructs a new 256-bit vector of [8 x float] by first duplicating
4575/// a 256-bit vector of [8 x float] given in the first parameter, and then
4576/// replacing either the upper or the lower 128 bits with the contents of a
4577/// 128-bit vector of [4 x float] in the second parameter.
4578///
4579/// The immediate integer parameter determines between the upper or the lower
4580/// 128 bits.
4581///
4582/// \headerfile <x86intrin.h>
4583///
4584/// \code
4585/// __m256 _mm256_insertf128_ps(__m256 V1, __m128 V2, const int M);
4586/// \endcode
4587///
4588/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4589///
4590/// \param V1
4591/// A 256-bit vector of [8 x float]. This vector is copied to the result
4592/// first, and then either the upper or the lower 128 bits of the result will
4593/// be replaced by the contents of \a V2.
4594/// \param V2
4595/// A 128-bit vector of [4 x float]. The contents of this parameter are
4596/// written to either the upper or the lower 128 bits of the result depending
4597/// on the value of parameter \a M.
4598/// \param M
4599/// An immediate integer. The least significant bit determines how the values
4600/// from the two parameters are interleaved: \n
4601/// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4602/// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4603/// result. \n
4604/// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4605/// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4606/// result.
4607/// \returns A 256-bit vector of [8 x float] containing the interleaved values.
4608#define _mm256_insertf128_ps(V1, V2, M) \
4609 ((__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)(__m256)(V1), \
4610 (__v4sf)(__m128)(V2), (int)(M)))
4611
4612/// Constructs a new 256-bit vector of [4 x double] by first duplicating
4613/// a 256-bit vector of [4 x double] given in the first parameter, and then
4614/// replacing either the upper or the lower 128 bits with the contents of a
4615/// 128-bit vector of [2 x double] in the second parameter.
4616///
4617/// The immediate integer parameter determines between the upper or the lower
4618/// 128 bits.
4619///
4620/// \headerfile <x86intrin.h>
4621///
4622/// \code
4623/// __m256d _mm256_insertf128_pd(__m256d V1, __m128d V2, const int M);
4624/// \endcode
4625///
4626/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4627///
4628/// \param V1
4629/// A 256-bit vector of [4 x double]. This vector is copied to the result
4630/// first, and then either the upper or the lower 128 bits of the result will
4631/// be replaced by the contents of \a V2.
4632/// \param V2
4633/// A 128-bit vector of [2 x double]. The contents of this parameter are
4634/// written to either the upper or the lower 128 bits of the result depending
4635/// on the value of parameter \a M.
4636/// \param M
4637/// An immediate integer. The least significant bit determines how the values
4638/// from the two parameters are interleaved: \n
4639/// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4640/// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4641/// result. \n
4642/// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4643/// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4644/// result.
4645/// \returns A 256-bit vector of [4 x double] containing the interleaved values.
4646#define _mm256_insertf128_pd(V1, V2, M) \
4647 ((__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)(__m256d)(V1), \
4648 (__v2df)(__m128d)(V2), (int)(M)))
4649
4650/// Constructs a new 256-bit integer vector by first duplicating a
4651/// 256-bit integer vector given in the first parameter, and then replacing
4652/// either the upper or the lower 128 bits with the contents of a 128-bit
4653/// integer vector in the second parameter.
4654///
4655/// The immediate integer parameter determines between the upper or the lower
4656/// 128 bits.
4657///
4658/// \headerfile <x86intrin.h>
4659///
4660/// \code
4661/// __m256i _mm256_insertf128_si256(__m256i V1, __m128i V2, const int M);
4662/// \endcode
4663///
4664/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4665///
4666/// \param V1
4667/// A 256-bit integer vector. This vector is copied to the result first, and
4668/// then either the upper or the lower 128 bits of the result will be
4669/// replaced by the contents of \a V2.
4670/// \param V2
4671/// A 128-bit integer vector. The contents of this parameter are written to
4672/// either the upper or the lower 128 bits of the result depending on the
4673/// value of parameter \a M.
4674/// \param M
4675/// An immediate integer. The least significant bit determines how the values
4676/// from the two parameters are interleaved: \n
4677/// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4678/// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4679/// result. \n
4680/// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4681/// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4682/// result.
4683/// \returns A 256-bit integer vector containing the interleaved values.
4684#define _mm256_insertf128_si256(V1, V2, M) \
4685 ((__m256i)__builtin_ia32_vinsertf128_si256((__v8si)(__m256i)(V1), \
4686 (__v4si)(__m128i)(V2), (int)(M)))
4687
4688/*
4689 Vector extract.
4690 We use macros rather than inlines because we only want to accept
4691 invocations where the immediate M is a constant expression.
4692*/
4693/// Extracts either the upper or the lower 128 bits from a 256-bit vector
4694/// of [8 x float], as determined by the immediate integer parameter, and
4695/// returns the extracted bits as a 128-bit vector of [4 x float].
4696///
4697/// \headerfile <x86intrin.h>
4698///
4699/// \code
4700/// __m128 _mm256_extractf128_ps(__m256 V, const int M);
4701/// \endcode
4702///
4703/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4704///
4705/// \param V
4706/// A 256-bit vector of [8 x float].
4707/// \param M
4708/// An immediate integer. The least significant bit determines which bits are
4709/// extracted from the first parameter: \n
4710/// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4711/// result. \n
4712/// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4713/// \returns A 128-bit vector of [4 x float] containing the extracted bits.
4714#define _mm256_extractf128_ps(V, M) \
4715 ((__m128)__builtin_ia32_vextractf128_ps256((__v8sf)(__m256)(V), (int)(M)))
4716
4717/// Extracts either the upper or the lower 128 bits from a 256-bit vector
4718/// of [4 x double], as determined by the immediate integer parameter, and
4719/// returns the extracted bits as a 128-bit vector of [2 x double].
4720///
4721/// \headerfile <x86intrin.h>
4722///
4723/// \code
4724/// __m128d _mm256_extractf128_pd(__m256d V, const int M);
4725/// \endcode
4726///
4727/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4728///
4729/// \param V
4730/// A 256-bit vector of [4 x double].
4731/// \param M
4732/// An immediate integer. The least significant bit determines which bits are
4733/// extracted from the first parameter: \n
4734/// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4735/// result. \n
4736/// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4737/// \returns A 128-bit vector of [2 x double] containing the extracted bits.
4738#define _mm256_extractf128_pd(V, M) \
4739 ((__m128d)__builtin_ia32_vextractf128_pd256((__v4df)(__m256d)(V), (int)(M)))
4740
4741/// Extracts either the upper or the lower 128 bits from a 256-bit
4742/// integer vector, as determined by the immediate integer parameter, and
4743/// returns the extracted bits as a 128-bit integer vector.
4744///
4745/// \headerfile <x86intrin.h>
4746///
4747/// \code
4748/// __m128i _mm256_extractf128_si256(__m256i V, const int M);
4749/// \endcode
4750///
4751/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4752///
4753/// \param V
4754/// A 256-bit integer vector.
4755/// \param M
4756/// An immediate integer. The least significant bit determines which bits are
4757/// extracted from the first parameter: \n
4758/// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4759/// result. \n
4760/// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4761/// \returns A 128-bit integer vector containing the extracted bits.
4762#define _mm256_extractf128_si256(V, M) \
4763 ((__m128i)__builtin_ia32_vextractf128_si256((__v8si)(__m256i)(V), (int)(M)))
4764
4765/// Constructs a 256-bit floating-point vector of [8 x float] by
4766/// concatenating two 128-bit floating-point vectors of [4 x float].
4767///
4768/// \headerfile <x86intrin.h>
4769///
4770/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4771///
4772/// \param __hi
4773/// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4774/// 128 bits of the result.
4775/// \param __lo
4776/// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4777/// 128 bits of the result.
4778/// \returns A 256-bit floating-point vector of [8 x float] containing the
4779/// concatenated result.
4780static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4781_mm256_set_m128(__m128 __hi, __m128 __lo) {
4782 return (__m256) __builtin_shufflevector((__v4sf)__lo, (__v4sf)__hi, 0, 1, 2, 3, 4, 5, 6, 7);
4783}
4784
4785/// Constructs a 256-bit floating-point vector of [4 x double] by
4786/// concatenating two 128-bit floating-point vectors of [2 x double].
4787///
4788/// \headerfile <x86intrin.h>
4789///
4790/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4791///
4792/// \param __hi
4793/// A 128-bit floating-point vector of [2 x double] to be copied to the upper
4794/// 128 bits of the result.
4795/// \param __lo
4796/// A 128-bit floating-point vector of [2 x double] to be copied to the lower
4797/// 128 bits of the result.
4798/// \returns A 256-bit floating-point vector of [4 x double] containing the
4799/// concatenated result.
4800static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4801_mm256_set_m128d(__m128d __hi, __m128d __lo) {
4802 return (__m256d) __builtin_shufflevector((__v2df)__lo, (__v2df)__hi, 0, 1, 2, 3);
4803}
4804
4805/// Constructs a 256-bit integer vector by concatenating two 128-bit
4806/// integer vectors.
4807///
4808/// \headerfile <x86intrin.h>
4809///
4810/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4811///
4812/// \param __hi
4813/// A 128-bit integer vector to be copied to the upper 128 bits of the
4814/// result.
4815/// \param __lo
4816/// A 128-bit integer vector to be copied to the lower 128 bits of the
4817/// result.
4818/// \returns A 256-bit integer vector containing the concatenated result.
4819static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4820_mm256_set_m128i(__m128i __hi, __m128i __lo) {
4821 return (__m256i) __builtin_shufflevector((__v2di)__lo, (__v2di)__hi, 0, 1, 2, 3);
4822}
4823
4824/// Constructs a 256-bit floating-point vector of [8 x float] by
4825/// concatenating two 128-bit floating-point vectors of [4 x float]. This is
4826/// similar to _mm256_set_m128, but the order of the input parameters is
4827/// swapped.
4828///
4829/// \headerfile <x86intrin.h>
4830///
4831/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4832///
4833/// \param __lo
4834/// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4835/// 128 bits of the result.
4836/// \param __hi
4837/// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4838/// 128 bits of the result.
4839/// \returns A 256-bit floating-point vector of [8 x float] containing the
4840/// concatenated result.
4841static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
4842_mm256_setr_m128(__m128 __lo, __m128 __hi) {
4843 return _mm256_set_m128(__hi, __lo);
4844}
4845
4846/// Constructs a 256-bit floating-point vector of [4 x double] by
4847/// concatenating two 128-bit floating-point vectors of [2 x double]. This is
4848/// similar to _mm256_set_m128d, but the order of the input parameters is
4849/// swapped.
4850///
4851/// \headerfile <x86intrin.h>
4852///
4853/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4854///
4855/// \param __lo
4856/// A 128-bit floating-point vector of [2 x double] to be copied to the lower
4857/// 128 bits of the result.
4858/// \param __hi
4859/// A 128-bit floating-point vector of [2 x double] to be copied to the upper
4860/// 128 bits of the result.
4861/// \returns A 256-bit floating-point vector of [4 x double] containing the
4862/// concatenated result.
4863static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
4864_mm256_setr_m128d(__m128d __lo, __m128d __hi) {
4865 return (__m256d)_mm256_set_m128d(__hi, __lo);
4866}
4867
4868/// Constructs a 256-bit integer vector by concatenating two 128-bit
4869/// integer vectors. This is similar to _mm256_set_m128i, but the order of
4870/// the input parameters is swapped.
4871///
4872/// \headerfile <x86intrin.h>
4873///
4874/// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4875///
4876/// \param __lo
4877/// A 128-bit integer vector to be copied to the lower 128 bits of the
4878/// result.
4879/// \param __hi
4880/// A 128-bit integer vector to be copied to the upper 128 bits of the
4881/// result.
4882/// \returns A 256-bit integer vector containing the concatenated result.
4883static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
4884_mm256_setr_m128i(__m128i __lo, __m128i __hi) {
4885 return (__m256i)_mm256_set_m128i(__hi, __lo);
4886}
4887
4888/* SIMD load ops (unaligned) */
4889/// Loads two 128-bit floating-point vectors of [4 x float] from
4890/// unaligned memory locations and constructs a 256-bit floating-point vector
4891/// of [8 x float] by concatenating the two 128-bit vectors.
4892///
4893/// \headerfile <x86intrin.h>
4894///
4895/// This intrinsic corresponds to load instructions followed by the
4896/// <c> VINSERTF128 </c> instruction.
4897///
4898/// \param __addr_hi
4899/// A pointer to a 128-bit memory location containing 4 consecutive
4900/// single-precision floating-point values. These values are to be copied to
4901/// bits[255:128] of the result. The address of the memory location does not
4902/// have to be aligned.
4903/// \param __addr_lo
4904/// A pointer to a 128-bit memory location containing 4 consecutive
4905/// single-precision floating-point values. These values are to be copied to
4906/// bits[127:0] of the result. The address of the memory location does not
4907/// have to be aligned.
4908/// \returns A 256-bit floating-point vector of [8 x float] containing the
4909/// concatenated result.
4910static __inline __m256 __DEFAULT_FN_ATTRS
4911_mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
4912{
4913 return _mm256_set_m128(_mm_loadu_ps(__addr_hi), _mm_loadu_ps(__addr_lo));
4914}
4915
4916/// Loads two 128-bit floating-point vectors of [2 x double] from
4917/// unaligned memory locations and constructs a 256-bit floating-point vector
4918/// of [4 x double] by concatenating the two 128-bit vectors.
4919///
4920/// \headerfile <x86intrin.h>
4921///
4922/// This intrinsic corresponds to load instructions followed by the
4923/// <c> VINSERTF128 </c> instruction.
4924///
4925/// \param __addr_hi
4926/// A pointer to a 128-bit memory location containing two consecutive
4927/// double-precision floating-point values. These values are to be copied to
4928/// bits[255:128] of the result. The address of the memory location does not
4929/// have to be aligned.
4930/// \param __addr_lo
4931/// A pointer to a 128-bit memory location containing two consecutive
4932/// double-precision floating-point values. These values are to be copied to
4933/// bits[127:0] of the result. The address of the memory location does not
4934/// have to be aligned.
4935/// \returns A 256-bit floating-point vector of [4 x double] containing the
4936/// concatenated result.
4937static __inline __m256d __DEFAULT_FN_ATTRS
4938_mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo)
4939{
4940 return _mm256_set_m128d(_mm_loadu_pd(__addr_hi), _mm_loadu_pd(__addr_lo));
4941}
4942
4943/// Loads two 128-bit integer vectors from unaligned memory locations and
4944/// constructs a 256-bit integer vector by concatenating the two 128-bit
4945/// vectors.
4946///
4947/// \headerfile <x86intrin.h>
4948///
4949/// This intrinsic corresponds to load instructions followed by the
4950/// <c> VINSERTF128 </c> instruction.
4951///
4952/// \param __addr_hi
4953/// A pointer to a 128-bit memory location containing a 128-bit integer
4954/// vector. This vector is to be copied to bits[255:128] of the result. The
4955/// address of the memory location does not have to be aligned.
4956/// \param __addr_lo
4957/// A pointer to a 128-bit memory location containing a 128-bit integer
4958/// vector. This vector is to be copied to bits[127:0] of the result. The
4959/// address of the memory location does not have to be aligned.
4960/// \returns A 256-bit integer vector containing the concatenated result.
4961static __inline __m256i __DEFAULT_FN_ATTRS
4962_mm256_loadu2_m128i(__m128i_u const *__addr_hi, __m128i_u const *__addr_lo)
4963{
4964 return _mm256_set_m128i(_mm_loadu_si128(__addr_hi), _mm_loadu_si128(__addr_lo));
4965}
4966
4967/* SIMD store ops (unaligned) */
4968/// Stores the upper and lower 128 bits of a 256-bit floating-point
4969/// vector of [8 x float] into two different unaligned memory locations.
4970///
4971/// \headerfile <x86intrin.h>
4972///
4973/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
4974/// store instructions.
4975///
4976/// \param __addr_hi
4977/// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
4978/// copied to this memory location. The address of this memory location does
4979/// not have to be aligned.
4980/// \param __addr_lo
4981/// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
4982/// copied to this memory location. The address of this memory location does
4983/// not have to be aligned.
4984/// \param __a
4985/// A 256-bit floating-point vector of [8 x float].
4986static __inline void __DEFAULT_FN_ATTRS
4987_mm256_storeu2_m128(float *__addr_hi, float *__addr_lo, __m256 __a)
4988{
4989 __m128 __v128;
4990
4991 __v128 = _mm256_castps256_ps128(__a);
4992 _mm_storeu_ps(__addr_lo, __v128);
4993 __v128 = _mm256_extractf128_ps(__a, 1);
4994 _mm_storeu_ps(__addr_hi, __v128);
4995}
4996
4997/// Stores the upper and lower 128 bits of a 256-bit floating-point
4998/// vector of [4 x double] into two different unaligned memory locations.
4999///
5000/// \headerfile <x86intrin.h>
5001///
5002/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
5003/// store instructions.
5004///
5005/// \param __addr_hi
5006/// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
5007/// copied to this memory location. The address of this memory location does
5008/// not have to be aligned.
5009/// \param __addr_lo
5010/// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
5011/// copied to this memory location. The address of this memory location does
5012/// not have to be aligned.
5013/// \param __a
5014/// A 256-bit floating-point vector of [4 x double].
5015static __inline void __DEFAULT_FN_ATTRS
5016_mm256_storeu2_m128d(double *__addr_hi, double *__addr_lo, __m256d __a)
5017{
5018 __m128d __v128;
5019
5020 __v128 = _mm256_castpd256_pd128(__a);
5021 _mm_storeu_pd(__addr_lo, __v128);
5022 __v128 = _mm256_extractf128_pd(__a, 1);
5023 _mm_storeu_pd(__addr_hi, __v128);
5024}
5025
5026/// Stores the upper and lower 128 bits of a 256-bit integer vector into
5027/// two different unaligned memory locations.
5028///
5029/// \headerfile <x86intrin.h>
5030///
5031/// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
5032/// store instructions.
5033///
5034/// \param __addr_hi
5035/// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
5036/// copied to this memory location. The address of this memory location does
5037/// not have to be aligned.
5038/// \param __addr_lo
5039/// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
5040/// copied to this memory location. The address of this memory location does
5041/// not have to be aligned.
5042/// \param __a
5043/// A 256-bit integer vector.
5044static __inline void __DEFAULT_FN_ATTRS
5045_mm256_storeu2_m128i(__m128i_u *__addr_hi, __m128i_u *__addr_lo, __m256i __a)
5046{
5047 __m128i __v128;
5048
5049 __v128 = _mm256_castsi256_si128(__a);
5050 _mm_storeu_si128(__addr_lo, __v128);
5051 __v128 = _mm256_extractf128_si256(__a, 1);
5052 _mm_storeu_si128(__addr_hi, __v128);
5053}
5054
5055#undef __DEFAULT_FN_ATTRS
5056#undef __DEFAULT_FN_ATTRS_CONSTEXPR
5057#undef __DEFAULT_FN_ATTRS128
5058#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
5059
5060#endif /* __AVXINTRIN_H */
#define __DEFAULT_FN_ATTRS
static __inline__ vector float vector float vector float __c
Definition altivec.h:4800
static __inline__ vector float vector float __b
Definition altivec.h:578
static __inline__ uint32_t volatile uint32_t * __p
Definition arm_acle.h:57
return __v
Definition arm_acle.h:88
#define __DEFAULT_FN_ATTRS128
#define __DEFAULT_FN_ATTRS128_CONSTEXPR
Definition avx2intrin.h:30
#define __DEFAULT_FN_ATTRS_CONSTEXPR
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_broadcast_sd(double const *__a)
Loads a scalar double-precision floating point value from the specified address pointed to by __a and...
Definition avxintrin.h:3006
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_addsub_ps(__m256 __a, __m256 __b)
Adds the even-indexed values and subtracts the odd-indexed values of two 256-bit vectors of [8 x floa...
Definition avxintrin.h:169
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_broadcast_pd(__m128d const *__a)
Loads the data from a 128-bit vector of [2 x double] from the specified address pointed to by __a and...
Definition avxintrin.h:3050
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu_pd(double *__p, __m256d __a)
Stores double-precision floating point values from a 256-bit vector of [4 x double] to an unaligned m...
Definition avxintrin.h:3256
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_permutevar_pd(__m256d __a, __m256i __c)
Copies the values in a 256-bit vector of [4 x double] as specified by the 256-bit integer vector oper...
Definition avxintrin.h:821
static __inline void __DEFAULT_FN_ATTRS _mm256_stream_pd(void *__a, __m256d __b)
Moves double-precision values from a 256-bit vector of [4 x double] to a 32-byte aligned memory locat...
Definition avxintrin.h:3552
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_movemask_pd(__m256d __a)
Extracts the sign bits of double-precision floating point elements in a 256-bit vector of [4 x double...
Definition avxintrin.h:2926
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_broadcast_ps(__m128 const *__a)
Loads the data from a 128-bit vector of [4 x float] from the specified address pointed to by __a and ...
Definition avxintrin.h:3070
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_zextpd128_pd256(__m128d __a)
Constructs a 256-bit floating-point vector of [4 x double] from a 128-bit floating-point vector of [2...
Definition avxintrin.h:4531
static __inline void __DEFAULT_FN_ATTRS _mm256_store_pd(double *__p, __m256d __a)
Stores double-precision floating point values from a 256-bit vector of [4 x double] to a 32-byte alig...
Definition avxintrin.h:3220
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu_ps(float *__p, __m256 __a)
Stores single-precision floating point values from a 256-bit vector of [8 x float] to an unaligned me...
Definition avxintrin.h:3276
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_movemask_ps(__m256 __a)
Extracts the sign bits of single-precision floating point elements in a 256-bit vector of [8 x float]...
Definition avxintrin.h:2943
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
Loads two 128-bit floating-point vectors of [4 x float] from unaligned memory locations and construct...
Definition avxintrin.h:4911
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_sqrt_ps(__m256 __a)
Calculates the square roots of the values in a 256-bit vector of [8 x float].
Definition avxintrin.h:347
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_maskload_pd(double const *__p, __m256i __m)
Conditionally loads double-precision floating point elements from a memory location pointed to by __p...
Definition avxintrin.h:3366
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_andnot_pd(__m256d __a, __m256d __b)
Performs a bitwise AND of two 256-bit vectors of [4 x double], using the one's complement of the valu...
Definition avxintrin.h:571
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testnzc_pd(__m128d __a, __m128d __b)
Given two 128-bit floating-point vectors of [2 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2577
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_epi32(int __i0, int __i1, int __i2, int __i3, int __i4, int __i5, int __i6, int __i7)
Constructs a 256-bit integer vector initialized with the specified 32-bit integral values.
Definition avxintrin.h:3710
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_zextps128_ps256(__m128 __a)
Constructs a 256-bit floating-point vector of [8 x float] from a 128-bit floating-point vector of [4 ...
Definition avxintrin.h:4548
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testnzc_ps(__m128 __a, __m128 __b)
Given two 128-bit floating-point vectors of [4 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2661
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_sub_pd(__m256d __a, __m256d __b)
Subtracts two 256-bit vectors of [4 x double].
Definition avxintrin.h:116
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_rcp_ps(__m256 __a)
Calculates the reciprocals of the values in a 256-bit vector of [8 x float].
Definition avxintrin.h:380
static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtpd_ps(__m256d __a)
Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4 x float].
Definition avxintrin.h:2186
static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_undefined_ps(void)
Create a 256-bit vector of [8 x float] with undefined values.
Definition avxintrin.h:3600
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_mul_pd(__m256d __a, __m256d __b)
Multiplies two 256-bit vectors of [4 x double].
Definition avxintrin.h:300
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_permutevar_ps(__m256 __a, __m256i __c)
Copies the values stored in a 256-bit vector of [8 x float] as specified by the 256-bit integer vecto...
Definition avxintrin.h:965
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_min_pd(__m256d __a, __m256d __b)
Compares two 256-bit vectors of [4 x double] and returns the lesser of each pair of values.
Definition avxintrin.h:263
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_ps(float __a, float __b, float __c, float __d, float __e, float __f, float __g, float __h)
Constructs a 256-bit floating-point vector of [8 x float], initialized in reverse order with the spec...
Definition avxintrin.h:3945
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_m128(__m128 __lo, __m128 __hi)
Constructs a 256-bit floating-point vector of [8 x float] by concatenating two 128-bit floating-point...
Definition avxintrin.h:4842
static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtpd_epi32(__m256d __a)
Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4 x i32].
Definition avxintrin.h:2258
static __inline __m128 __DEFAULT_FN_ATTRS128 _mm_maskload_ps(float const *__p, __m128i __m)
Conditionally loads single-precision floating point elements from a memory location pointed to by __p...
Definition avxintrin.h:3391
static __inline __m128d __DEFAULT_FN_ATTRS128 _mm_maskload_pd(double const *__p, __m128i __m)
Conditionally loads double-precision floating point elements from a memory location pointed to by __p...
Definition avxintrin.h:3342
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castpd_si256(__m256d __a)
Casts a 256-bit floating-point vector of [4 x double] into a 256-bit integer vector.
Definition avxintrin.h:4329
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_max_ps(__m256 __a, __m256 __b)
Compares two 256-bit vectors of [8 x float] and returns the greater of each pair of values.
Definition avxintrin.h:242
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_div_pd(__m256d __a, __m256d __b)
Divides two 256-bit vectors of [4 x double].
Definition avxintrin.h:186
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_m128i(__m128i __lo, __m128i __hi)
Constructs a 256-bit integer vector by concatenating two 128-bit integer vectors.
Definition avxintrin.h:4884
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu_si256(__m256i_u *__p, __m256i __a)
Stores integer values from a 256-bit integer vector to an unaligned memory location pointed to by __p...
Definition avxintrin.h:3314
#define _mm256_extractf128_ps(V, M)
Extracts either the upper or the lower 128 bits from a 256-bit vector of [8 x float],...
Definition avxintrin.h:4714
#define _mm256_extractf128_si256(V, M)
Extracts either the upper or the lower 128 bits from a 256-bit integer vector, as determined by the i...
Definition avxintrin.h:4762
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_load_si256(__m256i const *__p)
Loads 256 bits of integer data from a 32-byte aligned memory location pointed to by __p into elements...
Definition avxintrin.h:3163
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castsi256_ps(__m256i __a)
Casts a 256-bit integer vector into a 256-bit floating-point vector of [8 x float].
Definition avxintrin.h:4380
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castpd_ps(__m256d __a)
Casts a 256-bit floating-point vector of [4 x double] into a 256-bit floating-point vector of [8 x fl...
Definition avxintrin.h:4312
static __inline float __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtss_f32(__m256 __a)
Returns the first element of the input vector of [8 x float].
Definition avxintrin.h:2323
static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvttpd_epi32(__m256d __a)
Converts a 256-bit vector of [4 x double] into four signed truncated (rounded toward zero) 32-bit int...
Definition avxintrin.h:2239
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_pd(double __a, double __b, double __c, double __d)
Constructs a 256-bit floating-point vector of [4 x double] initialized with the specified double-prec...
Definition avxintrin.h:3639
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_movehdup_ps(__m256 __a)
Moves and duplicates odd-indexed values from a 256-bit vector of [8 x float] to float values in a 256...
Definition avxintrin.h:2348
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_m128d(__m128d __lo, __m128d __hi)
Constructs a 256-bit floating-point vector of [4 x double] by concatenating two 128-bit floating-poin...
Definition avxintrin.h:4864
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_sub_ps(__m256 __a, __m256 __b)
Subtracts two 256-bit vectors of [8 x float].
Definition avxintrin.h:132
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
Merges 64-bit double-precision data values stored in either of the two 256-bit vectors of [4 x double...
Definition avxintrin.h:1388
static __inline void __DEFAULT_FN_ATTRS _mm256_stream_si256(void *__a, __m256i __b)
Moves integer data from a 256-bit integer vector to a 32-byte aligned memory location.
Definition avxintrin.h:3532
static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_undefined_pd(void)
Create a 256-bit vector of [4 x double] with undefined values.
Definition avxintrin.h:3588
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hsub_ps(__m256 __a, __m256 __b)
Horizontally subtracts the adjacent pairs of values contained in two 256-bit vectors of [8 x float].
Definition avxintrin.h:753
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_rsqrt_ps(__m256 __a)
Calculates the reciprocal square roots of the values in a 256-bit vector of [8 x float].
Definition avxintrin.h:363
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_epi16(short __w15, short __w14, short __w13, short __w12, short __w11, short __w10, short __w09, short __w08, short __w07, short __w06, short __w05, short __w04, short __w03, short __w02, short __w01, short __w00)
Constructs a 256-bit integer vector initialized with the specified 16-bit integral values.
Definition avxintrin.h:3758
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtepi32_ps(__m256i __a)
Converts a vector of [8 x i32] into a vector of [8 x float].
Definition avxintrin.h:2171
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_andnot_ps(__m256 __a, __m256 __b)
Performs a bitwise AND of two 256-bit vectors of [8 x float], using the one's complement of the value...
Definition avxintrin.h:592
static __inline void __DEFAULT_FN_ATTRS128 _mm_maskstore_pd(double *__p, __m128i __m, __m128d __a)
Moves double-precision values from a 128-bit vector of [2 x double] to a memory location pointed to b...
Definition avxintrin.h:3464
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_castpd128_pd256(__m128d __a)
Constructs a 256-bit floating-point vector of [4 x double] from a 128-bit floating-point vector of [2...
Definition avxintrin.h:4468
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_pd(double __w)
Constructs a 256-bit floating-point vector of [4 x double], with each of the four double-precision fl...
Definition avxintrin.h:4162
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_unpacklo_ps(__m256 __a, __m256 __b)
Unpacks the 32-bit vector elements 0, 1, 4 and 5 from each of the two 256-bit vectors of [8 x float] ...
Definition avxintrin.h:2491
static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_undefined_si256(void)
Create a 256-bit integer vector with undefined values.
Definition avxintrin.h:3612
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtps_pd(__m128 __a)
Converts a 128-bit vector of [4 x float] into a 256-bit vector of [4 x double].
Definition avxintrin.h:2219
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_ps(float __w)
Constructs a 256-bit floating-point vector of [8 x float], with each of the eight single-precision fl...
Definition avxintrin.h:4181
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_unpackhi_ps(__m256 __a, __m256 __b)
Unpacks the 32-bit vector elements 2, 3, 6 and 7 from each of the two 256-bit vectors of [8 x float] ...
Definition avxintrin.h:2465
static __inline __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_permutevar_pd(__m128d __a, __m128i __c)
Copies the values in a 128-bit vector of [2 x double] as specified by the 128-bit integer vector oper...
Definition avxintrin.h:783
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_load_ps(float const *__p)
Loads 8 single-precision floating point values from a 32-byte aligned memory location pointed to by _...
Definition avxintrin.h:3106
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtepi32_pd(__m128i __a)
Converts a vector of [4 x i32] into a vector of [4 x double].
Definition avxintrin.h:2157
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testz_si256(__m256i __a, __m256i __b)
Given two 256-bit integer vectors, perform a bit-by-bit comparison of the two source vectors.
Definition avxintrin.h:2857
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testz_ps(__m128 __a, __m128 __b)
Given two 128-bit floating-point vectors of [4 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2604
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtsi256_si32(__m256i __a)
Returns the first element of the input vector of [8 x i32].
Definition avxintrin.h:2307
#define _mm256_extractf128_pd(V, M)
Extracts either the upper or the lower 128 bits from a 256-bit vector of [4 x double],...
Definition avxintrin.h:4738
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_castps128_ps256(__m128 __a)
Constructs a 256-bit floating-point vector of [8 x float] from a 128-bit floating-point vector of [4 ...
Definition avxintrin.h:4490
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_broadcast_ss(float const *__a)
Loads a scalar single-precision floating point value from the specified address pointed to by __a and...
Definition avxintrin.h:3028
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtps_epi32(__m256 __a)
Converts a vector of [8 x float] into a vector of [8 x i32].
Definition avxintrin.h:2204
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testz_pd(__m256d __a, __m256d __b)
Given two 256-bit floating-point vectors of [4 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2689
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setzero_ps(void)
Constructs a 256-bit floating-point vector of [8 x float] with all vector elements initialized to zer...
Definition avxintrin.h:4283
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_epi32(int __i)
Constructs a 256-bit integer vector of [8 x i32], with each of the 32-bit integral vector elements se...
Definition avxintrin.h:4200
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_epi8(char __b31, char __b30, char __b29, char __b28, char __b27, char __b26, char __b25, char __b24, char __b23, char __b22, char __b21, char __b20, char __b19, char __b18, char __b17, char __b16, char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b09, char __b08, char __b07, char __b06, char __b05, char __b04, char __b03, char __b02, char __b01, char __b00)
Constructs a 256-bit integer vector initialized with the specified 8-bit integral values.
Definition avxintrin.h:3841
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testc_ps(__m128 __a, __m128 __b)
Given two 128-bit floating-point vectors of [4 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2632
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo)
Loads two 128-bit floating-point vectors of [2 x double] from unaligned memory locations and construc...
Definition avxintrin.h:4938
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_add_pd(__m256d __a, __m256d __b)
Adds two 256-bit vectors of [4 x double].
Definition avxintrin.h:82
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testnzc_si256(__m256i __a, __m256i __b)
Given two 256-bit integer vectors, perform a bit-by-bit comparison of the two source vectors.
Definition avxintrin.h:2908
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_xor_ps(__m256 __a, __m256 __b)
Performs a bitwise XOR of two 256-bit vectors of [8 x float].
Definition avxintrin.h:664
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu2_m128d(double *__addr_hi, double *__addr_lo, __m256d __a)
Stores the upper and lower 128 bits of a 256-bit floating-point vector of [4 x double] into two diffe...
Definition avxintrin.h:5016
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_sqrt_pd(__m256d __a)
Calculates the square roots of the values in a 256-bit vector of [4 x double].
Definition avxintrin.h:332
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testnzc_pd(__m256d __a, __m256d __b)
Given two 256-bit floating-point vectors of [4 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2747
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testz_ps(__m256 __a, __m256 __b)
Given two 256-bit floating-point vectors of [8 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2774
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hadd_pd(__m256d __a, __m256d __b)
Horizontally adds the adjacent pairs of values contained in two 256-bit vectors of [4 x double].
Definition avxintrin.h:688
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
Constructs a 256-bit integer vector, initialized in reverse order with the specified 64-bit integral ...
Definition avxintrin.h:4143
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_epi64x(long long __q)
Constructs a 256-bit integer vector of [4 x i64], with each of the 64-bit integral vector elements se...
Definition avxintrin.h:4257
static __inline void __DEFAULT_FN_ATTRS _mm256_maskstore_pd(double *__p, __m256i __m, __m256d __a)
Moves double-precision values from a 256-bit vector of [4 x double] to a memory location pointed to b...
Definition avxintrin.h:3488
static __inline void __DEFAULT_FN_ATTRS _mm256_maskstore_ps(float *__p, __m256i __m, __m256 __a)
Moves single-precision floating point values from a 256-bit vector of [8 x float] to a memory locatio...
Definition avxintrin.h:3440
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28, char __b27, char __b26, char __b25, char __b24, char __b23, char __b22, char __b21, char __b20, char __b19, char __b18, char __b17, char __b16, char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b09, char __b08, char __b07, char __b06, char __b05, char __b04, char __b03, char __b02, char __b01, char __b00)
Constructs a 256-bit integer vector, initialized in reverse order with the specified 8-bit integral v...
Definition avxintrin.h:4110
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castsi256_pd(__m256i __a)
Casts a 256-bit integer vector into a 256-bit floating-point vector of [4 x double].
Definition avxintrin.h:4397
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_loadu_pd(double const *__p)
Loads 4 double-precision floating point values from an unaligned memory location pointed to by __p in...
Definition avxintrin.h:3123
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_max_pd(__m256d __a, __m256d __b)
Compares two 256-bit vectors of [4 x double] and returns the greater of each pair of values.
Definition avxintrin.h:223
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_ps(float __a, float __b, float __c, float __d, float __e, float __f, float __g, float __h)
Constructs a 256-bit floating-point vector of [8 x float] initialized with the specified single-preci...
Definition avxintrin.h:3678
static __inline __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castpd256_pd128(__m256d __a)
Returns the lower 128 bits of a 256-bit floating-point vector of [4 x double] as a 128-bit floating-p...
Definition avxintrin.h:4414
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_zextsi128_si256(__m128i __a)
Constructs a 256-bit integer vector from a 128-bit integer vector.
Definition avxintrin.h:4565
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_add_ps(__m256 __a, __m256 __b)
Adds two 256-bit vectors of [8 x float].
Definition avxintrin.h:98
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12, short __w11, short __w10, short __w09, short __w08, short __w07, short __w06, short __w05, short __w04, short __w03, short __w02, short __w01, short __w00)
Constructs a 256-bit integer vector, initialized in reverse order with the specified 16-bit integral ...
Definition avxintrin.h:4025
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_moveldup_ps(__m256 __a)
Moves and duplicates even-indexed values from a 256-bit vector of [8 x float] to float values in a 25...
Definition avxintrin.h:2373
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_movedup_pd(__m256d __a)
Moves and duplicates double-precision floating point values from a 256-bit vector of [4 x double] to ...
Definition avxintrin.h:2395
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu2_m128i(__m128i_u *__addr_hi, __m128i_u *__addr_lo, __m256i __a)
Stores the upper and lower 128 bits of a 256-bit integer vector into two different unaligned memory l...
Definition avxintrin.h:5045
static __inline __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castps256_ps128(__m256 __a)
Returns the lower 128 bits of a 256-bit floating-point vector of [8 x float] as a 128-bit floating-po...
Definition avxintrin.h:4431
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_or_pd(__m256d __a, __m256d __b)
Performs a bitwise OR of two 256-bit vectors of [4 x double].
Definition avxintrin.h:610
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castps_si256(__m256 __a)
Casts a 256-bit floating-point vector of [8 x float] into a 256-bit integer vector.
Definition avxintrin.h:4363
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testc_ps(__m256 __a, __m256 __b)
Given two 256-bit floating-point vectors of [8 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2802
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hadd_ps(__m256 __a, __m256 __b)
Horizontally adds the adjacent pairs of values contained in two 256-bit vectors of [8 x float].
Definition avxintrin.h:709
static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_permutevar_ps(__m128 __a, __m128i __c)
Copies the values stored in a 128-bit vector of [4 x float] as specified by the 128-bit integer vecto...
Definition avxintrin.h:875
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_xor_pd(__m256d __a, __m256d __b)
Performs a bitwise XOR of two 256-bit vectors of [4 x double].
Definition avxintrin.h:646
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_or_ps(__m256 __a, __m256 __b)
Performs a bitwise OR of two 256-bit vectors of [8 x float].
Definition avxintrin.h:628
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_addsub_pd(__m256d __a, __m256d __b)
Adds the even-indexed values and subtracts the odd-indexed values of two 256-bit vectors of [4 x doub...
Definition avxintrin.h:151
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvttps_epi32(__m256 __a)
Converts a vector of [8 x float] into eight signed truncated (rounded toward zero) 32-bit integers re...
Definition avxintrin.h:2277
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_hsub_pd(__m256d __a, __m256d __b)
Horizontally subtracts the adjacent pairs of values contained in two 256-bit vectors of [4 x double].
Definition avxintrin.h:732
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
Merges 32-bit single-precision data values stored in either of the two 256-bit vectors of [8 x float]...
Definition avxintrin.h:1415
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_loadu2_m128i(__m128i_u const *__addr_hi, __m128i_u const *__addr_lo)
Loads two 128-bit integer vectors from unaligned memory locations and constructs a 256-bit integer ve...
Definition avxintrin.h:4962
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testz_pd(__m128d __a, __m128d __b)
Given two 128-bit floating-point vectors of [2 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2519
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testnzc_ps(__m256 __a, __m256 __b)
Given two 256-bit floating-point vectors of [8 x float], perform an element-by-element comparison of ...
Definition avxintrin.h:2831
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setzero_pd(void)
Constructs a 256-bit floating-point vector of [4 x double] with all vector elements initialized to ze...
Definition avxintrin.h:4271
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
Constructs a 256-bit integer vector initialized with the specified 64-bit integral values.
Definition avxintrin.h:3876
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_maskload_ps(float const *__p, __m256i __m)
Conditionally loads single-precision floating point elements from a memory location pointed to by __p...
Definition avxintrin.h:3415
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_mul_ps(__m256 __a, __m256 __b)
Multiplies two 256-bit vectors of [8 x float].
Definition avxintrin.h:316
static __inline void __DEFAULT_FN_ATTRS _mm256_stream_ps(void *__p, __m256 __a)
Moves single-precision floating point values from a 256-bit vector of [8 x float] to a 32-byte aligne...
Definition avxintrin.h:3573
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_and_ps(__m256 __a, __m256 __b)
Performs a bitwise AND of two 256-bit vectors of [8 x float].
Definition avxintrin.h:550
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_loadu_si256(__m256i_u const *__p)
Loads 256 bits of integer data from an unaligned memory location pointed to by __p into a 256-bit int...
Definition avxintrin.h:3179
static __inline void __DEFAULT_FN_ATTRS _mm256_store_si256(__m256i *__p, __m256i __a)
Stores integer values from a 256-bit integer vector to a 32-byte aligned memory location pointed to b...
Definition avxintrin.h:3297
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_m128(__m128 __hi, __m128 __lo)
Constructs a 256-bit floating-point vector of [8 x float] by concatenating two 128-bit floating-point...
Definition avxintrin.h:4781
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_min_ps(__m256 __a, __m256 __b)
Compares two 256-bit vectors of [8 x float] and returns the lesser of each pair of values.
Definition avxintrin.h:282
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castps_pd(__m256 __a)
Casts a 256-bit floating-point vector of [8 x float] into a 256-bit floating-point vector of [4 x dou...
Definition avxintrin.h:4346
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setzero_si256(void)
Constructs a 256-bit integer vector initialized to zero.
Definition avxintrin.h:4295
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_castsi128_si256(__m128i __a)
Constructs a 256-bit integer vector from a 128-bit integer vector.
Definition avxintrin.h:4511
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_div_ps(__m256 __a, __m256 __b)
Divides two 256-bit vectors of [8 x float].
Definition avxintrin.h:202
static __inline __m256 __DEFAULT_FN_ATTRS _mm256_loadu_ps(float const *__p)
Loads 8 single-precision floating point values from an unaligned memory location pointed to by __p in...
Definition avxintrin.h:3143
static __inline __m128 __DEFAULT_FN_ATTRS128 _mm_broadcast_ss(float const *__a)
Loads a scalar single-precision floating point value from the specified address pointed to by __a and...
Definition avxintrin.h:2984
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3, int __i4, int __i5, int __i6, int __i7)
Constructs a 256-bit integer vector, initialized in reverse order with the specified 32-bit integral ...
Definition avxintrin.h:3977
static __inline int __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_testc_pd(__m128d __a, __m128d __b)
Given two 128-bit floating-point vectors of [2 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2547
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_unpacklo_pd(__m256d __a, __m256d __b)
Unpacks the even-indexed vector elements from two 256-bit vectors of [4 x double] and interleaves the...
Definition avxintrin.h:2439
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_unpackhi_pd(__m256d __a, __m256d __b)
Unpacks the odd-indexed vector elements from two 256-bit vectors of [4 x double] and interleaves them...
Definition avxintrin.h:2418
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_epi16(short __w)
Constructs a 256-bit integer vector of [16 x i16], with each of the 16-bit integral vector elements s...
Definition avxintrin.h:4218
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_epi8(char __b)
Constructs a 256-bit integer vector of [32 x i8], with each of the 8-bit integral vector elements set...
Definition avxintrin.h:4236
static __inline __m128i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_castsi256_si128(__m256i __a)
Truncates a 256-bit integer vector into a 128-bit integer vector.
Definition avxintrin.h:4447
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testc_pd(__m256d __a, __m256d __b)
Given two 256-bit floating-point vectors of [4 x double], perform an element-by-element comparison of...
Definition avxintrin.h:2717
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_lddqu_si256(__m256i_u const *__p)
Loads 256 bits of integer data from an unaligned memory location pointed to by __p into a 256-bit int...
Definition avxintrin.h:3200
static __inline int __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_testc_si256(__m256i __a, __m256i __b)
Given two 256-bit integer vectors, perform a bit-by-bit comparison of the two source vectors.
Definition avxintrin.h:2882
static __inline double __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_cvtsd_f64(__m256d __a)
Returns the first element of the input vector of [4 x double].
Definition avxintrin.h:2292
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_m128i(__m128i __hi, __m128i __lo)
Constructs a 256-bit integer vector by concatenating two 128-bit integer vectors.
Definition avxintrin.h:4820
static __inline void __DEFAULT_FN_ATTRS _mm256_store_ps(float *__p, __m256 __a)
Stores single-precision floating point values from a 256-bit vector of [8 x float] to a 32-byte align...
Definition avxintrin.h:3238
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setr_pd(double __a, double __b, double __c, double __d)
Constructs a 256-bit floating-point vector of [4 x double], initialized in reverse order with the spe...
Definition avxintrin.h:3905
static __inline void __DEFAULT_FN_ATTRS _mm256_storeu2_m128(float *__addr_hi, float *__addr_lo, __m256 __a)
Stores the upper and lower 128 bits of a 256-bit floating-point vector of [8 x float] into two differ...
Definition avxintrin.h:4987
double __v4df __attribute__((__vector_size__(32)))
Definition avxintrin.h:17
static __inline void __DEFAULT_FN_ATTRS128 _mm_maskstore_ps(float *__p, __m128i __m, __m128 __a)
Moves single-precision floating point values from a 128-bit vector of [4 x float] to a memory locatio...
Definition avxintrin.h:3512
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_m128d(__m128d __hi, __m128d __lo)
Constructs a 256-bit floating-point vector of [4 x double] by concatenating two 128-bit floating-poin...
Definition avxintrin.h:4801
static __inline __m256d __DEFAULT_FN_ATTRS _mm256_load_pd(double const *__p)
Loads 4 double-precision floating point values from a 32-byte aligned memory location pointed to by _...
Definition avxintrin.h:3090
static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_and_pd(__m256d __a, __m256d __b)
Performs a bitwise AND of two 256-bit vectors of [4 x double].
Definition avxintrin.h:532
static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_loadu_pd(double const *__dp)
Loads a 128-bit floating-point vector of [2 x double] from an unaligned memory location.
Definition emmintrin.h:1624
static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR _mm_setzero_si128(void)
Creates a 128-bit integer vector initialized to zero.
Definition emmintrin.h:3887
static __inline__ void int __a
Definition emmintrin.h:4086
static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_setzero_pd(void)
Constructs a 128-bit floating-point vector of [2 x double] initialized to zero.
Definition emmintrin.h:1872
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_loadu_si128(__m128i_u const *__p)
Moves packed integer values from an unaligned 128-bit memory location to elements in a 128-bit intege...
Definition emmintrin.h:3465
static __inline__ void __DEFAULT_FN_ATTRS _mm_storeu_pd(double *__dp, __m128d __a)
Stores a 128-bit vector of [2 x double] into an unaligned memory location.
Definition emmintrin.h:1985
static __inline__ void __DEFAULT_FN_ATTRS _mm_storeu_si128(__m128i_u *__p, __m128i __b)
Stores a 128-bit integer vector to an unaligned memory location.
Definition emmintrin.h:3918
static __inline__ void __DEFAULT_FN_ATTRS _mm_storeu_ps(float *__p, __m128 __a)
Stores a 128-bit vector of [4 x float] to an unaligned memory location.
Definition xmmintrin.h:2079
static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_setzero_ps(void)
Constructs a 128-bit floating-point vector of [4 x float] initialized to zero.
Definition xmmintrin.h:2000
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_loadu_ps(const float *__p)
Loads a 128-bit floating-point vector of [4 x float] from an unaligned memory location.
Definition xmmintrin.h:1842