1 /*===---- avxintrin.h - AVX intrinsics -------------------------------------===
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
7 *===-----------------------------------------------------------------------===
11 #error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
17 typedef double __v4df __attribute__ ((__vector_size__ (32)));
18 typedef float __v8sf __attribute__ ((__vector_size__ (32)));
19 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
20 typedef int __v8si __attribute__ ((__vector_size__ (32)));
21 typedef short __v16hi __attribute__ ((__vector_size__ (32)));
22 typedef char __v32qi __attribute__ ((__vector_size__ (32)));
25 typedef unsigned long long __v4du __attribute__ ((__vector_size__ (32)));
26 typedef unsigned int __v8su __attribute__ ((__vector_size__ (32)));
27 typedef unsigned short __v16hu __attribute__ ((__vector_size__ (32)));
28 typedef unsigned char __v32qu __attribute__ ((__vector_size__ (32)));
30 /* We need an explicitly signed variant for char. Note that this shouldn't
31 * appear in the interface though. */
32 typedef signed char __v32qs __attribute__((__vector_size__(32)));
34 typedef float __m256 __attribute__ ((__vector_size__ (32), __aligned__(32)));
35 typedef double __m256d __attribute__((__vector_size__(32), __aligned__(32)));
36 typedef long long __m256i __attribute__((__vector_size__(32), __aligned__(32)));
38 typedef float __m256_u __attribute__ ((__vector_size__ (32), __aligned__(1)));
39 typedef double __m256d_u __attribute__((__vector_size__(32), __aligned__(1)));
40 typedef long long __m256i_u __attribute__((__vector_size__(32), __aligned__(1)));
42 /* Define the default attributes for the functions in this file. */
43 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx"), __min_vector_width__(256)))
44 #define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx"), __min_vector_width__(128)))
47 /// Adds two 256-bit vectors of [4 x double].
49 /// \headerfile <x86intrin.h>
51 /// This intrinsic corresponds to the <c> VADDPD </c> instruction.
54 /// A 256-bit vector of [4 x double] containing one of the source operands.
56 /// A 256-bit vector of [4 x double] containing one of the source operands.
57 /// \returns A 256-bit vector of [4 x double] containing the sums of both
59 static __inline __m256d __DEFAULT_FN_ATTRS
60 _mm256_add_pd(__m256d __a, __m256d __b)
62 return (__m256d)((__v4df)__a+(__v4df)__b);
65 /// Adds two 256-bit vectors of [8 x float].
67 /// \headerfile <x86intrin.h>
69 /// This intrinsic corresponds to the <c> VADDPS </c> instruction.
72 /// A 256-bit vector of [8 x float] containing one of the source operands.
74 /// A 256-bit vector of [8 x float] containing one of the source operands.
75 /// \returns A 256-bit vector of [8 x float] containing the sums of both
77 static __inline __m256 __DEFAULT_FN_ATTRS
78 _mm256_add_ps(__m256 __a, __m256 __b)
80 return (__m256)((__v8sf)__a+(__v8sf)__b);
83 /// Subtracts two 256-bit vectors of [4 x double].
85 /// \headerfile <x86intrin.h>
87 /// This intrinsic corresponds to the <c> VSUBPD </c> instruction.
90 /// A 256-bit vector of [4 x double] containing the minuend.
92 /// A 256-bit vector of [4 x double] containing the subtrahend.
93 /// \returns A 256-bit vector of [4 x double] containing the differences between
95 static __inline __m256d __DEFAULT_FN_ATTRS
96 _mm256_sub_pd(__m256d __a, __m256d __b)
98 return (__m256d)((__v4df)__a-(__v4df)__b);
101 /// Subtracts two 256-bit vectors of [8 x float].
103 /// \headerfile <x86intrin.h>
105 /// This intrinsic corresponds to the <c> VSUBPS </c> instruction.
108 /// A 256-bit vector of [8 x float] containing the minuend.
110 /// A 256-bit vector of [8 x float] containing the subtrahend.
111 /// \returns A 256-bit vector of [8 x float] containing the differences between
113 static __inline __m256 __DEFAULT_FN_ATTRS
114 _mm256_sub_ps(__m256 __a, __m256 __b)
116 return (__m256)((__v8sf)__a-(__v8sf)__b);
119 /// Adds the even-indexed values and subtracts the odd-indexed values of
120 /// two 256-bit vectors of [4 x double].
122 /// \headerfile <x86intrin.h>
124 /// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction.
127 /// A 256-bit vector of [4 x double] containing the left source operand.
129 /// A 256-bit vector of [4 x double] containing the right source operand.
130 /// \returns A 256-bit vector of [4 x double] containing the alternating sums
131 /// and differences between both operands.
132 static __inline __m256d __DEFAULT_FN_ATTRS
133 _mm256_addsub_pd(__m256d __a, __m256d __b)
135 return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
138 /// Adds the even-indexed values and subtracts the odd-indexed values of
139 /// two 256-bit vectors of [8 x float].
141 /// \headerfile <x86intrin.h>
143 /// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction.
146 /// A 256-bit vector of [8 x float] containing the left source operand.
148 /// A 256-bit vector of [8 x float] containing the right source operand.
149 /// \returns A 256-bit vector of [8 x float] containing the alternating sums and
150 /// differences between both operands.
151 static __inline __m256 __DEFAULT_FN_ATTRS
152 _mm256_addsub_ps(__m256 __a, __m256 __b)
154 return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
157 /// Divides two 256-bit vectors of [4 x double].
159 /// \headerfile <x86intrin.h>
161 /// This intrinsic corresponds to the <c> VDIVPD </c> instruction.
164 /// A 256-bit vector of [4 x double] containing the dividend.
166 /// A 256-bit vector of [4 x double] containing the divisor.
167 /// \returns A 256-bit vector of [4 x double] containing the quotients of both
169 static __inline __m256d __DEFAULT_FN_ATTRS
170 _mm256_div_pd(__m256d __a, __m256d __b)
172 return (__m256d)((__v4df)__a/(__v4df)__b);
175 /// Divides two 256-bit vectors of [8 x float].
177 /// \headerfile <x86intrin.h>
179 /// This intrinsic corresponds to the <c> VDIVPS </c> instruction.
182 /// A 256-bit vector of [8 x float] containing the dividend.
184 /// A 256-bit vector of [8 x float] containing the divisor.
185 /// \returns A 256-bit vector of [8 x float] containing the quotients of both
187 static __inline __m256 __DEFAULT_FN_ATTRS
188 _mm256_div_ps(__m256 __a, __m256 __b)
190 return (__m256)((__v8sf)__a/(__v8sf)__b);
193 /// Compares two 256-bit vectors of [4 x double] and returns the greater
194 /// of each pair of values.
196 /// \headerfile <x86intrin.h>
198 /// This intrinsic corresponds to the <c> VMAXPD </c> instruction.
201 /// A 256-bit vector of [4 x double] containing one of the operands.
203 /// A 256-bit vector of [4 x double] containing one of the operands.
204 /// \returns A 256-bit vector of [4 x double] containing the maximum values
205 /// between both operands.
206 static __inline __m256d __DEFAULT_FN_ATTRS
207 _mm256_max_pd(__m256d __a, __m256d __b)
209 return (__m256d)__builtin_ia32_maxpd256((__v4df)__a, (__v4df)__b);
212 /// Compares two 256-bit vectors of [8 x float] and returns the greater
213 /// of each pair of values.
215 /// \headerfile <x86intrin.h>
217 /// This intrinsic corresponds to the <c> VMAXPS </c> instruction.
220 /// A 256-bit vector of [8 x float] containing one of the operands.
222 /// A 256-bit vector of [8 x float] containing one of the operands.
223 /// \returns A 256-bit vector of [8 x float] containing the maximum values
224 /// between both operands.
225 static __inline __m256 __DEFAULT_FN_ATTRS
226 _mm256_max_ps(__m256 __a, __m256 __b)
228 return (__m256)__builtin_ia32_maxps256((__v8sf)__a, (__v8sf)__b);
231 /// Compares two 256-bit vectors of [4 x double] and returns the lesser
232 /// of each pair of values.
234 /// \headerfile <x86intrin.h>
236 /// This intrinsic corresponds to the <c> VMINPD </c> instruction.
239 /// A 256-bit vector of [4 x double] containing one of the operands.
241 /// A 256-bit vector of [4 x double] containing one of the operands.
242 /// \returns A 256-bit vector of [4 x double] containing the minimum values
243 /// between both operands.
244 static __inline __m256d __DEFAULT_FN_ATTRS
245 _mm256_min_pd(__m256d __a, __m256d __b)
247 return (__m256d)__builtin_ia32_minpd256((__v4df)__a, (__v4df)__b);
250 /// Compares two 256-bit vectors of [8 x float] and returns the lesser
251 /// of each pair of values.
253 /// \headerfile <x86intrin.h>
255 /// This intrinsic corresponds to the <c> VMINPS </c> instruction.
258 /// A 256-bit vector of [8 x float] containing one of the operands.
260 /// A 256-bit vector of [8 x float] containing one of the operands.
261 /// \returns A 256-bit vector of [8 x float] containing the minimum values
262 /// between both operands.
263 static __inline __m256 __DEFAULT_FN_ATTRS
264 _mm256_min_ps(__m256 __a, __m256 __b)
266 return (__m256)__builtin_ia32_minps256((__v8sf)__a, (__v8sf)__b);
269 /// Multiplies two 256-bit vectors of [4 x double].
271 /// \headerfile <x86intrin.h>
273 /// This intrinsic corresponds to the <c> VMULPD </c> instruction.
276 /// A 256-bit vector of [4 x double] containing one of the operands.
278 /// A 256-bit vector of [4 x double] containing one of the operands.
279 /// \returns A 256-bit vector of [4 x double] containing the products of both
281 static __inline __m256d __DEFAULT_FN_ATTRS
282 _mm256_mul_pd(__m256d __a, __m256d __b)
284 return (__m256d)((__v4df)__a * (__v4df)__b);
287 /// Multiplies two 256-bit vectors of [8 x float].
289 /// \headerfile <x86intrin.h>
291 /// This intrinsic corresponds to the <c> VMULPS </c> instruction.
294 /// A 256-bit vector of [8 x float] containing one of the operands.
296 /// A 256-bit vector of [8 x float] containing one of the operands.
297 /// \returns A 256-bit vector of [8 x float] containing the products of both
299 static __inline __m256 __DEFAULT_FN_ATTRS
300 _mm256_mul_ps(__m256 __a, __m256 __b)
302 return (__m256)((__v8sf)__a * (__v8sf)__b);
305 /// Calculates the square roots of the values in a 256-bit vector of
308 /// \headerfile <x86intrin.h>
310 /// This intrinsic corresponds to the <c> VSQRTPD </c> instruction.
313 /// A 256-bit vector of [4 x double].
314 /// \returns A 256-bit vector of [4 x double] containing the square roots of the
315 /// values in the operand.
316 static __inline __m256d __DEFAULT_FN_ATTRS
317 _mm256_sqrt_pd(__m256d __a)
319 return (__m256d)__builtin_ia32_sqrtpd256((__v4df)__a);
322 /// Calculates the square roots of the values in a 256-bit vector of
325 /// \headerfile <x86intrin.h>
327 /// This intrinsic corresponds to the <c> VSQRTPS </c> instruction.
330 /// A 256-bit vector of [8 x float].
331 /// \returns A 256-bit vector of [8 x float] containing the square roots of the
332 /// values in the operand.
333 static __inline __m256 __DEFAULT_FN_ATTRS
334 _mm256_sqrt_ps(__m256 __a)
336 return (__m256)__builtin_ia32_sqrtps256((__v8sf)__a);
339 /// Calculates the reciprocal square roots of the values in a 256-bit
340 /// vector of [8 x float].
342 /// \headerfile <x86intrin.h>
344 /// This intrinsic corresponds to the <c> VRSQRTPS </c> instruction.
347 /// A 256-bit vector of [8 x float].
348 /// \returns A 256-bit vector of [8 x float] containing the reciprocal square
349 /// roots of the values in the operand.
350 static __inline __m256 __DEFAULT_FN_ATTRS
351 _mm256_rsqrt_ps(__m256 __a)
353 return (__m256)__builtin_ia32_rsqrtps256((__v8sf)__a);
356 /// Calculates the reciprocals of the values in a 256-bit vector of
359 /// \headerfile <x86intrin.h>
361 /// This intrinsic corresponds to the <c> VRCPPS </c> instruction.
364 /// A 256-bit vector of [8 x float].
365 /// \returns A 256-bit vector of [8 x float] containing the reciprocals of the
366 /// values in the operand.
367 static __inline __m256 __DEFAULT_FN_ATTRS
368 _mm256_rcp_ps(__m256 __a)
370 return (__m256)__builtin_ia32_rcpps256((__v8sf)__a);
373 /// Rounds the values in a 256-bit vector of [4 x double] as specified
374 /// by the byte operand. The source values are rounded to integer values and
375 /// returned as 64-bit double-precision floating-point values.
377 /// \headerfile <x86intrin.h>
380 /// __m256d _mm256_round_pd(__m256d V, const int M);
383 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
386 /// A 256-bit vector of [4 x double].
388 /// An integer value that specifies the rounding operation. \n
389 /// Bits [7:4] are reserved. \n
390 /// Bit [3] is a precision exception value: \n
391 /// 0: A normal PE exception is used. \n
392 /// 1: The PE field is not updated. \n
393 /// Bit [2] is the rounding control source: \n
394 /// 0: Use bits [1:0] of \a M. \n
395 /// 1: Use the current MXCSR setting. \n
396 /// Bits [1:0] contain the rounding control definition: \n
398 /// 01: Downward (toward negative infinity). \n
399 /// 10: Upward (toward positive infinity). \n
401 /// \returns A 256-bit vector of [4 x double] containing the rounded values.
402 #define _mm256_round_pd(V, M) \
403 (__m256d)__builtin_ia32_roundpd256((__v4df)(__m256d)(V), (M))
405 /// Rounds the values stored in a 256-bit vector of [8 x float] as
406 /// specified by the byte operand. The source values are rounded to integer
407 /// values and returned as floating-point values.
409 /// \headerfile <x86intrin.h>
412 /// __m256 _mm256_round_ps(__m256 V, const int M);
415 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
418 /// A 256-bit vector of [8 x float].
420 /// An integer value that specifies the rounding operation. \n
421 /// Bits [7:4] are reserved. \n
422 /// Bit [3] is a precision exception value: \n
423 /// 0: A normal PE exception is used. \n
424 /// 1: The PE field is not updated. \n
425 /// Bit [2] is the rounding control source: \n
426 /// 0: Use bits [1:0] of \a M. \n
427 /// 1: Use the current MXCSR setting. \n
428 /// Bits [1:0] contain the rounding control definition: \n
430 /// 01: Downward (toward negative infinity). \n
431 /// 10: Upward (toward positive infinity). \n
433 /// \returns A 256-bit vector of [8 x float] containing the rounded values.
434 #define _mm256_round_ps(V, M) \
435 (__m256)__builtin_ia32_roundps256((__v8sf)(__m256)(V), (M))
437 /// Rounds up the values stored in a 256-bit vector of [4 x double]. The
438 /// source values are rounded up to integer values and returned as 64-bit
439 /// double-precision floating-point values.
441 /// \headerfile <x86intrin.h>
444 /// __m256d _mm256_ceil_pd(__m256d V);
447 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
450 /// A 256-bit vector of [4 x double].
451 /// \returns A 256-bit vector of [4 x double] containing the rounded up values.
452 #define _mm256_ceil_pd(V) _mm256_round_pd((V), _MM_FROUND_CEIL)
454 /// Rounds down the values stored in a 256-bit vector of [4 x double].
455 /// The source values are rounded down to integer values and returned as
456 /// 64-bit double-precision floating-point values.
458 /// \headerfile <x86intrin.h>
461 /// __m256d _mm256_floor_pd(__m256d V);
464 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
467 /// A 256-bit vector of [4 x double].
468 /// \returns A 256-bit vector of [4 x double] containing the rounded down
470 #define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)
472 /// Rounds up the values stored in a 256-bit vector of [8 x float]. The
473 /// source values are rounded up to integer values and returned as
474 /// floating-point values.
476 /// \headerfile <x86intrin.h>
479 /// __m256 _mm256_ceil_ps(__m256 V);
482 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
485 /// A 256-bit vector of [8 x float].
486 /// \returns A 256-bit vector of [8 x float] containing the rounded up values.
487 #define _mm256_ceil_ps(V) _mm256_round_ps((V), _MM_FROUND_CEIL)
489 /// Rounds down the values stored in a 256-bit vector of [8 x float]. The
490 /// source values are rounded down to integer values and returned as
491 /// floating-point values.
493 /// \headerfile <x86intrin.h>
496 /// __m256 _mm256_floor_ps(__m256 V);
499 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
502 /// A 256-bit vector of [8 x float].
503 /// \returns A 256-bit vector of [8 x float] containing the rounded down values.
504 #define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
507 /// Performs a bitwise AND of two 256-bit vectors of [4 x double].
509 /// \headerfile <x86intrin.h>
511 /// This intrinsic corresponds to the <c> VANDPD </c> instruction.
514 /// A 256-bit vector of [4 x double] containing one of the source operands.
516 /// A 256-bit vector of [4 x double] containing one of the source operands.
517 /// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
518 /// values between both operands.
519 static __inline __m256d __DEFAULT_FN_ATTRS
520 _mm256_and_pd(__m256d __a, __m256d __b)
522 return (__m256d)((__v4du)__a & (__v4du)__b);
525 /// Performs a bitwise AND of two 256-bit vectors of [8 x float].
527 /// \headerfile <x86intrin.h>
529 /// This intrinsic corresponds to the <c> VANDPS </c> instruction.
532 /// A 256-bit vector of [8 x float] containing one of the source operands.
534 /// A 256-bit vector of [8 x float] containing one of the source operands.
535 /// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
536 /// values between both operands.
537 static __inline __m256 __DEFAULT_FN_ATTRS
538 _mm256_and_ps(__m256 __a, __m256 __b)
540 return (__m256)((__v8su)__a & (__v8su)__b);
543 /// Performs a bitwise AND of two 256-bit vectors of [4 x double], using
544 /// the one's complement of the values contained in the first source operand.
546 /// \headerfile <x86intrin.h>
548 /// This intrinsic corresponds to the <c> VANDNPD </c> instruction.
551 /// A 256-bit vector of [4 x double] containing the left source operand. The
552 /// one's complement of this value is used in the bitwise AND.
554 /// A 256-bit vector of [4 x double] containing the right source operand.
555 /// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
556 /// values of the second operand and the one's complement of the first
558 static __inline __m256d __DEFAULT_FN_ATTRS
559 _mm256_andnot_pd(__m256d __a, __m256d __b)
561 return (__m256d)(~(__v4du)__a & (__v4du)__b);
564 /// Performs a bitwise AND of two 256-bit vectors of [8 x float], using
565 /// the one's complement of the values contained in the first source operand.
567 /// \headerfile <x86intrin.h>
569 /// This intrinsic corresponds to the <c> VANDNPS </c> instruction.
572 /// A 256-bit vector of [8 x float] containing the left source operand. The
573 /// one's complement of this value is used in the bitwise AND.
575 /// A 256-bit vector of [8 x float] containing the right source operand.
576 /// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
577 /// values of the second operand and the one's complement of the first
579 static __inline __m256 __DEFAULT_FN_ATTRS
580 _mm256_andnot_ps(__m256 __a, __m256 __b)
582 return (__m256)(~(__v8su)__a & (__v8su)__b);
585 /// Performs a bitwise OR of two 256-bit vectors of [4 x double].
587 /// \headerfile <x86intrin.h>
589 /// This intrinsic corresponds to the <c> VORPD </c> instruction.
592 /// A 256-bit vector of [4 x double] containing one of the source operands.
594 /// A 256-bit vector of [4 x double] containing one of the source operands.
595 /// \returns A 256-bit vector of [4 x double] containing the bitwise OR of the
596 /// values between both operands.
597 static __inline __m256d __DEFAULT_FN_ATTRS
598 _mm256_or_pd(__m256d __a, __m256d __b)
600 return (__m256d)((__v4du)__a | (__v4du)__b);
603 /// Performs a bitwise OR of two 256-bit vectors of [8 x float].
605 /// \headerfile <x86intrin.h>
607 /// This intrinsic corresponds to the <c> VORPS </c> instruction.
610 /// A 256-bit vector of [8 x float] containing one of the source operands.
612 /// A 256-bit vector of [8 x float] containing one of the source operands.
613 /// \returns A 256-bit vector of [8 x float] containing the bitwise OR of the
614 /// values between both operands.
615 static __inline __m256 __DEFAULT_FN_ATTRS
616 _mm256_or_ps(__m256 __a, __m256 __b)
618 return (__m256)((__v8su)__a | (__v8su)__b);
621 /// Performs a bitwise XOR of two 256-bit vectors of [4 x double].
623 /// \headerfile <x86intrin.h>
625 /// This intrinsic corresponds to the <c> VXORPD </c> instruction.
628 /// A 256-bit vector of [4 x double] containing one of the source operands.
630 /// A 256-bit vector of [4 x double] containing one of the source operands.
631 /// \returns A 256-bit vector of [4 x double] containing the bitwise XOR of the
632 /// values between both operands.
633 static __inline __m256d __DEFAULT_FN_ATTRS
634 _mm256_xor_pd(__m256d __a, __m256d __b)
636 return (__m256d)((__v4du)__a ^ (__v4du)__b);
639 /// Performs a bitwise XOR of two 256-bit vectors of [8 x float].
641 /// \headerfile <x86intrin.h>
643 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
646 /// A 256-bit vector of [8 x float] containing one of the source operands.
648 /// A 256-bit vector of [8 x float] containing one of the source operands.
649 /// \returns A 256-bit vector of [8 x float] containing the bitwise XOR of the
650 /// values between both operands.
651 static __inline __m256 __DEFAULT_FN_ATTRS
652 _mm256_xor_ps(__m256 __a, __m256 __b)
654 return (__m256)((__v8su)__a ^ (__v8su)__b);
657 /* Horizontal arithmetic */
658 /// Horizontally adds the adjacent pairs of values contained in two
659 /// 256-bit vectors of [4 x double].
661 /// \headerfile <x86intrin.h>
663 /// This intrinsic corresponds to the <c> VHADDPD </c> instruction.
666 /// A 256-bit vector of [4 x double] containing one of the source operands.
667 /// The horizontal sums of the values are returned in the even-indexed
668 /// elements of a vector of [4 x double].
670 /// A 256-bit vector of [4 x double] containing one of the source operands.
671 /// The horizontal sums of the values are returned in the odd-indexed
672 /// elements of a vector of [4 x double].
673 /// \returns A 256-bit vector of [4 x double] containing the horizontal sums of
675 static __inline __m256d __DEFAULT_FN_ATTRS
676 _mm256_hadd_pd(__m256d __a, __m256d __b)
678 return (__m256d)__builtin_ia32_haddpd256((__v4df)__a, (__v4df)__b);
681 /// Horizontally adds the adjacent pairs of values contained in two
682 /// 256-bit vectors of [8 x float].
684 /// \headerfile <x86intrin.h>
686 /// This intrinsic corresponds to the <c> VHADDPS </c> instruction.
689 /// A 256-bit vector of [8 x float] containing one of the source operands.
690 /// The horizontal sums of the values are returned in the elements with
691 /// index 0, 1, 4, 5 of a vector of [8 x float].
693 /// A 256-bit vector of [8 x float] containing one of the source operands.
694 /// The horizontal sums of the values are returned in the elements with
695 /// index 2, 3, 6, 7 of a vector of [8 x float].
696 /// \returns A 256-bit vector of [8 x float] containing the horizontal sums of
698 static __inline __m256 __DEFAULT_FN_ATTRS
699 _mm256_hadd_ps(__m256 __a, __m256 __b)
701 return (__m256)__builtin_ia32_haddps256((__v8sf)__a, (__v8sf)__b);
704 /// Horizontally subtracts the adjacent pairs of values contained in two
705 /// 256-bit vectors of [4 x double].
707 /// \headerfile <x86intrin.h>
709 /// This intrinsic corresponds to the <c> VHSUBPD </c> instruction.
712 /// A 256-bit vector of [4 x double] containing one of the source operands.
713 /// The horizontal differences between the values are returned in the
714 /// even-indexed elements of a vector of [4 x double].
716 /// A 256-bit vector of [4 x double] containing one of the source operands.
717 /// The horizontal differences between the values are returned in the
718 /// odd-indexed elements of a vector of [4 x double].
719 /// \returns A 256-bit vector of [4 x double] containing the horizontal
720 /// differences of both operands.
721 static __inline __m256d __DEFAULT_FN_ATTRS
722 _mm256_hsub_pd(__m256d __a, __m256d __b)
724 return (__m256d)__builtin_ia32_hsubpd256((__v4df)__a, (__v4df)__b);
727 /// Horizontally subtracts the adjacent pairs of values contained in two
728 /// 256-bit vectors of [8 x float].
730 /// \headerfile <x86intrin.h>
732 /// This intrinsic corresponds to the <c> VHSUBPS </c> instruction.
735 /// A 256-bit vector of [8 x float] containing one of the source operands.
736 /// The horizontal differences between the values are returned in the
737 /// elements with index 0, 1, 4, 5 of a vector of [8 x float].
739 /// A 256-bit vector of [8 x float] containing one of the source operands.
740 /// The horizontal differences between the values are returned in the
741 /// elements with index 2, 3, 6, 7 of a vector of [8 x float].
742 /// \returns A 256-bit vector of [8 x float] containing the horizontal
743 /// differences of both operands.
744 static __inline __m256 __DEFAULT_FN_ATTRS
745 _mm256_hsub_ps(__m256 __a, __m256 __b)
747 return (__m256)__builtin_ia32_hsubps256((__v8sf)__a, (__v8sf)__b);
750 /* Vector permutations */
751 /// Copies the values in a 128-bit vector of [2 x double] as specified
752 /// by the 128-bit integer vector operand.
754 /// \headerfile <x86intrin.h>
756 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
759 /// A 128-bit vector of [2 x double].
761 /// A 128-bit integer vector operand specifying how the values are to be
764 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
766 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
767 /// returned vector. \n
769 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
770 /// returned vector. \n
771 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
773 /// \returns A 128-bit vector of [2 x double] containing the copied values.
774 static __inline __m128d __DEFAULT_FN_ATTRS128
775 _mm_permutevar_pd(__m128d __a, __m128i __c)
777 return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
780 /// Copies the values in a 256-bit vector of [4 x double] as specified
781 /// by the 256-bit integer vector operand.
783 /// \headerfile <x86intrin.h>
785 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
788 /// A 256-bit vector of [4 x double].
790 /// A 256-bit integer vector operand specifying how the values are to be
793 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
795 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
796 /// returned vector. \n
798 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
799 /// returned vector. \n
800 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
801 /// returned vector. \n
803 /// 0: Bits [191:128] of the source are copied to bits [191:128] of the
804 /// returned vector. \n
805 /// 1: Bits [255:192] of the source are copied to bits [191:128] of the
806 /// returned vector. \n
808 /// 0: Bits [191:128] of the source are copied to bits [255:192] of the
809 /// returned vector. \n
810 /// 1: Bits [255:192] of the source are copied to bits [255:192] of the
812 /// \returns A 256-bit vector of [4 x double] containing the copied values.
813 static __inline __m256d __DEFAULT_FN_ATTRS
814 _mm256_permutevar_pd(__m256d __a, __m256i __c)
816 return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)__a, (__v4di)__c);
819 /// Copies the values stored in a 128-bit vector of [4 x float] as
820 /// specified by the 128-bit integer vector operand.
821 /// \headerfile <x86intrin.h>
823 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
826 /// A 128-bit vector of [4 x float].
828 /// A 128-bit integer vector operand specifying how the values are to be
831 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
832 /// returned vector. \n
833 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
834 /// returned vector. \n
835 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
836 /// returned vector. \n
837 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
838 /// returned vector. \n
840 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
841 /// returned vector. \n
842 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
843 /// returned vector. \n
844 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
845 /// returned vector. \n
846 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
847 /// returned vector. \n
849 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
850 /// returned vector. \n
851 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
852 /// returned vector. \n
853 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
854 /// returned vector. \n
855 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
856 /// returned vector. \n
858 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
859 /// returned vector. \n
860 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
861 /// returned vector. \n
862 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
863 /// returned vector. \n
864 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
866 /// \returns A 128-bit vector of [4 x float] containing the copied values.
867 static __inline __m128 __DEFAULT_FN_ATTRS128
868 _mm_permutevar_ps(__m128 __a, __m128i __c)
870 return (__m128)__builtin_ia32_vpermilvarps((__v4sf)__a, (__v4si)__c);
873 /// Copies the values stored in a 256-bit vector of [8 x float] as
874 /// specified by the 256-bit integer vector operand.
876 /// \headerfile <x86intrin.h>
878 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
881 /// A 256-bit vector of [8 x float].
883 /// A 256-bit integer vector operand specifying how the values are to be
886 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
887 /// returned vector. \n
888 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
889 /// returned vector. \n
890 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
891 /// returned vector. \n
892 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
893 /// returned vector. \n
895 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
896 /// returned vector. \n
897 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
898 /// returned vector. \n
899 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
900 /// returned vector. \n
901 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
902 /// returned vector. \n
904 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
905 /// returned vector. \n
906 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
907 /// returned vector. \n
908 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
909 /// returned vector. \n
910 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
911 /// returned vector. \n
913 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
914 /// returned vector. \n
915 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
916 /// returned vector. \n
917 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
918 /// returned vector. \n
919 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
920 /// returned vector. \n
921 /// Bits [129:128]: \n
922 /// 00: Bits [159:128] of the source are copied to bits [159:128] of the
923 /// returned vector. \n
924 /// 01: Bits [191:160] of the source are copied to bits [159:128] of the
925 /// returned vector. \n
926 /// 10: Bits [223:192] of the source are copied to bits [159:128] of the
927 /// returned vector. \n
928 /// 11: Bits [255:224] of the source are copied to bits [159:128] of the
929 /// returned vector. \n
930 /// Bits [161:160]: \n
931 /// 00: Bits [159:128] of the source are copied to bits [191:160] of the
932 /// returned vector. \n
933 /// 01: Bits [191:160] of the source are copied to bits [191:160] of the
934 /// returned vector. \n
935 /// 10: Bits [223:192] of the source are copied to bits [191:160] of the
936 /// returned vector. \n
937 /// 11: Bits [255:224] of the source are copied to bits [191:160] of the
938 /// returned vector. \n
939 /// Bits [193:192]: \n
940 /// 00: Bits [159:128] of the source are copied to bits [223:192] of the
941 /// returned vector. \n
942 /// 01: Bits [191:160] of the source are copied to bits [223:192] of the
943 /// returned vector. \n
944 /// 10: Bits [223:192] of the source are copied to bits [223:192] of the
945 /// returned vector. \n
946 /// 11: Bits [255:224] of the source are copied to bits [223:192] of the
947 /// returned vector. \n
948 /// Bits [225:224]: \n
949 /// 00: Bits [159:128] of the source are copied to bits [255:224] of the
950 /// returned vector. \n
951 /// 01: Bits [191:160] of the source are copied to bits [255:224] of the
952 /// returned vector. \n
953 /// 10: Bits [223:192] of the source are copied to bits [255:224] of the
954 /// returned vector. \n
955 /// 11: Bits [255:224] of the source are copied to bits [255:224] of the
957 /// \returns A 256-bit vector of [8 x float] containing the copied values.
958 static __inline __m256 __DEFAULT_FN_ATTRS
959 _mm256_permutevar_ps(__m256 __a, __m256i __c)
961 return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)__a, (__v8si)__c);
964 /// Copies the values in a 128-bit vector of [2 x double] as specified
965 /// by the immediate integer operand.
967 /// \headerfile <x86intrin.h>
970 /// __m128d _mm_permute_pd(__m128d A, const int C);
973 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
976 /// A 128-bit vector of [2 x double].
978 /// An immediate integer operand specifying how the values are to be
981 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
983 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
984 /// returned vector. \n
986 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
987 /// returned vector. \n
988 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
990 /// \returns A 128-bit vector of [2 x double] containing the copied values.
991 #define _mm_permute_pd(A, C) \
992 (__m128d)__builtin_ia32_vpermilpd((__v2df)(__m128d)(A), (int)(C))
994 /// Copies the values in a 256-bit vector of [4 x double] as specified by
995 /// the immediate integer operand.
997 /// \headerfile <x86intrin.h>
1000 /// __m256d _mm256_permute_pd(__m256d A, const int C);
1003 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
1006 /// A 256-bit vector of [4 x double].
1008 /// An immediate integer operand specifying how the values are to be
1011 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
1013 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
1014 /// returned vector. \n
1016 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
1017 /// returned vector. \n
1018 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
1019 /// returned vector. \n
1021 /// 0: Bits [191:128] of the source are copied to bits [191:128] of the
1022 /// returned vector. \n
1023 /// 1: Bits [255:192] of the source are copied to bits [191:128] of the
1024 /// returned vector. \n
1026 /// 0: Bits [191:128] of the source are copied to bits [255:192] of the
1027 /// returned vector. \n
1028 /// 1: Bits [255:192] of the source are copied to bits [255:192] of the
1029 /// returned vector.
1030 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1031 #define _mm256_permute_pd(A, C) \
1032 (__m256d)__builtin_ia32_vpermilpd256((__v4df)(__m256d)(A), (int)(C))
1034 /// Copies the values in a 128-bit vector of [4 x float] as specified by
1035 /// the immediate integer operand.
1037 /// \headerfile <x86intrin.h>
1040 /// __m128 _mm_permute_ps(__m128 A, const int C);
1043 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1046 /// A 128-bit vector of [4 x float].
1048 /// An immediate integer operand specifying how the values are to be
1051 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1052 /// returned vector. \n
1053 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1054 /// returned vector. \n
1055 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1056 /// returned vector. \n
1057 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1058 /// returned vector. \n
1060 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1061 /// returned vector. \n
1062 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1063 /// returned vector. \n
1064 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1065 /// returned vector. \n
1066 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1067 /// returned vector. \n
1069 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1070 /// returned vector. \n
1071 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1072 /// returned vector. \n
1073 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1074 /// returned vector. \n
1075 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1076 /// returned vector. \n
1078 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1079 /// returned vector. \n
1080 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1081 /// returned vector. \n
1082 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1083 /// returned vector. \n
1084 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1085 /// returned vector.
1086 /// \returns A 128-bit vector of [4 x float] containing the copied values.
1087 #define _mm_permute_ps(A, C) \
1088 (__m128)__builtin_ia32_vpermilps((__v4sf)(__m128)(A), (int)(C))
1090 /// Copies the values in a 256-bit vector of [8 x float] as specified by
1091 /// the immediate integer operand.
1093 /// \headerfile <x86intrin.h>
1096 /// __m256 _mm256_permute_ps(__m256 A, const int C);
1099 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1102 /// A 256-bit vector of [8 x float].
1104 /// An immediate integer operand specifying how the values are to be
1107 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1108 /// returned vector. \n
1109 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1110 /// returned vector. \n
1111 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1112 /// returned vector. \n
1113 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1114 /// returned vector. \n
1116 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1117 /// returned vector. \n
1118 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1119 /// returned vector. \n
1120 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1121 /// returned vector. \n
1122 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1123 /// returned vector. \n
1125 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1126 /// returned vector. \n
1127 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1128 /// returned vector. \n
1129 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1130 /// returned vector. \n
1131 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1132 /// returned vector. \n
1134 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1135 /// returned vector. \n
1136 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1137 /// returned vector. \n
1138 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1139 /// returned vector. \n
1140 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1141 /// returned vector. \n
1143 /// 00: Bits [159:128] of the source are copied to bits [159:128] of the
1144 /// returned vector. \n
1145 /// 01: Bits [191:160] of the source are copied to bits [159:128] of the
1146 /// returned vector. \n
1147 /// 10: Bits [223:192] of the source are copied to bits [159:128] of the
1148 /// returned vector. \n
1149 /// 11: Bits [255:224] of the source are copied to bits [159:128] of the
1150 /// returned vector. \n
1152 /// 00: Bits [159:128] of the source are copied to bits [191:160] of the
1153 /// returned vector. \n
1154 /// 01: Bits [191:160] of the source are copied to bits [191:160] of the
1155 /// returned vector. \n
1156 /// 10: Bits [223:192] of the source are copied to bits [191:160] of the
1157 /// returned vector. \n
1158 /// 11: Bits [255:224] of the source are copied to bits [191:160] of the
1159 /// returned vector. \n
1161 /// 00: Bits [159:128] of the source are copied to bits [223:192] of the
1162 /// returned vector. \n
1163 /// 01: Bits [191:160] of the source are copied to bits [223:192] of the
1164 /// returned vector. \n
1165 /// 10: Bits [223:192] of the source are copied to bits [223:192] of the
1166 /// returned vector. \n
1167 /// 11: Bits [255:224] of the source are copied to bits [223:192] of the
1168 /// returned vector. \n
1170 /// 00: Bits [159:128] of the source are copied to bits [255:224] of the
1171 /// returned vector. \n
1172 /// 01: Bits [191:160] of the source are copied to bits [255:224] of the
1173 /// returned vector. \n
1174 /// 10: Bits [223:192] of the source are copied to bits [255:224] of the
1175 /// returned vector. \n
1176 /// 11: Bits [255:224] of the source are copied to bits [255:224] of the
1177 /// returned vector.
1178 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1179 #define _mm256_permute_ps(A, C) \
1180 (__m256)__builtin_ia32_vpermilps256((__v8sf)(__m256)(A), (int)(C))
1182 /// Permutes 128-bit data values stored in two 256-bit vectors of
1183 /// [4 x double], as specified by the immediate integer operand.
1185 /// \headerfile <x86intrin.h>
1188 /// __m256d _mm256_permute2f128_pd(__m256d V1, __m256d V2, const int M);
1191 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1194 /// A 256-bit vector of [4 x double].
1196 /// A 256-bit vector of [4 x double.
1198 /// An immediate integer operand specifying how the values are to be
1201 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1203 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1205 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1207 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1210 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1212 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1214 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1216 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1218 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1219 #define _mm256_permute2f128_pd(V1, V2, M) \
1220 (__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)(__m256d)(V1), \
1221 (__v4df)(__m256d)(V2), (int)(M))
1223 /// Permutes 128-bit data values stored in two 256-bit vectors of
1224 /// [8 x float], as specified by the immediate integer operand.
1226 /// \headerfile <x86intrin.h>
1229 /// __m256 _mm256_permute2f128_ps(__m256 V1, __m256 V2, const int M);
1232 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1235 /// A 256-bit vector of [8 x float].
1237 /// A 256-bit vector of [8 x float].
1239 /// An immediate integer operand specifying how the values are to be
1242 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1244 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1246 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1248 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1251 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1253 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1255 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1257 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1259 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1260 #define _mm256_permute2f128_ps(V1, V2, M) \
1261 (__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)(__m256)(V1), \
1262 (__v8sf)(__m256)(V2), (int)(M))
1264 /// Permutes 128-bit data values stored in two 256-bit integer vectors,
1265 /// as specified by the immediate integer operand.
1267 /// \headerfile <x86intrin.h>
1270 /// __m256i _mm256_permute2f128_si256(__m256i V1, __m256i V2, const int M);
1273 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1276 /// A 256-bit integer vector.
1278 /// A 256-bit integer vector.
1280 /// An immediate integer operand specifying how the values are to be copied.
1282 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1284 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1286 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1288 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1291 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1293 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1295 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1297 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1299 /// \returns A 256-bit integer vector containing the copied values.
1300 #define _mm256_permute2f128_si256(V1, V2, M) \
1301 (__m256i)__builtin_ia32_vperm2f128_si256((__v8si)(__m256i)(V1), \
1302 (__v8si)(__m256i)(V2), (int)(M))
1305 /// Merges 64-bit double-precision data values stored in either of the
1306 /// two 256-bit vectors of [4 x double], as specified by the immediate
1307 /// integer operand.
1309 /// \headerfile <x86intrin.h>
1312 /// __m256d _mm256_blend_pd(__m256d V1, __m256d V2, const int M);
1315 /// This intrinsic corresponds to the <c> VBLENDPD </c> instruction.
1318 /// A 256-bit vector of [4 x double].
1320 /// A 256-bit vector of [4 x double].
1322 /// An immediate integer operand, with mask bits [3:0] specifying how the
1323 /// values are to be copied. The position of the mask bit corresponds to the
1324 /// index of a copied value. When a mask bit is 0, the corresponding 64-bit
1325 /// element in operand \a V1 is copied to the same position in the
1326 /// destination. When a mask bit is 1, the corresponding 64-bit element in
1327 /// operand \a V2 is copied to the same position in the destination.
1328 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1329 #define _mm256_blend_pd(V1, V2, M) \
1330 (__m256d)__builtin_ia32_blendpd256((__v4df)(__m256d)(V1), \
1331 (__v4df)(__m256d)(V2), (int)(M))
1333 /// Merges 32-bit single-precision data values stored in either of the
1334 /// two 256-bit vectors of [8 x float], as specified by the immediate
1335 /// integer operand.
1337 /// \headerfile <x86intrin.h>
1340 /// __m256 _mm256_blend_ps(__m256 V1, __m256 V2, const int M);
1343 /// This intrinsic corresponds to the <c> VBLENDPS </c> instruction.
1346 /// A 256-bit vector of [8 x float].
1348 /// A 256-bit vector of [8 x float].
1350 /// An immediate integer operand, with mask bits [7:0] specifying how the
1351 /// values are to be copied. The position of the mask bit corresponds to the
1352 /// index of a copied value. When a mask bit is 0, the corresponding 32-bit
1353 /// element in operand \a V1 is copied to the same position in the
1354 /// destination. When a mask bit is 1, the corresponding 32-bit element in
1355 /// operand \a V2 is copied to the same position in the destination.
1356 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1357 #define _mm256_blend_ps(V1, V2, M) \
1358 (__m256)__builtin_ia32_blendps256((__v8sf)(__m256)(V1), \
1359 (__v8sf)(__m256)(V2), (int)(M))
1361 /// Merges 64-bit double-precision data values stored in either of the
1362 /// two 256-bit vectors of [4 x double], as specified by the 256-bit vector
1365 /// \headerfile <x86intrin.h>
1367 /// This intrinsic corresponds to the <c> VBLENDVPD </c> instruction.
1370 /// A 256-bit vector of [4 x double].
1372 /// A 256-bit vector of [4 x double].
1374 /// A 256-bit vector operand, with mask bits 255, 191, 127, and 63 specifying
1375 /// how the values are to be copied. The position of the mask bit corresponds
1376 /// to the most significant bit of a copied value. When a mask bit is 0, the
1377 /// corresponding 64-bit element in operand \a __a is copied to the same
1378 /// position in the destination. When a mask bit is 1, the corresponding
1379 /// 64-bit element in operand \a __b is copied to the same position in the
1381 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1382 static __inline __m256d __DEFAULT_FN_ATTRS
1383 _mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
1385 return (__m256d)__builtin_ia32_blendvpd256(
1386 (__v4df)__a, (__v4df)__b, (__v4df)__c);
1389 /// Merges 32-bit single-precision data values stored in either of the
1390 /// two 256-bit vectors of [8 x float], as specified by the 256-bit vector
1393 /// \headerfile <x86intrin.h>
1395 /// This intrinsic corresponds to the <c> VBLENDVPS </c> instruction.
1398 /// A 256-bit vector of [8 x float].
1400 /// A 256-bit vector of [8 x float].
1402 /// A 256-bit vector operand, with mask bits 255, 223, 191, 159, 127, 95, 63,
1403 /// and 31 specifying how the values are to be copied. The position of the
1404 /// mask bit corresponds to the most significant bit of a copied value. When
1405 /// a mask bit is 0, the corresponding 32-bit element in operand \a __a is
1406 /// copied to the same position in the destination. When a mask bit is 1, the
1407 /// corresponding 32-bit element in operand \a __b is copied to the same
1408 /// position in the destination.
1409 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1410 static __inline __m256 __DEFAULT_FN_ATTRS
1411 _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
1413 return (__m256)__builtin_ia32_blendvps256(
1414 (__v8sf)__a, (__v8sf)__b, (__v8sf)__c);
1417 /* Vector Dot Product */
1418 /// Computes two dot products in parallel, using the lower and upper
1419 /// halves of two [8 x float] vectors as input to the two computations, and
1420 /// returning the two dot products in the lower and upper halves of the
1421 /// [8 x float] result.
1423 /// The immediate integer operand controls which input elements will
1424 /// contribute to the dot product, and where the final results are returned.
1425 /// In general, for each dot product, the four corresponding elements of the
1426 /// input vectors are multiplied; the first two and second two products are
1427 /// summed, then the two sums are added to form the final result.
1429 /// \headerfile <x86intrin.h>
1432 /// __m256 _mm256_dp_ps(__m256 V1, __m256 V2, const int M);
1435 /// This intrinsic corresponds to the <c> VDPPS </c> instruction.
1438 /// A vector of [8 x float] values, treated as two [4 x float] vectors.
1440 /// A vector of [8 x float] values, treated as two [4 x float] vectors.
1442 /// An immediate integer argument. Bits [7:4] determine which elements of
1443 /// the input vectors are used, with bit [4] corresponding to the lowest
1444 /// element and bit [7] corresponding to the highest element of each [4 x
1445 /// float] subvector. If a bit is set, the corresponding elements from the
1446 /// two input vectors are used as an input for dot product; otherwise that
1447 /// input is treated as zero. Bits [3:0] determine which elements of the
1448 /// result will receive a copy of the final dot product, with bit [0]
1449 /// corresponding to the lowest element and bit [3] corresponding to the
1450 /// highest element of each [4 x float] subvector. If a bit is set, the dot
1451 /// product is returned in the corresponding element; otherwise that element
1452 /// is set to zero. The bitmask is applied in the same way to each of the
1453 /// two parallel dot product computations.
1454 /// \returns A 256-bit vector of [8 x float] containing the two dot products.
1455 #define _mm256_dp_ps(V1, V2, M) \
1456 (__m256)__builtin_ia32_dpps256((__v8sf)(__m256)(V1), \
1457 (__v8sf)(__m256)(V2), (M))
1459 /* Vector shuffle */
1460 /// Selects 8 float values from the 256-bit operands of [8 x float], as
1461 /// specified by the immediate value operand.
1463 /// The four selected elements in each operand are copied to the destination
1464 /// according to the bits specified in the immediate operand. The selected
1465 /// elements from the first 256-bit operand are copied to bits [63:0] and
1466 /// bits [191:128] of the destination, and the selected elements from the
1467 /// second 256-bit operand are copied to bits [127:64] and bits [255:192] of
1468 /// the destination. For example, if bits [7:0] of the immediate operand
1469 /// contain a value of 0xFF, the 256-bit destination vector would contain the
1470 /// following values: b[7], b[7], a[7], a[7], b[3], b[3], a[3], a[3].
1472 /// \headerfile <x86intrin.h>
1475 /// __m256 _mm256_shuffle_ps(__m256 a, __m256 b, const int mask);
1478 /// This intrinsic corresponds to the <c> VSHUFPS </c> instruction.
1481 /// A 256-bit vector of [8 x float]. The four selected elements in this
1482 /// operand are copied to bits [63:0] and bits [191:128] in the destination,
1483 /// according to the bits specified in the immediate operand.
1485 /// A 256-bit vector of [8 x float]. The four selected elements in this
1486 /// operand are copied to bits [127:64] and bits [255:192] in the
1487 /// destination, according to the bits specified in the immediate operand.
1489 /// An immediate value containing an 8-bit value specifying which elements to
1490 /// copy from \a a and \a b \n.
1491 /// Bits [3:0] specify the values copied from operand \a a. \n
1492 /// Bits [7:4] specify the values copied from operand \a b. \n
1493 /// The destinations within the 256-bit destination are assigned values as
1494 /// follows, according to the bit value assignments described below: \n
1495 /// Bits [1:0] are used to assign values to bits [31:0] and [159:128] in the
1497 /// Bits [3:2] are used to assign values to bits [63:32] and [191:160] in the
1499 /// Bits [5:4] are used to assign values to bits [95:64] and [223:192] in the
1501 /// Bits [7:6] are used to assign values to bits [127:96] and [255:224] in
1502 /// the destination. \n
1503 /// Bit value assignments: \n
1504 /// 00: Bits [31:0] and [159:128] are copied from the selected operand. \n
1505 /// 01: Bits [63:32] and [191:160] are copied from the selected operand. \n
1506 /// 10: Bits [95:64] and [223:192] are copied from the selected operand. \n
1507 /// 11: Bits [127:96] and [255:224] are copied from the selected operand.
1508 /// \returns A 256-bit vector of [8 x float] containing the shuffled values.
1509 #define _mm256_shuffle_ps(a, b, mask) \
1510 (__m256)__builtin_ia32_shufps256((__v8sf)(__m256)(a), \
1511 (__v8sf)(__m256)(b), (int)(mask))
1513 /// Selects four double-precision values from the 256-bit operands of
1514 /// [4 x double], as specified by the immediate value operand.
1516 /// The selected elements from the first 256-bit operand are copied to bits
1517 /// [63:0] and bits [191:128] in the destination, and the selected elements
1518 /// from the second 256-bit operand are copied to bits [127:64] and bits
1519 /// [255:192] in the destination. For example, if bits [3:0] of the immediate
1520 /// operand contain a value of 0xF, the 256-bit destination vector would
1521 /// contain the following values: b[3], a[3], b[1], a[1].
1523 /// \headerfile <x86intrin.h>
1526 /// __m256d _mm256_shuffle_pd(__m256d a, __m256d b, const int mask);
1529 /// This intrinsic corresponds to the <c> VSHUFPD </c> instruction.
1532 /// A 256-bit vector of [4 x double].
1534 /// A 256-bit vector of [4 x double].
1536 /// An immediate value containing 8-bit values specifying which elements to
1537 /// copy from \a a and \a b: \n
1538 /// Bit [0]=0: Bits [63:0] are copied from \a a to bits [63:0] of the
1540 /// Bit [0]=1: Bits [127:64] are copied from \a a to bits [63:0] of the
1542 /// Bit [1]=0: Bits [63:0] are copied from \a b to bits [127:64] of the
1544 /// Bit [1]=1: Bits [127:64] are copied from \a b to bits [127:64] of the
1546 /// Bit [2]=0: Bits [191:128] are copied from \a a to bits [191:128] of the
1548 /// Bit [2]=1: Bits [255:192] are copied from \a a to bits [191:128] of the
1550 /// Bit [3]=0: Bits [191:128] are copied from \a b to bits [255:192] of the
1552 /// Bit [3]=1: Bits [255:192] are copied from \a b to bits [255:192] of the
1554 /// \returns A 256-bit vector of [4 x double] containing the shuffled values.
1555 #define _mm256_shuffle_pd(a, b, mask) \
1556 (__m256d)__builtin_ia32_shufpd256((__v4df)(__m256d)(a), \
1557 (__v4df)(__m256d)(b), (int)(mask))
1560 #define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
1561 #define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */
1562 #define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */
1563 #define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */
1564 #define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */
1565 #define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */
1566 #define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */
1567 #define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */
1568 #define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */
1569 #define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */
1570 #define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */
1571 #define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */
1572 #define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */
1573 #define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */
1574 #define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */
1575 #define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */
1576 #define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */
1577 #define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */
1578 #define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */
1579 #define _CMP_UNORD_S 0x13 /* Unordered (signaling) */
1580 #define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */
1581 #define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */
1582 #define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */
1583 #define _CMP_ORD_S 0x17 /* Ordered (signaling) */
1584 #define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */
1585 #define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */
1586 #define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */
1587 #define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */
1588 #define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */
1589 #define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */
1590 #define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */
1591 #define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */
1593 /// Compares each of the corresponding double-precision values of two
1594 /// 128-bit vectors of [2 x double], using the operation specified by the
1595 /// immediate integer operand.
1597 /// Returns a [2 x double] vector consisting of two doubles corresponding to
1598 /// the two comparison results: zero if the comparison is false, and all 1's
1599 /// if the comparison is true.
1601 /// \headerfile <x86intrin.h>
1604 /// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
1607 /// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1610 /// A 128-bit vector of [2 x double].
1612 /// A 128-bit vector of [2 x double].
1614 /// An immediate integer operand, with bits [4:0] specifying which comparison
1615 /// operation to use: \n
1616 /// 0x00: Equal (ordered, non-signaling) \n
1617 /// 0x01: Less-than (ordered, signaling) \n
1618 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1619 /// 0x03: Unordered (non-signaling) \n
1620 /// 0x04: Not-equal (unordered, non-signaling) \n
1621 /// 0x05: Not-less-than (unordered, signaling) \n
1622 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1623 /// 0x07: Ordered (non-signaling) \n
1624 /// 0x08: Equal (unordered, non-signaling) \n
1625 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1626 /// 0x0A: Not-greater-than (unordered, signaling) \n
1627 /// 0x0B: False (ordered, non-signaling) \n
1628 /// 0x0C: Not-equal (ordered, non-signaling) \n
1629 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1630 /// 0x0E: Greater-than (ordered, signaling) \n
1631 /// 0x0F: True (unordered, non-signaling) \n
1632 /// 0x10: Equal (ordered, signaling) \n
1633 /// 0x11: Less-than (ordered, non-signaling) \n
1634 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1635 /// 0x13: Unordered (signaling) \n
1636 /// 0x14: Not-equal (unordered, signaling) \n
1637 /// 0x15: Not-less-than (unordered, non-signaling) \n
1638 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1639 /// 0x17: Ordered (signaling) \n
1640 /// 0x18: Equal (unordered, signaling) \n
1641 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1642 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1643 /// 0x1B: False (ordered, signaling) \n
1644 /// 0x1C: Not-equal (ordered, signaling) \n
1645 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1646 /// 0x1E: Greater-than (ordered, non-signaling) \n
1647 /// 0x1F: True (unordered, signaling)
1648 /// \returns A 128-bit vector of [2 x double] containing the comparison results.
1649 #define _mm_cmp_pd(a, b, c) \
1650 (__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), \
1651 (__v2df)(__m128d)(b), (c))
1653 /// Compares each of the corresponding values of two 128-bit vectors of
1654 /// [4 x float], using the operation specified by the immediate integer
1657 /// Returns a [4 x float] vector consisting of four floats corresponding to
1658 /// the four comparison results: zero if the comparison is false, and all 1's
1659 /// if the comparison is true.
1661 /// \headerfile <x86intrin.h>
1664 /// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
1667 /// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1670 /// A 128-bit vector of [4 x float].
1672 /// A 128-bit vector of [4 x float].
1674 /// An immediate integer operand, with bits [4:0] specifying which comparison
1675 /// operation to use: \n
1676 /// 0x00: Equal (ordered, non-signaling) \n
1677 /// 0x01: Less-than (ordered, signaling) \n
1678 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1679 /// 0x03: Unordered (non-signaling) \n
1680 /// 0x04: Not-equal (unordered, non-signaling) \n
1681 /// 0x05: Not-less-than (unordered, signaling) \n
1682 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1683 /// 0x07: Ordered (non-signaling) \n
1684 /// 0x08: Equal (unordered, non-signaling) \n
1685 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1686 /// 0x0A: Not-greater-than (unordered, signaling) \n
1687 /// 0x0B: False (ordered, non-signaling) \n
1688 /// 0x0C: Not-equal (ordered, non-signaling) \n
1689 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1690 /// 0x0E: Greater-than (ordered, signaling) \n
1691 /// 0x0F: True (unordered, non-signaling) \n
1692 /// 0x10: Equal (ordered, signaling) \n
1693 /// 0x11: Less-than (ordered, non-signaling) \n
1694 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1695 /// 0x13: Unordered (signaling) \n
1696 /// 0x14: Not-equal (unordered, signaling) \n
1697 /// 0x15: Not-less-than (unordered, non-signaling) \n
1698 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1699 /// 0x17: Ordered (signaling) \n
1700 /// 0x18: Equal (unordered, signaling) \n
1701 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1702 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1703 /// 0x1B: False (ordered, signaling) \n
1704 /// 0x1C: Not-equal (ordered, signaling) \n
1705 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1706 /// 0x1E: Greater-than (ordered, non-signaling) \n
1707 /// 0x1F: True (unordered, signaling)
1708 /// \returns A 128-bit vector of [4 x float] containing the comparison results.
1709 #define _mm_cmp_ps(a, b, c) \
1710 (__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), \
1711 (__v4sf)(__m128)(b), (c))
1713 /// Compares each of the corresponding double-precision values of two
1714 /// 256-bit vectors of [4 x double], using the operation specified by the
1715 /// immediate integer operand.
1717 /// Returns a [4 x double] vector consisting of four doubles corresponding to
1718 /// the four comparison results: zero if the comparison is false, and all 1's
1719 /// if the comparison is true.
1721 /// \headerfile <x86intrin.h>
1724 /// __m256d _mm256_cmp_pd(__m256d a, __m256d b, const int c);
1727 /// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1730 /// A 256-bit vector of [4 x double].
1732 /// A 256-bit vector of [4 x double].
1734 /// An immediate integer operand, with bits [4:0] specifying which comparison
1735 /// operation to use: \n
1736 /// 0x00: Equal (ordered, non-signaling) \n
1737 /// 0x01: Less-than (ordered, signaling) \n
1738 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1739 /// 0x03: Unordered (non-signaling) \n
1740 /// 0x04: Not-equal (unordered, non-signaling) \n
1741 /// 0x05: Not-less-than (unordered, signaling) \n
1742 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1743 /// 0x07: Ordered (non-signaling) \n
1744 /// 0x08: Equal (unordered, non-signaling) \n
1745 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1746 /// 0x0A: Not-greater-than (unordered, signaling) \n
1747 /// 0x0B: False (ordered, non-signaling) \n
1748 /// 0x0C: Not-equal (ordered, non-signaling) \n
1749 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1750 /// 0x0E: Greater-than (ordered, signaling) \n
1751 /// 0x0F: True (unordered, non-signaling) \n
1752 /// 0x10: Equal (ordered, signaling) \n
1753 /// 0x11: Less-than (ordered, non-signaling) \n
1754 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1755 /// 0x13: Unordered (signaling) \n
1756 /// 0x14: Not-equal (unordered, signaling) \n
1757 /// 0x15: Not-less-than (unordered, non-signaling) \n
1758 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1759 /// 0x17: Ordered (signaling) \n
1760 /// 0x18: Equal (unordered, signaling) \n
1761 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1762 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1763 /// 0x1B: False (ordered, signaling) \n
1764 /// 0x1C: Not-equal (ordered, signaling) \n
1765 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1766 /// 0x1E: Greater-than (ordered, non-signaling) \n
1767 /// 0x1F: True (unordered, signaling)
1768 /// \returns A 256-bit vector of [4 x double] containing the comparison results.
1769 #define _mm256_cmp_pd(a, b, c) \
1770 (__m256d)__builtin_ia32_cmppd256((__v4df)(__m256d)(a), \
1771 (__v4df)(__m256d)(b), (c))
1773 /// Compares each of the corresponding values of two 256-bit vectors of
1774 /// [8 x float], using the operation specified by the immediate integer
1777 /// Returns a [8 x float] vector consisting of eight floats corresponding to
1778 /// the eight comparison results: zero if the comparison is false, and all
1779 /// 1's if the comparison is true.
1781 /// \headerfile <x86intrin.h>
1784 /// __m256 _mm256_cmp_ps(__m256 a, __m256 b, const int c);
1787 /// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1790 /// A 256-bit vector of [8 x float].
1792 /// A 256-bit vector of [8 x float].
1794 /// An immediate integer operand, with bits [4:0] specifying which comparison
1795 /// operation to use: \n
1796 /// 0x00: Equal (ordered, non-signaling) \n
1797 /// 0x01: Less-than (ordered, signaling) \n
1798 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1799 /// 0x03: Unordered (non-signaling) \n
1800 /// 0x04: Not-equal (unordered, non-signaling) \n
1801 /// 0x05: Not-less-than (unordered, signaling) \n
1802 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1803 /// 0x07: Ordered (non-signaling) \n
1804 /// 0x08: Equal (unordered, non-signaling) \n
1805 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1806 /// 0x0A: Not-greater-than (unordered, signaling) \n
1807 /// 0x0B: False (ordered, non-signaling) \n
1808 /// 0x0C: Not-equal (ordered, non-signaling) \n
1809 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1810 /// 0x0E: Greater-than (ordered, signaling) \n
1811 /// 0x0F: True (unordered, non-signaling) \n
1812 /// 0x10: Equal (ordered, signaling) \n
1813 /// 0x11: Less-than (ordered, non-signaling) \n
1814 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1815 /// 0x13: Unordered (signaling) \n
1816 /// 0x14: Not-equal (unordered, signaling) \n
1817 /// 0x15: Not-less-than (unordered, non-signaling) \n
1818 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1819 /// 0x17: Ordered (signaling) \n
1820 /// 0x18: Equal (unordered, signaling) \n
1821 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1822 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1823 /// 0x1B: False (ordered, signaling) \n
1824 /// 0x1C: Not-equal (ordered, signaling) \n
1825 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1826 /// 0x1E: Greater-than (ordered, non-signaling) \n
1827 /// 0x1F: True (unordered, signaling)
1828 /// \returns A 256-bit vector of [8 x float] containing the comparison results.
1829 #define _mm256_cmp_ps(a, b, c) \
1830 (__m256)__builtin_ia32_cmpps256((__v8sf)(__m256)(a), \
1831 (__v8sf)(__m256)(b), (c))
1833 /// Compares each of the corresponding scalar double-precision values of
1834 /// two 128-bit vectors of [2 x double], using the operation specified by the
1835 /// immediate integer operand.
1837 /// If the result is true, all 64 bits of the destination vector are set;
1838 /// otherwise they are cleared.
1840 /// \headerfile <x86intrin.h>
1843 /// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c);
1846 /// This intrinsic corresponds to the <c> VCMPSD </c> instruction.
1849 /// A 128-bit vector of [2 x double].
1851 /// A 128-bit vector of [2 x double].
1853 /// An immediate integer operand, with bits [4:0] specifying which comparison
1854 /// operation to use: \n
1855 /// 0x00: Equal (ordered, non-signaling) \n
1856 /// 0x01: Less-than (ordered, signaling) \n
1857 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1858 /// 0x03: Unordered (non-signaling) \n
1859 /// 0x04: Not-equal (unordered, non-signaling) \n
1860 /// 0x05: Not-less-than (unordered, signaling) \n
1861 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1862 /// 0x07: Ordered (non-signaling) \n
1863 /// 0x08: Equal (unordered, non-signaling) \n
1864 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1865 /// 0x0A: Not-greater-than (unordered, signaling) \n
1866 /// 0x0B: False (ordered, non-signaling) \n
1867 /// 0x0C: Not-equal (ordered, non-signaling) \n
1868 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1869 /// 0x0E: Greater-than (ordered, signaling) \n
1870 /// 0x0F: True (unordered, non-signaling) \n
1871 /// 0x10: Equal (ordered, signaling) \n
1872 /// 0x11: Less-than (ordered, non-signaling) \n
1873 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1874 /// 0x13: Unordered (signaling) \n
1875 /// 0x14: Not-equal (unordered, signaling) \n
1876 /// 0x15: Not-less-than (unordered, non-signaling) \n
1877 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1878 /// 0x17: Ordered (signaling) \n
1879 /// 0x18: Equal (unordered, signaling) \n
1880 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1881 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1882 /// 0x1B: False (ordered, signaling) \n
1883 /// 0x1C: Not-equal (ordered, signaling) \n
1884 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1885 /// 0x1E: Greater-than (ordered, non-signaling) \n
1886 /// 0x1F: True (unordered, signaling)
1887 /// \returns A 128-bit vector of [2 x double] containing the comparison results.
1888 #define _mm_cmp_sd(a, b, c) \
1889 (__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), \
1890 (__v2df)(__m128d)(b), (c))
1892 /// Compares each of the corresponding scalar values of two 128-bit
1893 /// vectors of [4 x float], using the operation specified by the immediate
1894 /// integer operand.
1896 /// If the result is true, all 32 bits of the destination vector are set;
1897 /// otherwise they are cleared.
1899 /// \headerfile <x86intrin.h>
1902 /// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c);
1905 /// This intrinsic corresponds to the <c> VCMPSS </c> instruction.
1908 /// A 128-bit vector of [4 x float].
1910 /// A 128-bit vector of [4 x float].
1912 /// An immediate integer operand, with bits [4:0] specifying which comparison
1913 /// operation to use: \n
1914 /// 0x00: Equal (ordered, non-signaling) \n
1915 /// 0x01: Less-than (ordered, signaling) \n
1916 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1917 /// 0x03: Unordered (non-signaling) \n
1918 /// 0x04: Not-equal (unordered, non-signaling) \n
1919 /// 0x05: Not-less-than (unordered, signaling) \n
1920 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1921 /// 0x07: Ordered (non-signaling) \n
1922 /// 0x08: Equal (unordered, non-signaling) \n
1923 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1924 /// 0x0A: Not-greater-than (unordered, signaling) \n
1925 /// 0x0B: False (ordered, non-signaling) \n
1926 /// 0x0C: Not-equal (ordered, non-signaling) \n
1927 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1928 /// 0x0E: Greater-than (ordered, signaling) \n
1929 /// 0x0F: True (unordered, non-signaling) \n
1930 /// 0x10: Equal (ordered, signaling) \n
1931 /// 0x11: Less-than (ordered, non-signaling) \n
1932 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1933 /// 0x13: Unordered (signaling) \n
1934 /// 0x14: Not-equal (unordered, signaling) \n
1935 /// 0x15: Not-less-than (unordered, non-signaling) \n
1936 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1937 /// 0x17: Ordered (signaling) \n
1938 /// 0x18: Equal (unordered, signaling) \n
1939 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1940 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1941 /// 0x1B: False (ordered, signaling) \n
1942 /// 0x1C: Not-equal (ordered, signaling) \n
1943 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1944 /// 0x1E: Greater-than (ordered, non-signaling) \n
1945 /// 0x1F: True (unordered, signaling)
1946 /// \returns A 128-bit vector of [4 x float] containing the comparison results.
1947 #define _mm_cmp_ss(a, b, c) \
1948 (__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), \
1949 (__v4sf)(__m128)(b), (c))
1951 /// Takes a [8 x i32] vector and returns the vector element value
1952 /// indexed by the immediate constant operand.
1954 /// \headerfile <x86intrin.h>
1956 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1960 /// A 256-bit vector of [8 x i32].
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
1966 #define _mm256_extract_epi32(X, N) \
1967 (int)__builtin_ia32_vec_ext_v8si((__v8si)(__m256i)(X), (int)(N))
1969 /// Takes a [16 x i16] vector and returns the vector element value
1970 /// indexed by the immediate constant operand.
1972 /// \headerfile <x86intrin.h>
1974 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1978 /// A 256-bit integer vector of [16 x i16].
1980 /// An immediate integer operand with bits [3:0] determining which vector
1981 /// element is extracted and returned.
1982 /// \returns A 32-bit integer containing the extracted 16 bits of zero extended
1984 #define _mm256_extract_epi16(X, N) \
1985 (int)(unsigned short)__builtin_ia32_vec_ext_v16hi((__v16hi)(__m256i)(X), \
1988 /// Takes a [32 x i8] vector and returns the vector element value
1989 /// indexed by the immediate constant operand.
1991 /// \headerfile <x86intrin.h>
1993 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1997 /// A 256-bit integer vector of [32 x i8].
1999 /// An immediate integer operand with bits [4:0] determining which vector
2000 /// element is extracted and returned.
2001 /// \returns A 32-bit integer containing the extracted 8 bits of zero extended
2003 #define _mm256_extract_epi8(X, N) \
2004 (int)(unsigned char)__builtin_ia32_vec_ext_v32qi((__v32qi)(__m256i)(X), \
2008 /// Takes a [4 x i64] vector and returns the vector element value
2009 /// indexed by the immediate constant operand.
2011 /// \headerfile <x86intrin.h>
2013 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2017 /// A 256-bit integer vector of [4 x i64].
2019 /// An immediate integer operand with bits [1:0] determining which vector
2020 /// element is extracted and returned.
2021 /// \returns A 64-bit integer containing the extracted 64 bits of extended
2023 #define _mm256_extract_epi64(X, N) \
2024 (long long)__builtin_ia32_vec_ext_v4di((__v4di)(__m256i)(X), (int)(N))
2027 /// Takes a [8 x i32] vector and replaces the vector element value
2028 /// indexed by the immediate constant operand by a new value. Returns the
2029 /// modified vector.
2031 /// \headerfile <x86intrin.h>
2033 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2037 /// A vector of [8 x i32] to be used by the insert operation.
2039 /// An integer value. The replacement value for the insert operation.
2041 /// An immediate integer specifying the index of the vector element to be
2043 /// \returns A copy of vector \a __a, after replacing its element indexed by
2044 /// \a __imm with \a __b.
2045 #define _mm256_insert_epi32(X, I, N) \
2046 (__m256i)__builtin_ia32_vec_set_v8si((__v8si)(__m256i)(X), \
2050 /// Takes a [16 x i16] vector and replaces the vector element value
2051 /// indexed by the immediate constant operand with a new value. Returns the
2052 /// modified vector.
2054 /// \headerfile <x86intrin.h>
2056 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2060 /// A vector of [16 x i16] to be used by the insert operation.
2062 /// An i16 integer value. The replacement value for the insert operation.
2064 /// An immediate integer specifying the index of the vector element to be
2066 /// \returns A copy of vector \a __a, after replacing its element indexed by
2067 /// \a __imm with \a __b.
2068 #define _mm256_insert_epi16(X, I, N) \
2069 (__m256i)__builtin_ia32_vec_set_v16hi((__v16hi)(__m256i)(X), \
2072 /// Takes a [32 x i8] vector and replaces the vector element value
2073 /// indexed by the immediate constant operand with a new value. Returns the
2074 /// modified vector.
2076 /// \headerfile <x86intrin.h>
2078 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2082 /// A vector of [32 x i8] to be used by the insert operation.
2084 /// An i8 integer value. The replacement value for the insert operation.
2086 /// An immediate integer specifying the index of the vector element to be
2088 /// \returns A copy of vector \a __a, after replacing its element indexed by
2089 /// \a __imm with \a __b.
2090 #define _mm256_insert_epi8(X, I, N) \
2091 (__m256i)__builtin_ia32_vec_set_v32qi((__v32qi)(__m256i)(X), \
2095 /// Takes a [4 x i64] vector and replaces the vector element value
2096 /// indexed by the immediate constant operand with a new value. Returns the
2097 /// modified vector.
2099 /// \headerfile <x86intrin.h>
2101 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2105 /// A vector of [4 x i64] to be used by the insert operation.
2107 /// A 64-bit integer value. The replacement value for the insert operation.
2109 /// An immediate integer specifying the index of the vector element to be
2111 /// \returns A copy of vector \a __a, after replacing its element indexed by
2112 /// \a __imm with \a __b.
2113 #define _mm256_insert_epi64(X, I, N) \
2114 (__m256i)__builtin_ia32_vec_set_v4di((__v4di)(__m256i)(X), \
2115 (long long)(I), (int)(N))
2119 /// Converts a vector of [4 x i32] into a vector of [4 x double].
2121 /// \headerfile <x86intrin.h>
2123 /// This intrinsic corresponds to the <c> VCVTDQ2PD </c> instruction.
2126 /// A 128-bit integer vector of [4 x i32].
2127 /// \returns A 256-bit vector of [4 x double] containing the converted values.
2128 static __inline __m256d __DEFAULT_FN_ATTRS
2129 _mm256_cvtepi32_pd(__m128i __a)
2131 return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
2134 /// Converts a vector of [8 x i32] into a vector of [8 x float].
2136 /// \headerfile <x86intrin.h>
2138 /// This intrinsic corresponds to the <c> VCVTDQ2PS </c> instruction.
2141 /// A 256-bit integer vector.
2142 /// \returns A 256-bit vector of [8 x float] containing the converted values.
2143 static __inline __m256 __DEFAULT_FN_ATTRS
2144 _mm256_cvtepi32_ps(__m256i __a)
2146 return (__m256)__builtin_convertvector((__v8si)__a, __v8sf);
2149 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
2152 /// \headerfile <x86intrin.h>
2154 /// This intrinsic corresponds to the <c> VCVTPD2PS </c> instruction.
2157 /// A 256-bit vector of [4 x double].
2158 /// \returns A 128-bit vector of [4 x float] containing the converted values.
2159 static __inline __m128 __DEFAULT_FN_ATTRS
2160 _mm256_cvtpd_ps(__m256d __a)
2162 return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
2165 /// Converts a vector of [8 x float] into a vector of [8 x i32].
2167 /// \headerfile <x86intrin.h>
2169 /// This intrinsic corresponds to the <c> VCVTPS2DQ </c> instruction.
2172 /// A 256-bit vector of [8 x float].
2173 /// \returns A 256-bit integer vector containing the converted values.
2174 static __inline __m256i __DEFAULT_FN_ATTRS
2175 _mm256_cvtps_epi32(__m256 __a)
2177 return (__m256i)__builtin_ia32_cvtps2dq256((__v8sf) __a);
2180 /// Converts a 128-bit vector of [4 x float] into a 256-bit vector of [4
2183 /// \headerfile <x86intrin.h>
2185 /// This intrinsic corresponds to the <c> VCVTPS2PD </c> instruction.
2188 /// A 128-bit vector of [4 x float].
2189 /// \returns A 256-bit vector of [4 x double] containing the converted values.
2190 static __inline __m256d __DEFAULT_FN_ATTRS
2191 _mm256_cvtps_pd(__m128 __a)
2193 return (__m256d)__builtin_convertvector((__v4sf)__a, __v4df);
2196 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
2197 /// x i32], truncating the result by rounding towards zero when it is
2200 /// \headerfile <x86intrin.h>
2202 /// This intrinsic corresponds to the <c> VCVTTPD2DQ </c> instruction.
2205 /// A 256-bit vector of [4 x double].
2206 /// \returns A 128-bit integer vector containing the converted values.
2207 static __inline __m128i __DEFAULT_FN_ATTRS
2208 _mm256_cvttpd_epi32(__m256d __a)
2210 return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
2213 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
2214 /// x i32]. When a conversion is inexact, the value returned is rounded
2215 /// according to the rounding control bits in the MXCSR register.
2217 /// \headerfile <x86intrin.h>
2219 /// This intrinsic corresponds to the <c> VCVTPD2DQ </c> instruction.
2222 /// A 256-bit vector of [4 x double].
2223 /// \returns A 128-bit integer vector containing the converted values.
2224 static __inline __m128i __DEFAULT_FN_ATTRS
2225 _mm256_cvtpd_epi32(__m256d __a)
2227 return (__m128i)__builtin_ia32_cvtpd2dq256((__v4df) __a);
2230 /// Converts a vector of [8 x float] into a vector of [8 x i32],
2231 /// truncating the result by rounding towards zero when it is inexact.
2233 /// \headerfile <x86intrin.h>
2235 /// This intrinsic corresponds to the <c> VCVTTPS2DQ </c> instruction.
2238 /// A 256-bit vector of [8 x float].
2239 /// \returns A 256-bit integer vector containing the converted values.
2240 static __inline __m256i __DEFAULT_FN_ATTRS
2241 _mm256_cvttps_epi32(__m256 __a)
2243 return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
2246 /// Returns the first element of the input vector of [4 x double].
2248 /// \headerfile <avxintrin.h>
2250 /// This intrinsic is a utility function and does not correspond to a specific
2254 /// A 256-bit vector of [4 x double].
2255 /// \returns A 64 bit double containing the first element of the input vector.
2256 static __inline double __DEFAULT_FN_ATTRS
2257 _mm256_cvtsd_f64(__m256d __a)
2262 /// Returns the first element of the input vector of [8 x i32].
2264 /// \headerfile <avxintrin.h>
2266 /// This intrinsic is a utility function and does not correspond to a specific
2270 /// A 256-bit vector of [8 x i32].
2271 /// \returns A 32 bit integer containing the first element of the input vector.
2272 static __inline int __DEFAULT_FN_ATTRS
2273 _mm256_cvtsi256_si32(__m256i __a)
2275 __v8si __b = (__v8si)__a;
2279 /// Returns the first element of the input vector of [8 x float].
2281 /// \headerfile <avxintrin.h>
2283 /// This intrinsic is a utility function and does not correspond to a specific
2287 /// A 256-bit vector of [8 x float].
2288 /// \returns A 32 bit float containing the first element of the input vector.
2289 static __inline float __DEFAULT_FN_ATTRS
2290 _mm256_cvtss_f32(__m256 __a)
2295 /* Vector replicate */
2296 /// Moves and duplicates odd-indexed values from a 256-bit vector of
2297 /// [8 x float] to float values in a 256-bit vector of [8 x float].
2299 /// \headerfile <x86intrin.h>
2301 /// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction.
2304 /// A 256-bit vector of [8 x float]. \n
2305 /// Bits [255:224] of \a __a are written to bits [255:224] and [223:192] of
2306 /// the return value. \n
2307 /// Bits [191:160] of \a __a are written to bits [191:160] and [159:128] of
2308 /// the return value. \n
2309 /// Bits [127:96] of \a __a are written to bits [127:96] and [95:64] of the
2310 /// return value. \n
2311 /// Bits [63:32] of \a __a are written to bits [63:32] and [31:0] of the
2313 /// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2315 static __inline __m256 __DEFAULT_FN_ATTRS
2316 _mm256_movehdup_ps(__m256 __a)
2318 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 1, 1, 3, 3, 5, 5, 7, 7);
2321 /// Moves and duplicates even-indexed values from a 256-bit vector of
2322 /// [8 x float] to float values in a 256-bit vector of [8 x float].
2324 /// \headerfile <x86intrin.h>
2326 /// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction.
2329 /// A 256-bit vector of [8 x float]. \n
2330 /// Bits [223:192] of \a __a are written to bits [255:224] and [223:192] of
2331 /// the return value. \n
2332 /// Bits [159:128] of \a __a are written to bits [191:160] and [159:128] of
2333 /// the return value. \n
2334 /// Bits [95:64] of \a __a are written to bits [127:96] and [95:64] of the
2335 /// return value. \n
2336 /// Bits [31:0] of \a __a are written to bits [63:32] and [31:0] of the
2338 /// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2340 static __inline __m256 __DEFAULT_FN_ATTRS
2341 _mm256_moveldup_ps(__m256 __a)
2343 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 0, 2, 2, 4, 4, 6, 6);
2346 /// Moves and duplicates double-precision floating point values from a
2347 /// 256-bit vector of [4 x double] to double-precision values in a 256-bit
2348 /// vector of [4 x double].
2350 /// \headerfile <x86intrin.h>
2352 /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction.
2355 /// A 256-bit vector of [4 x double]. \n
2356 /// Bits [63:0] of \a __a are written to bits [127:64] and [63:0] of the
2357 /// return value. \n
2358 /// Bits [191:128] of \a __a are written to bits [255:192] and [191:128] of
2359 /// the return value.
2360 /// \returns A 256-bit vector of [4 x double] containing the moved and
2361 /// duplicated values.
2362 static __inline __m256d __DEFAULT_FN_ATTRS
2363 _mm256_movedup_pd(__m256d __a)
2365 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 0, 2, 2);
2368 /* Unpack and Interleave */
2369 /// Unpacks the odd-indexed vector elements from two 256-bit vectors of
2370 /// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2372 /// \headerfile <x86intrin.h>
2374 /// This intrinsic corresponds to the <c> VUNPCKHPD </c> instruction.
2377 /// A 256-bit floating-point vector of [4 x double]. \n
2378 /// Bits [127:64] are written to bits [63:0] of the return value. \n
2379 /// Bits [255:192] are written to bits [191:128] of the return value. \n
2381 /// A 256-bit floating-point vector of [4 x double]. \n
2382 /// Bits [127:64] are written to bits [127:64] of the return value. \n
2383 /// Bits [255:192] are written to bits [255:192] of the return value. \n
2384 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2385 static __inline __m256d __DEFAULT_FN_ATTRS
2386 _mm256_unpackhi_pd(__m256d __a, __m256d __b)
2388 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 1, 5, 1+2, 5+2);
2391 /// Unpacks the even-indexed vector elements from two 256-bit vectors of
2392 /// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2394 /// \headerfile <x86intrin.h>
2396 /// This intrinsic corresponds to the <c> VUNPCKLPD </c> instruction.
2399 /// A 256-bit floating-point vector of [4 x double]. \n
2400 /// Bits [63:0] are written to bits [63:0] of the return value. \n
2401 /// Bits [191:128] are written to bits [191:128] of the return value.
2403 /// A 256-bit floating-point vector of [4 x double]. \n
2404 /// Bits [63:0] are written to bits [127:64] of the return value. \n
2405 /// Bits [191:128] are written to bits [255:192] of the return value. \n
2406 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2407 static __inline __m256d __DEFAULT_FN_ATTRS
2408 _mm256_unpacklo_pd(__m256d __a, __m256d __b)
2410 return __builtin_shufflevector((__v4df)__a, (__v4df)__b, 0, 4, 0+2, 4+2);
2413 /// Unpacks the 32-bit vector elements 2, 3, 6 and 7 from each of the
2414 /// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2415 /// vector of [8 x float].
2417 /// \headerfile <x86intrin.h>
2419 /// This intrinsic corresponds to the <c> VUNPCKHPS </c> instruction.
2422 /// A 256-bit vector of [8 x float]. \n
2423 /// Bits [95:64] are written to bits [31:0] of the return value. \n
2424 /// Bits [127:96] are written to bits [95:64] of the return value. \n
2425 /// Bits [223:192] are written to bits [159:128] of the return value. \n
2426 /// Bits [255:224] are written to bits [223:192] of the return value.
2428 /// A 256-bit vector of [8 x float]. \n
2429 /// Bits [95:64] are written to bits [63:32] of the return value. \n
2430 /// Bits [127:96] are written to bits [127:96] of the return value. \n
2431 /// Bits [223:192] are written to bits [191:160] of the return value. \n
2432 /// Bits [255:224] are written to bits [255:224] of the return value.
2433 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2434 static __inline __m256 __DEFAULT_FN_ATTRS
2435 _mm256_unpackhi_ps(__m256 __a, __m256 __b)
2437 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
2440 /// Unpacks the 32-bit vector elements 0, 1, 4 and 5 from each of the
2441 /// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2442 /// vector of [8 x float].
2444 /// \headerfile <x86intrin.h>
2446 /// This intrinsic corresponds to the <c> VUNPCKLPS </c> instruction.
2449 /// A 256-bit vector of [8 x float]. \n
2450 /// Bits [31:0] are written to bits [31:0] of the return value. \n
2451 /// Bits [63:32] are written to bits [95:64] of the return value. \n
2452 /// Bits [159:128] are written to bits [159:128] of the return value. \n
2453 /// Bits [191:160] are written to bits [223:192] of the return value.
2455 /// A 256-bit vector of [8 x float]. \n
2456 /// Bits [31:0] are written to bits [63:32] of the return value. \n
2457 /// Bits [63:32] are written to bits [127:96] of the return value. \n
2458 /// Bits [159:128] are written to bits [191:160] of the return value. \n
2459 /// Bits [191:160] are written to bits [255:224] of the return value.
2460 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2461 static __inline __m256 __DEFAULT_FN_ATTRS
2462 _mm256_unpacklo_ps(__m256 __a, __m256 __b)
2464 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
2468 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2469 /// element-by-element comparison of the double-precision element in the
2470 /// first source vector and the corresponding element in the second source
2473 /// The EFLAGS register is updated as follows: \n
2474 /// If there is at least one pair of double-precision elements where the
2475 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2476 /// ZF flag is set to 1. \n
2477 /// If there is at least one pair of double-precision elements where the
2478 /// sign-bit of the first element is 0 and the sign-bit of the second element
2479 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2480 /// This intrinsic returns the value of the ZF flag.
2482 /// \headerfile <x86intrin.h>
2484 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2487 /// A 128-bit vector of [2 x double].
2489 /// A 128-bit vector of [2 x double].
2490 /// \returns the ZF flag in the EFLAGS register.
2491 static __inline int __DEFAULT_FN_ATTRS128
2492 _mm_testz_pd(__m128d __a, __m128d __b)
2494 return __builtin_ia32_vtestzpd((__v2df)__a, (__v2df)__b);
2497 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2498 /// element-by-element comparison of the double-precision element in the
2499 /// first source vector and the corresponding element in the second source
2502 /// The EFLAGS register is updated as follows: \n
2503 /// If there is at least one pair of double-precision elements where the
2504 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2505 /// ZF flag is set to 1. \n
2506 /// If there is at least one pair of double-precision elements where the
2507 /// sign-bit of the first element is 0 and the sign-bit of the second element
2508 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2509 /// This intrinsic returns the value of the CF flag.
2511 /// \headerfile <x86intrin.h>
2513 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2516 /// A 128-bit vector of [2 x double].
2518 /// A 128-bit vector of [2 x double].
2519 /// \returns the CF flag in the EFLAGS register.
2520 static __inline int __DEFAULT_FN_ATTRS128
2521 _mm_testc_pd(__m128d __a, __m128d __b)
2523 return __builtin_ia32_vtestcpd((__v2df)__a, (__v2df)__b);
2526 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2527 /// element-by-element comparison of the double-precision element in the
2528 /// first source vector and the corresponding element in the second source
2531 /// The EFLAGS register is updated as follows: \n
2532 /// If there is at least one pair of double-precision elements where the
2533 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2534 /// ZF flag is set to 1. \n
2535 /// If there is at least one pair of double-precision elements where the
2536 /// sign-bit of the first element is 0 and the sign-bit of the second element
2537 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2538 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2539 /// otherwise it returns 0.
2541 /// \headerfile <x86intrin.h>
2543 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2546 /// A 128-bit vector of [2 x double].
2548 /// A 128-bit vector of [2 x double].
2549 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2550 static __inline int __DEFAULT_FN_ATTRS128
2551 _mm_testnzc_pd(__m128d __a, __m128d __b)
2553 return __builtin_ia32_vtestnzcpd((__v2df)__a, (__v2df)__b);
2556 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2557 /// element-by-element comparison of the single-precision element in the
2558 /// first source vector and the corresponding element in the second source
2561 /// The EFLAGS register is updated as follows: \n
2562 /// If there is at least one pair of single-precision elements where the
2563 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2564 /// ZF flag is set to 1. \n
2565 /// If there is at least one pair of single-precision elements where the
2566 /// sign-bit of the first element is 0 and the sign-bit of the second element
2567 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2568 /// This intrinsic returns the value of the ZF flag.
2570 /// \headerfile <x86intrin.h>
2572 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2575 /// A 128-bit vector of [4 x float].
2577 /// A 128-bit vector of [4 x float].
2578 /// \returns the ZF flag.
2579 static __inline int __DEFAULT_FN_ATTRS128
2580 _mm_testz_ps(__m128 __a, __m128 __b)
2582 return __builtin_ia32_vtestzps((__v4sf)__a, (__v4sf)__b);
2585 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2586 /// element-by-element comparison of the single-precision element in the
2587 /// first source vector and the corresponding element in the second source
2590 /// The EFLAGS register is updated as follows: \n
2591 /// If there is at least one pair of single-precision elements where the
2592 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2593 /// ZF flag is set to 1. \n
2594 /// If there is at least one pair of single-precision elements where the
2595 /// sign-bit of the first element is 0 and the sign-bit of the second element
2596 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2597 /// This intrinsic returns the value of the CF flag.
2599 /// \headerfile <x86intrin.h>
2601 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2604 /// A 128-bit vector of [4 x float].
2606 /// A 128-bit vector of [4 x float].
2607 /// \returns the CF flag.
2608 static __inline int __DEFAULT_FN_ATTRS128
2609 _mm_testc_ps(__m128 __a, __m128 __b)
2611 return __builtin_ia32_vtestcps((__v4sf)__a, (__v4sf)__b);
2614 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2615 /// element-by-element comparison of the single-precision element in the
2616 /// first source vector and the corresponding element in the second source
2619 /// The EFLAGS register is updated as follows: \n
2620 /// If there is at least one pair of single-precision elements where the
2621 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2622 /// ZF flag is set to 1. \n
2623 /// If there is at least one pair of single-precision elements where the
2624 /// sign-bit of the first element is 0 and the sign-bit of the second element
2625 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2626 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2627 /// otherwise it returns 0.
2629 /// \headerfile <x86intrin.h>
2631 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2634 /// A 128-bit vector of [4 x float].
2636 /// A 128-bit vector of [4 x float].
2637 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2638 static __inline int __DEFAULT_FN_ATTRS128
2639 _mm_testnzc_ps(__m128 __a, __m128 __b)
2641 return __builtin_ia32_vtestnzcps((__v4sf)__a, (__v4sf)__b);
2644 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2645 /// element-by-element comparison of the double-precision elements in the
2646 /// first source vector and the corresponding elements in the second source
2649 /// The EFLAGS register is updated as follows: \n
2650 /// If there is at least one pair of double-precision elements where the
2651 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2652 /// ZF flag is set to 1. \n
2653 /// If there is at least one pair of double-precision elements where the
2654 /// sign-bit of the first element is 0 and the sign-bit of the second element
2655 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2656 /// This intrinsic returns the value of the ZF flag.
2658 /// \headerfile <x86intrin.h>
2660 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2663 /// A 256-bit vector of [4 x double].
2665 /// A 256-bit vector of [4 x double].
2666 /// \returns the ZF flag.
2667 static __inline int __DEFAULT_FN_ATTRS
2668 _mm256_testz_pd(__m256d __a, __m256d __b)
2670 return __builtin_ia32_vtestzpd256((__v4df)__a, (__v4df)__b);
2673 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2674 /// element-by-element comparison of the double-precision elements in the
2675 /// first source vector and the corresponding elements in the second source
2678 /// The EFLAGS register is updated as follows: \n
2679 /// If there is at least one pair of double-precision elements where the
2680 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2681 /// ZF flag is set to 1. \n
2682 /// If there is at least one pair of double-precision elements where the
2683 /// sign-bit of the first element is 0 and the sign-bit of the second element
2684 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2685 /// This intrinsic returns the value of the CF flag.
2687 /// \headerfile <x86intrin.h>
2689 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2692 /// A 256-bit vector of [4 x double].
2694 /// A 256-bit vector of [4 x double].
2695 /// \returns the CF flag.
2696 static __inline int __DEFAULT_FN_ATTRS
2697 _mm256_testc_pd(__m256d __a, __m256d __b)
2699 return __builtin_ia32_vtestcpd256((__v4df)__a, (__v4df)__b);
2702 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2703 /// element-by-element comparison of the double-precision elements in the
2704 /// first source vector and the corresponding elements in the second source
2707 /// The EFLAGS register is updated as follows: \n
2708 /// If there is at least one pair of double-precision elements where the
2709 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2710 /// ZF flag is set to 1. \n
2711 /// If there is at least one pair of double-precision elements where the
2712 /// sign-bit of the first element is 0 and the sign-bit of the second element
2713 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2714 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2715 /// otherwise it returns 0.
2717 /// \headerfile <x86intrin.h>
2719 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2722 /// A 256-bit vector of [4 x double].
2724 /// A 256-bit vector of [4 x double].
2725 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2726 static __inline int __DEFAULT_FN_ATTRS
2727 _mm256_testnzc_pd(__m256d __a, __m256d __b)
2729 return __builtin_ia32_vtestnzcpd256((__v4df)__a, (__v4df)__b);
2732 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2733 /// element-by-element comparison of the single-precision element in the
2734 /// first source vector and the corresponding element in the second source
2737 /// The EFLAGS register is updated as follows: \n
2738 /// If there is at least one pair of single-precision elements where the
2739 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2740 /// ZF flag is set to 1. \n
2741 /// If there is at least one pair of single-precision elements where the
2742 /// sign-bit of the first element is 0 and the sign-bit of the second element
2743 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2744 /// This intrinsic returns the value of the ZF flag.
2746 /// \headerfile <x86intrin.h>
2748 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2751 /// A 256-bit vector of [8 x float].
2753 /// A 256-bit vector of [8 x float].
2754 /// \returns the ZF flag.
2755 static __inline int __DEFAULT_FN_ATTRS
2756 _mm256_testz_ps(__m256 __a, __m256 __b)
2758 return __builtin_ia32_vtestzps256((__v8sf)__a, (__v8sf)__b);
2761 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2762 /// element-by-element comparison of the single-precision element in the
2763 /// first source vector and the corresponding element in the second source
2766 /// The EFLAGS register is updated as follows: \n
2767 /// If there is at least one pair of single-precision elements where the
2768 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2769 /// ZF flag is set to 1. \n
2770 /// If there is at least one pair of single-precision elements where the
2771 /// sign-bit of the first element is 0 and the sign-bit of the second element
2772 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2773 /// This intrinsic returns the value of the CF flag.
2775 /// \headerfile <x86intrin.h>
2777 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2780 /// A 256-bit vector of [8 x float].
2782 /// A 256-bit vector of [8 x float].
2783 /// \returns the CF flag.
2784 static __inline int __DEFAULT_FN_ATTRS
2785 _mm256_testc_ps(__m256 __a, __m256 __b)
2787 return __builtin_ia32_vtestcps256((__v8sf)__a, (__v8sf)__b);
2790 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2791 /// element-by-element comparison of the single-precision elements in the
2792 /// first source vector and the corresponding elements in the second source
2795 /// The EFLAGS register is updated as follows: \n
2796 /// If there is at least one pair of single-precision elements where the
2797 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2798 /// ZF flag is set to 1. \n
2799 /// If there is at least one pair of single-precision elements where the
2800 /// sign-bit of the first element is 0 and the sign-bit of the second element
2801 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2802 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2803 /// otherwise it returns 0.
2805 /// \headerfile <x86intrin.h>
2807 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2810 /// A 256-bit vector of [8 x float].
2812 /// A 256-bit vector of [8 x float].
2813 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2814 static __inline int __DEFAULT_FN_ATTRS
2815 _mm256_testnzc_ps(__m256 __a, __m256 __b)
2817 return __builtin_ia32_vtestnzcps256((__v8sf)__a, (__v8sf)__b);
2820 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2821 /// of the two source vectors.
2823 /// The EFLAGS register is updated as follows: \n
2824 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2825 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2826 /// If there is at least one pair of bits where the bit from the first source
2827 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2828 /// is set to 0. Otherwise the CF flag is set to 1. \n
2829 /// This intrinsic returns the value of the ZF flag.
2831 /// \headerfile <x86intrin.h>
2833 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2836 /// A 256-bit integer vector.
2838 /// A 256-bit integer vector.
2839 /// \returns the ZF flag.
2840 static __inline int __DEFAULT_FN_ATTRS
2841 _mm256_testz_si256(__m256i __a, __m256i __b)
2843 return __builtin_ia32_ptestz256((__v4di)__a, (__v4di)__b);
2846 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2847 /// of the two source vectors.
2849 /// The EFLAGS register is updated as follows: \n
2850 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2851 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2852 /// If there is at least one pair of bits where the bit from the first source
2853 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2854 /// is set to 0. Otherwise the CF flag is set to 1. \n
2855 /// This intrinsic returns the value of the CF flag.
2857 /// \headerfile <x86intrin.h>
2859 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2862 /// A 256-bit integer vector.
2864 /// A 256-bit integer vector.
2865 /// \returns the CF flag.
2866 static __inline int __DEFAULT_FN_ATTRS
2867 _mm256_testc_si256(__m256i __a, __m256i __b)
2869 return __builtin_ia32_ptestc256((__v4di)__a, (__v4di)__b);
2872 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2873 /// of the two source vectors.
2875 /// The EFLAGS register is updated as follows: \n
2876 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2877 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2878 /// If there is at least one pair of bits where the bit from the first source
2879 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2880 /// is set to 0. Otherwise the CF flag is set to 1. \n
2881 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2882 /// otherwise it returns 0.
2884 /// \headerfile <x86intrin.h>
2886 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2889 /// A 256-bit integer vector.
2891 /// A 256-bit integer vector.
2892 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2893 static __inline int __DEFAULT_FN_ATTRS
2894 _mm256_testnzc_si256(__m256i __a, __m256i __b)
2896 return __builtin_ia32_ptestnzc256((__v4di)__a, (__v4di)__b);
2899 /* Vector extract sign mask */
2900 /// Extracts the sign bits of double-precision floating point elements
2901 /// in a 256-bit vector of [4 x double] and writes them to the lower order
2902 /// bits of the return value.
2904 /// \headerfile <x86intrin.h>
2906 /// This intrinsic corresponds to the <c> VMOVMSKPD </c> instruction.
2909 /// A 256-bit vector of [4 x double] containing the double-precision
2910 /// floating point values with sign bits to be extracted.
2911 /// \returns The sign bits from the operand, written to bits [3:0].
2912 static __inline int __DEFAULT_FN_ATTRS
2913 _mm256_movemask_pd(__m256d __a)
2915 return __builtin_ia32_movmskpd256((__v4df)__a);
2918 /// Extracts the sign bits of single-precision floating point elements
2919 /// in a 256-bit vector of [8 x float] and writes them to the lower order
2920 /// bits of the return value.
2922 /// \headerfile <x86intrin.h>
2924 /// This intrinsic corresponds to the <c> VMOVMSKPS </c> instruction.
2927 /// A 256-bit vector of [8 x float] containing the single-precision floating
2928 /// point values with sign bits to be extracted.
2929 /// \returns The sign bits from the operand, written to bits [7:0].
2930 static __inline int __DEFAULT_FN_ATTRS
2931 _mm256_movemask_ps(__m256 __a)
2933 return __builtin_ia32_movmskps256((__v8sf)__a);
2937 /// Zeroes the contents of all XMM or YMM registers.
2939 /// \headerfile <x86intrin.h>
2941 /// This intrinsic corresponds to the <c> VZEROALL </c> instruction.
2942 static __inline void __attribute__((__always_inline__, __nodebug__, __target__("avx")))
2943 _mm256_zeroall(void)
2945 __builtin_ia32_vzeroall();
2948 /// Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
2950 /// \headerfile <x86intrin.h>
2952 /// This intrinsic corresponds to the <c> VZEROUPPER </c> instruction.
2953 static __inline void __attribute__((__always_inline__, __nodebug__, __target__("avx")))
2954 _mm256_zeroupper(void)
2956 __builtin_ia32_vzeroupper();
2959 /* Vector load with broadcast */
2960 /// Loads a scalar single-precision floating point value from the
2961 /// specified address pointed to by \a __a and broadcasts it to the elements
2962 /// of a [4 x float] vector.
2964 /// \headerfile <x86intrin.h>
2966 /// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
2969 /// The single-precision floating point value to be broadcast.
2970 /// \returns A 128-bit vector of [4 x float] whose 32-bit elements are set
2971 /// equal to the broadcast value.
2972 static __inline __m128 __DEFAULT_FN_ATTRS128
2973 _mm_broadcast_ss(float const *__a)
2976 return __extension__ (__m128)(__v4sf){ __f, __f, __f, __f };
2979 /// Loads a scalar double-precision floating point value from the
2980 /// specified address pointed to by \a __a and broadcasts it to the elements
2981 /// of a [4 x double] vector.
2983 /// \headerfile <x86intrin.h>
2985 /// This intrinsic corresponds to the <c> VBROADCASTSD </c> instruction.
2988 /// The double-precision floating point value to be broadcast.
2989 /// \returns A 256-bit vector of [4 x double] whose 64-bit elements are set
2990 /// equal to the broadcast value.
2991 static __inline __m256d __DEFAULT_FN_ATTRS
2992 _mm256_broadcast_sd(double const *__a)
2995 return __extension__ (__m256d)(__v4df){ __d, __d, __d, __d };
2998 /// Loads a scalar single-precision floating point value from the
2999 /// specified address pointed to by \a __a and broadcasts it to the elements
3000 /// of a [8 x float] vector.
3002 /// \headerfile <x86intrin.h>
3004 /// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
3007 /// The single-precision floating point value to be broadcast.
3008 /// \returns A 256-bit vector of [8 x float] whose 32-bit elements are set
3009 /// equal to the broadcast value.
3010 static __inline __m256 __DEFAULT_FN_ATTRS
3011 _mm256_broadcast_ss(float const *__a)
3014 return __extension__ (__m256)(__v8sf){ __f, __f, __f, __f, __f, __f, __f, __f };
3017 /// Loads the data from a 128-bit vector of [2 x double] from the
3018 /// specified address pointed to by \a __a and broadcasts it to 128-bit
3019 /// elements in a 256-bit vector of [4 x double].
3021 /// \headerfile <x86intrin.h>
3023 /// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3026 /// The 128-bit vector of [2 x double] to be broadcast.
3027 /// \returns A 256-bit vector of [4 x double] whose 128-bit elements are set
3028 /// equal to the broadcast value.
3029 static __inline __m256d __DEFAULT_FN_ATTRS
3030 _mm256_broadcast_pd(__m128d const *__a)
3032 __m128d __b = _mm_loadu_pd((const double *)__a);
3033 return (__m256d)__builtin_shufflevector((__v2df)__b, (__v2df)__b,
3037 /// Loads the data from a 128-bit vector of [4 x float] from the
3038 /// specified address pointed to by \a __a and broadcasts it to 128-bit
3039 /// elements in a 256-bit vector of [8 x float].
3041 /// \headerfile <x86intrin.h>
3043 /// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3046 /// The 128-bit vector of [4 x float] to be broadcast.
3047 /// \returns A 256-bit vector of [8 x float] whose 128-bit elements are set
3048 /// equal to the broadcast value.
3049 static __inline __m256 __DEFAULT_FN_ATTRS
3050 _mm256_broadcast_ps(__m128 const *__a)
3052 __m128 __b = _mm_loadu_ps((const float *)__a);
3053 return (__m256)__builtin_shufflevector((__v4sf)__b, (__v4sf)__b,
3054 0, 1, 2, 3, 0, 1, 2, 3);
3058 /// Loads 4 double-precision floating point values from a 32-byte aligned
3059 /// memory location pointed to by \a __p into a vector of [4 x double].
3061 /// \headerfile <x86intrin.h>
3063 /// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3066 /// A 32-byte aligned pointer to a memory location containing
3067 /// double-precision floating point values.
3068 /// \returns A 256-bit vector of [4 x double] containing the moved values.
3069 static __inline __m256d __DEFAULT_FN_ATTRS
3070 _mm256_load_pd(double const *__p)
3072 return *(__m256d *)__p;
3075 /// Loads 8 single-precision floating point values from a 32-byte aligned
3076 /// memory location pointed to by \a __p into a vector of [8 x float].
3078 /// \headerfile <x86intrin.h>
3080 /// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3083 /// A 32-byte aligned pointer to a memory location containing float values.
3084 /// \returns A 256-bit vector of [8 x float] containing the moved values.
3085 static __inline __m256 __DEFAULT_FN_ATTRS
3086 _mm256_load_ps(float const *__p)
3088 return *(__m256 *)__p;
3091 /// Loads 4 double-precision floating point values from an unaligned
3092 /// memory location pointed to by \a __p into a vector of [4 x double].
3094 /// \headerfile <x86intrin.h>
3096 /// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3099 /// A pointer to a memory location containing double-precision floating
3101 /// \returns A 256-bit vector of [4 x double] containing the moved values.
3102 static __inline __m256d __DEFAULT_FN_ATTRS
3103 _mm256_loadu_pd(double const *__p)
3107 } __attribute__((__packed__, __may_alias__));
3108 return ((struct __loadu_pd*)__p)->__v;
3111 /// Loads 8 single-precision floating point values from an unaligned
3112 /// memory location pointed to by \a __p into a vector of [8 x float].
3114 /// \headerfile <x86intrin.h>
3116 /// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3119 /// A pointer to a memory location containing single-precision floating
3121 /// \returns A 256-bit vector of [8 x float] containing the moved values.
3122 static __inline __m256 __DEFAULT_FN_ATTRS
3123 _mm256_loadu_ps(float const *__p)
3127 } __attribute__((__packed__, __may_alias__));
3128 return ((struct __loadu_ps*)__p)->__v;
3131 /// Loads 256 bits of integer data from a 32-byte aligned memory
3132 /// location pointed to by \a __p into elements of a 256-bit integer vector.
3134 /// \headerfile <x86intrin.h>
3136 /// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3139 /// A 32-byte aligned pointer to a 256-bit integer vector containing integer
3141 /// \returns A 256-bit integer vector containing the moved values.
3142 static __inline __m256i __DEFAULT_FN_ATTRS
3143 _mm256_load_si256(__m256i const *__p)
3148 /// Loads 256 bits of integer data from an unaligned memory location
3149 /// pointed to by \a __p into a 256-bit integer vector.
3151 /// \headerfile <x86intrin.h>
3153 /// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3156 /// A pointer to a 256-bit integer vector containing integer values.
3157 /// \returns A 256-bit integer vector containing the moved values.
3158 static __inline __m256i __DEFAULT_FN_ATTRS
3159 _mm256_loadu_si256(__m256i_u const *__p)
3161 struct __loadu_si256 {
3163 } __attribute__((__packed__, __may_alias__));
3164 return ((struct __loadu_si256*)__p)->__v;
3167 /// Loads 256 bits of integer data from an unaligned memory location
3168 /// pointed to by \a __p into a 256-bit integer vector. This intrinsic may
3169 /// perform better than \c _mm256_loadu_si256 when the data crosses a cache
3172 /// \headerfile <x86intrin.h>
3174 /// This intrinsic corresponds to the <c> VLDDQU </c> instruction.
3177 /// A pointer to a 256-bit integer vector containing integer values.
3178 /// \returns A 256-bit integer vector containing the moved values.
3179 static __inline __m256i __DEFAULT_FN_ATTRS
3180 _mm256_lddqu_si256(__m256i const *__p)
3182 return (__m256i)__builtin_ia32_lddqu256((char const *)__p);
3185 /* SIMD store ops */
3186 /// Stores double-precision floating point values from a 256-bit vector
3187 /// of [4 x double] to a 32-byte aligned memory location pointed to by
3190 /// \headerfile <x86intrin.h>
3192 /// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3195 /// A 32-byte aligned pointer to a memory location that will receive the
3196 /// double-precision floaing point values.
3198 /// A 256-bit vector of [4 x double] containing the values to be moved.
3199 static __inline void __DEFAULT_FN_ATTRS
3200 _mm256_store_pd(double *__p, __m256d __a)
3202 *(__m256d *)__p = __a;
3205 /// Stores single-precision floating point values from a 256-bit vector
3206 /// of [8 x float] to a 32-byte aligned memory location pointed to by \a __p.
3208 /// \headerfile <x86intrin.h>
3210 /// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3213 /// A 32-byte aligned pointer to a memory location that will receive the
3216 /// A 256-bit vector of [8 x float] containing the values to be moved.
3217 static __inline void __DEFAULT_FN_ATTRS
3218 _mm256_store_ps(float *__p, __m256 __a)
3220 *(__m256 *)__p = __a;
3223 /// Stores double-precision floating point values from a 256-bit vector
3224 /// of [4 x double] to an unaligned memory location pointed to by \a __p.
3226 /// \headerfile <x86intrin.h>
3228 /// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3231 /// A pointer to a memory location that will receive the double-precision
3232 /// floating point values.
3234 /// A 256-bit vector of [4 x double] containing the values to be moved.
3235 static __inline void __DEFAULT_FN_ATTRS
3236 _mm256_storeu_pd(double *__p, __m256d __a)
3238 struct __storeu_pd {
3240 } __attribute__((__packed__, __may_alias__));
3241 ((struct __storeu_pd*)__p)->__v = __a;
3244 /// Stores single-precision floating point values from a 256-bit vector
3245 /// of [8 x float] to an unaligned memory location pointed to by \a __p.
3247 /// \headerfile <x86intrin.h>
3249 /// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3252 /// A pointer to a memory location that will receive the float values.
3254 /// A 256-bit vector of [8 x float] containing the values to be moved.
3255 static __inline void __DEFAULT_FN_ATTRS
3256 _mm256_storeu_ps(float *__p, __m256 __a)
3258 struct __storeu_ps {
3260 } __attribute__((__packed__, __may_alias__));
3261 ((struct __storeu_ps*)__p)->__v = __a;
3264 /// Stores integer values from a 256-bit integer vector to a 32-byte
3265 /// aligned memory location pointed to by \a __p.
3267 /// \headerfile <x86intrin.h>
3269 /// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3272 /// A 32-byte aligned pointer to a memory location that will receive the
3275 /// A 256-bit integer vector containing the values to be moved.
3276 static __inline void __DEFAULT_FN_ATTRS
3277 _mm256_store_si256(__m256i *__p, __m256i __a)
3282 /// Stores integer values from a 256-bit integer vector to an unaligned
3283 /// memory location pointed to by \a __p.
3285 /// \headerfile <x86intrin.h>
3287 /// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3290 /// A pointer to a memory location that will receive the integer values.
3292 /// A 256-bit integer vector containing the values to be moved.
3293 static __inline void __DEFAULT_FN_ATTRS
3294 _mm256_storeu_si256(__m256i_u *__p, __m256i __a)
3296 struct __storeu_si256 {
3298 } __attribute__((__packed__, __may_alias__));
3299 ((struct __storeu_si256*)__p)->__v = __a;
3302 /* Conditional load ops */
3303 /// Conditionally loads double-precision floating point elements from a
3304 /// memory location pointed to by \a __p into a 128-bit vector of
3305 /// [2 x double], depending on the mask bits associated with each data
3308 /// \headerfile <x86intrin.h>
3310 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3313 /// A pointer to a memory location that contains the double-precision
3314 /// floating point values.
3316 /// A 128-bit integer vector containing the mask. The most significant bit of
3317 /// each data element represents the mask bits. If a mask bit is zero, the
3318 /// corresponding value in the memory location is not loaded and the
3319 /// corresponding field in the return value is set to zero.
3320 /// \returns A 128-bit vector of [2 x double] containing the loaded values.
3321 static __inline __m128d __DEFAULT_FN_ATTRS128
3322 _mm_maskload_pd(double const *__p, __m128i __m)
3324 return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2di)__m);
3327 /// Conditionally loads double-precision floating point elements from a
3328 /// memory location pointed to by \a __p into a 256-bit vector of
3329 /// [4 x double], depending on the mask bits associated with each data
3332 /// \headerfile <x86intrin.h>
3334 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3337 /// A pointer to a memory location that contains the double-precision
3338 /// floating point values.
3340 /// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3341 /// significant bit of each quadword element represents the mask bits. If a
3342 /// mask bit is zero, the corresponding value in the memory location is not
3343 /// loaded and the corresponding field in the return value is set to zero.
3344 /// \returns A 256-bit vector of [4 x double] containing the loaded values.
3345 static __inline __m256d __DEFAULT_FN_ATTRS
3346 _mm256_maskload_pd(double const *__p, __m256i __m)
3348 return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)__p,
3352 /// Conditionally loads single-precision floating point elements from a
3353 /// memory location pointed to by \a __p into a 128-bit vector of
3354 /// [4 x float], depending on the mask bits associated with each data
3357 /// \headerfile <x86intrin.h>
3359 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3362 /// A pointer to a memory location that contains the single-precision
3363 /// floating point values.
3365 /// A 128-bit integer vector containing the mask. The most significant bit of
3366 /// each data element represents the mask bits. If a mask bit is zero, the
3367 /// corresponding value in the memory location is not loaded and the
3368 /// corresponding field in the return value is set to zero.
3369 /// \returns A 128-bit vector of [4 x float] containing the loaded values.
3370 static __inline __m128 __DEFAULT_FN_ATTRS128
3371 _mm_maskload_ps(float const *__p, __m128i __m)
3373 return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4si)__m);
3376 /// Conditionally loads single-precision floating point elements from a
3377 /// memory location pointed to by \a __p into a 256-bit vector of
3378 /// [8 x float], depending on the mask bits associated with each data
3381 /// \headerfile <x86intrin.h>
3383 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3386 /// A pointer to a memory location that contains the single-precision
3387 /// floating point values.
3389 /// A 256-bit integer vector of [8 x dword] containing the mask. The most
3390 /// significant bit of each dword element represents the mask bits. If a mask
3391 /// bit is zero, the corresponding value in the memory location is not loaded
3392 /// and the corresponding field in the return value is set to zero.
3393 /// \returns A 256-bit vector of [8 x float] containing the loaded values.
3394 static __inline __m256 __DEFAULT_FN_ATTRS
3395 _mm256_maskload_ps(float const *__p, __m256i __m)
3397 return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8si)__m);
3400 /* Conditional store ops */
3401 /// Moves single-precision floating point values from a 256-bit vector
3402 /// of [8 x float] to a memory location pointed to by \a __p, according to
3403 /// the specified mask.
3405 /// \headerfile <x86intrin.h>
3407 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3410 /// A pointer to a memory location that will receive the float values.
3412 /// A 256-bit integer vector of [8 x dword] containing the mask. The most
3413 /// significant bit of each dword element in the mask vector represents the
3414 /// mask bits. If a mask bit is zero, the corresponding value from vector
3415 /// \a __a is not stored and the corresponding field in the memory location
3416 /// pointed to by \a __p is not changed.
3418 /// A 256-bit vector of [8 x float] containing the values to be stored.
3419 static __inline void __DEFAULT_FN_ATTRS
3420 _mm256_maskstore_ps(float *__p, __m256i __m, __m256 __a)
3422 __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8si)__m, (__v8sf)__a);
3425 /// Moves double-precision values from a 128-bit vector of [2 x double]
3426 /// to a memory location pointed to by \a __p, according to the specified
3429 /// \headerfile <x86intrin.h>
3431 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3434 /// A pointer to a memory location that will receive the float values.
3436 /// A 128-bit integer vector containing the mask. The most significant bit of
3437 /// each field in the mask vector represents the mask bits. If a mask bit is
3438 /// zero, the corresponding value from vector \a __a is not stored and the
3439 /// corresponding field in the memory location pointed to by \a __p is not
3442 /// A 128-bit vector of [2 x double] containing the values to be stored.
3443 static __inline void __DEFAULT_FN_ATTRS128
3444 _mm_maskstore_pd(double *__p, __m128i __m, __m128d __a)
3446 __builtin_ia32_maskstorepd((__v2df *)__p, (__v2di)__m, (__v2df)__a);
3449 /// Moves double-precision values from a 256-bit vector of [4 x double]
3450 /// to a memory location pointed to by \a __p, according to the specified
3453 /// \headerfile <x86intrin.h>
3455 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3458 /// A pointer to a memory location that will receive the float values.
3460 /// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3461 /// significant bit of each quadword element in the mask vector represents
3462 /// the mask bits. If a mask bit is zero, the corresponding value from vector
3463 /// __a is not stored and the corresponding field in the memory location
3464 /// pointed to by \a __p is not changed.
3466 /// A 256-bit vector of [4 x double] containing the values to be stored.
3467 static __inline void __DEFAULT_FN_ATTRS
3468 _mm256_maskstore_pd(double *__p, __m256i __m, __m256d __a)
3470 __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4di)__m, (__v4df)__a);
3473 /// Moves single-precision floating point values from a 128-bit vector
3474 /// of [4 x float] to a memory location pointed to by \a __p, according to
3475 /// the specified mask.
3477 /// \headerfile <x86intrin.h>
3479 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3482 /// A pointer to a memory location that will receive the float values.
3484 /// A 128-bit integer vector containing the mask. The most significant bit of
3485 /// each field in the mask vector represents the mask bits. If a mask bit is
3486 /// zero, the corresponding value from vector __a is not stored and the
3487 /// corresponding field in the memory location pointed to by \a __p is not
3490 /// A 128-bit vector of [4 x float] containing the values to be stored.
3491 static __inline void __DEFAULT_FN_ATTRS128
3492 _mm_maskstore_ps(float *__p, __m128i __m, __m128 __a)
3494 __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4si)__m, (__v4sf)__a);
3497 /* Cacheability support ops */
3498 /// Moves integer data from a 256-bit integer vector to a 32-byte
3499 /// aligned memory location. To minimize caching, the data is flagged as
3500 /// non-temporal (unlikely to be used again soon).
3502 /// \headerfile <x86intrin.h>
3504 /// This intrinsic corresponds to the <c> VMOVNTDQ </c> instruction.
3507 /// A pointer to a 32-byte aligned memory location that will receive the
3510 /// A 256-bit integer vector containing the values to be moved.
3511 static __inline void __DEFAULT_FN_ATTRS
3512 _mm256_stream_si256(__m256i *__a, __m256i __b)
3514 typedef __v4di __v4di_aligned __attribute__((aligned(32)));
3515 __builtin_nontemporal_store((__v4di_aligned)__b, (__v4di_aligned*)__a);
3518 /// Moves double-precision values from a 256-bit vector of [4 x double]
3519 /// to a 32-byte aligned memory location. To minimize caching, the data is
3520 /// flagged as non-temporal (unlikely to be used again soon).
3522 /// \headerfile <x86intrin.h>
3524 /// This intrinsic corresponds to the <c> VMOVNTPD </c> instruction.
3527 /// A pointer to a 32-byte aligned memory location that will receive the
3528 /// double-precision floating-point values.
3530 /// A 256-bit vector of [4 x double] containing the values to be moved.
3531 static __inline void __DEFAULT_FN_ATTRS
3532 _mm256_stream_pd(double *__a, __m256d __b)
3534 typedef __v4df __v4df_aligned __attribute__((aligned(32)));
3535 __builtin_nontemporal_store((__v4df_aligned)__b, (__v4df_aligned*)__a);
3538 /// Moves single-precision floating point values from a 256-bit vector
3539 /// of [8 x float] to a 32-byte aligned memory location. To minimize
3540 /// caching, the data is flagged as non-temporal (unlikely to be used again
3543 /// \headerfile <x86intrin.h>
3545 /// This intrinsic corresponds to the <c> VMOVNTPS </c> instruction.
3548 /// A pointer to a 32-byte aligned memory location that will receive the
3549 /// single-precision floating point values.
3551 /// A 256-bit vector of [8 x float] containing the values to be moved.
3552 static __inline void __DEFAULT_FN_ATTRS
3553 _mm256_stream_ps(float *__p, __m256 __a)
3555 typedef __v8sf __v8sf_aligned __attribute__((aligned(32)));
3556 __builtin_nontemporal_store((__v8sf_aligned)__a, (__v8sf_aligned*)__p);
3559 /* Create vectors */
3560 /// Create a 256-bit vector of [4 x double] with undefined values.
3562 /// \headerfile <x86intrin.h>
3564 /// This intrinsic has no corresponding instruction.
3566 /// \returns A 256-bit vector of [4 x double] containing undefined values.
3567 static __inline__ __m256d __DEFAULT_FN_ATTRS
3568 _mm256_undefined_pd(void)
3570 return (__m256d)__builtin_ia32_undef256();
3573 /// Create a 256-bit vector of [8 x float] with undefined values.
3575 /// \headerfile <x86intrin.h>
3577 /// This intrinsic has no corresponding instruction.
3579 /// \returns A 256-bit vector of [8 x float] containing undefined values.
3580 static __inline__ __m256 __DEFAULT_FN_ATTRS
3581 _mm256_undefined_ps(void)
3583 return (__m256)__builtin_ia32_undef256();
3586 /// Create a 256-bit integer vector with undefined values.
3588 /// \headerfile <x86intrin.h>
3590 /// This intrinsic has no corresponding instruction.
3592 /// \returns A 256-bit integer vector containing undefined values.
3593 static __inline__ __m256i __DEFAULT_FN_ATTRS
3594 _mm256_undefined_si256(void)
3596 return (__m256i)__builtin_ia32_undef256();
3599 /// Constructs a 256-bit floating-point vector of [4 x double]
3600 /// initialized with the specified double-precision floating-point values.
3602 /// \headerfile <x86intrin.h>
3604 /// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3608 /// A double-precision floating-point value used to initialize bits [255:192]
3611 /// A double-precision floating-point value used to initialize bits [191:128]
3614 /// A double-precision floating-point value used to initialize bits [127:64]
3617 /// A double-precision floating-point value used to initialize bits [63:0]
3619 /// \returns An initialized 256-bit floating-point vector of [4 x double].
3620 static __inline __m256d __DEFAULT_FN_ATTRS
3621 _mm256_set_pd(double __a, double __b, double __c, double __d)
3623 return __extension__ (__m256d){ __d, __c, __b, __a };
3626 /// Constructs a 256-bit floating-point vector of [8 x float] initialized
3627 /// with the specified single-precision floating-point values.
3629 /// \headerfile <x86intrin.h>
3631 /// This intrinsic is a utility function and does not correspond to a specific
3635 /// A single-precision floating-point value used to initialize bits [255:224]
3638 /// A single-precision floating-point value used to initialize bits [223:192]
3641 /// A single-precision floating-point value used to initialize bits [191:160]
3644 /// A single-precision floating-point value used to initialize bits [159:128]
3647 /// A single-precision floating-point value used to initialize bits [127:96]
3650 /// A single-precision floating-point value used to initialize bits [95:64]
3653 /// A single-precision floating-point value used to initialize bits [63:32]
3656 /// A single-precision floating-point value used to initialize bits [31:0]
3658 /// \returns An initialized 256-bit floating-point vector of [8 x float].
3659 static __inline __m256 __DEFAULT_FN_ATTRS
3660 _mm256_set_ps(float __a, float __b, float __c, float __d,
3661 float __e, float __f, float __g, float __h)
3663 return __extension__ (__m256){ __h, __g, __f, __e, __d, __c, __b, __a };
3666 /// Constructs a 256-bit integer vector initialized with the specified
3667 /// 32-bit integral values.
3669 /// \headerfile <x86intrin.h>
3671 /// This intrinsic is a utility function and does not correspond to a specific
3675 /// A 32-bit integral value used to initialize bits [255:224] of the result.
3677 /// A 32-bit integral value used to initialize bits [223:192] of the result.
3679 /// A 32-bit integral value used to initialize bits [191:160] of the result.
3681 /// A 32-bit integral value used to initialize bits [159:128] of the result.
3683 /// A 32-bit integral value used to initialize bits [127:96] of the result.
3685 /// A 32-bit integral value used to initialize bits [95:64] of the result.
3687 /// A 32-bit integral value used to initialize bits [63:32] of the result.
3689 /// A 32-bit integral value used to initialize bits [31:0] of the result.
3690 /// \returns An initialized 256-bit integer vector.
3691 static __inline __m256i __DEFAULT_FN_ATTRS
3692 _mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
3693 int __i4, int __i5, int __i6, int __i7)
3695 return __extension__ (__m256i)(__v8si){ __i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0 };
3698 /// Constructs a 256-bit integer vector initialized with the specified
3699 /// 16-bit integral values.
3701 /// \headerfile <x86intrin.h>
3703 /// This intrinsic is a utility function and does not correspond to a specific
3707 /// A 16-bit integral value used to initialize bits [255:240] of the result.
3709 /// A 16-bit integral value used to initialize bits [239:224] of the result.
3711 /// A 16-bit integral value used to initialize bits [223:208] of the result.
3713 /// A 16-bit integral value used to initialize bits [207:192] of the result.
3715 /// A 16-bit integral value used to initialize bits [191:176] of the result.
3717 /// A 16-bit integral value used to initialize bits [175:160] of the result.
3719 /// A 16-bit integral value used to initialize bits [159:144] of the result.
3721 /// A 16-bit integral value used to initialize bits [143:128] of the result.
3723 /// A 16-bit integral value used to initialize bits [127:112] of the result.
3725 /// A 16-bit integral value used to initialize bits [111:96] of the result.
3727 /// A 16-bit integral value used to initialize bits [95:80] of the result.
3729 /// A 16-bit integral value used to initialize bits [79:64] of the result.
3731 /// A 16-bit integral value used to initialize bits [63:48] of the result.
3733 /// A 16-bit integral value used to initialize bits [47:32] of the result.
3735 /// A 16-bit integral value used to initialize bits [31:16] of the result.
3737 /// A 16-bit integral value used to initialize bits [15:0] of the result.
3738 /// \returns An initialized 256-bit integer vector.
3739 static __inline __m256i __DEFAULT_FN_ATTRS
3740 _mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
3741 short __w11, short __w10, short __w09, short __w08,
3742 short __w07, short __w06, short __w05, short __w04,
3743 short __w03, short __w02, short __w01, short __w00)
3745 return __extension__ (__m256i)(__v16hi){ __w00, __w01, __w02, __w03, __w04, __w05, __w06,
3746 __w07, __w08, __w09, __w10, __w11, __w12, __w13, __w14, __w15 };
3749 /// Constructs a 256-bit integer vector initialized with the specified
3750 /// 8-bit integral values.
3752 /// \headerfile <x86intrin.h>
3754 /// This intrinsic is a utility function and does not correspond to a specific
3758 /// An 8-bit integral value used to initialize bits [255:248] of the result.
3760 /// An 8-bit integral value used to initialize bits [247:240] of the result.
3762 /// An 8-bit integral value used to initialize bits [239:232] of the result.
3764 /// An 8-bit integral value used to initialize bits [231:224] of the result.
3766 /// An 8-bit integral value used to initialize bits [223:216] of the result.
3768 /// An 8-bit integral value used to initialize bits [215:208] of the result.
3770 /// An 8-bit integral value used to initialize bits [207:200] of the result.
3772 /// An 8-bit integral value used to initialize bits [199:192] of the result.
3774 /// An 8-bit integral value used to initialize bits [191:184] of the result.
3776 /// An 8-bit integral value used to initialize bits [183:176] of the result.
3778 /// An 8-bit integral value used to initialize bits [175:168] of the result.
3780 /// An 8-bit integral value used to initialize bits [167:160] of the result.
3782 /// An 8-bit integral value used to initialize bits [159:152] of the result.
3784 /// An 8-bit integral value used to initialize bits [151:144] of the result.
3786 /// An 8-bit integral value used to initialize bits [143:136] of the result.
3788 /// An 8-bit integral value used to initialize bits [135:128] of the result.
3790 /// An 8-bit integral value used to initialize bits [127:120] of the result.
3792 /// An 8-bit integral value used to initialize bits [119:112] of the result.
3794 /// An 8-bit integral value used to initialize bits [111:104] of the result.
3796 /// An 8-bit integral value used to initialize bits [103:96] of the result.
3798 /// An 8-bit integral value used to initialize bits [95:88] of the result.
3800 /// An 8-bit integral value used to initialize bits [87:80] of the result.
3802 /// An 8-bit integral value used to initialize bits [79:72] of the result.
3804 /// An 8-bit integral value used to initialize bits [71:64] of the result.
3806 /// An 8-bit integral value used to initialize bits [63:56] of the result.
3808 /// An 8-bit integral value used to initialize bits [55:48] of the result.
3810 /// An 8-bit integral value used to initialize bits [47:40] of the result.
3812 /// An 8-bit integral value used to initialize bits [39:32] of the result.
3814 /// An 8-bit integral value used to initialize bits [31:24] of the result.
3816 /// An 8-bit integral value used to initialize bits [23:16] of the result.
3818 /// An 8-bit integral value used to initialize bits [15:8] of the result.
3820 /// An 8-bit integral value used to initialize bits [7:0] of the result.
3821 /// \returns An initialized 256-bit integer vector.
3822 static __inline __m256i __DEFAULT_FN_ATTRS
3823 _mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
3824 char __b27, char __b26, char __b25, char __b24,
3825 char __b23, char __b22, char __b21, char __b20,
3826 char __b19, char __b18, char __b17, char __b16,
3827 char __b15, char __b14, char __b13, char __b12,
3828 char __b11, char __b10, char __b09, char __b08,
3829 char __b07, char __b06, char __b05, char __b04,
3830 char __b03, char __b02, char __b01, char __b00)
3832 return __extension__ (__m256i)(__v32qi){
3833 __b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
3834 __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
3835 __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
3836 __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31
3840 /// Constructs a 256-bit integer vector initialized with the specified
3841 /// 64-bit integral values.
3843 /// \headerfile <x86intrin.h>
3845 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
3849 /// A 64-bit integral value used to initialize bits [255:192] of the result.
3851 /// A 64-bit integral value used to initialize bits [191:128] of the result.
3853 /// A 64-bit integral value used to initialize bits [127:64] of the result.
3855 /// A 64-bit integral value used to initialize bits [63:0] of the result.
3856 /// \returns An initialized 256-bit integer vector.
3857 static __inline __m256i __DEFAULT_FN_ATTRS
3858 _mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
3860 return __extension__ (__m256i)(__v4di){ __d, __c, __b, __a };
3863 /* Create vectors with elements in reverse order */
3864 /// Constructs a 256-bit floating-point vector of [4 x double],
3865 /// initialized in reverse order with the specified double-precision
3866 /// floating-point values.
3868 /// \headerfile <x86intrin.h>
3870 /// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3874 /// A double-precision floating-point value used to initialize bits [63:0]
3877 /// A double-precision floating-point value used to initialize bits [127:64]
3880 /// A double-precision floating-point value used to initialize bits [191:128]
3883 /// A double-precision floating-point value used to initialize bits [255:192]
3885 /// \returns An initialized 256-bit floating-point vector of [4 x double].
3886 static __inline __m256d __DEFAULT_FN_ATTRS
3887 _mm256_setr_pd(double __a, double __b, double __c, double __d)
3889 return _mm256_set_pd(__d, __c, __b, __a);
3892 /// Constructs a 256-bit floating-point vector of [8 x float],
3893 /// initialized in reverse order with the specified single-precision
3894 /// float-point values.
3896 /// \headerfile <x86intrin.h>
3898 /// This intrinsic is a utility function and does not correspond to a specific
3902 /// A single-precision floating-point value used to initialize bits [31:0]
3905 /// A single-precision floating-point value used to initialize bits [63:32]
3908 /// A single-precision floating-point value used to initialize bits [95:64]
3911 /// A single-precision floating-point value used to initialize bits [127:96]
3914 /// A single-precision floating-point value used to initialize bits [159:128]
3917 /// A single-precision floating-point value used to initialize bits [191:160]
3920 /// A single-precision floating-point value used to initialize bits [223:192]
3923 /// A single-precision floating-point value used to initialize bits [255:224]
3925 /// \returns An initialized 256-bit floating-point vector of [8 x float].
3926 static __inline __m256 __DEFAULT_FN_ATTRS
3927 _mm256_setr_ps(float __a, float __b, float __c, float __d,
3928 float __e, float __f, float __g, float __h)
3930 return _mm256_set_ps(__h, __g, __f, __e, __d, __c, __b, __a);
3933 /// Constructs a 256-bit integer vector, initialized in reverse order
3934 /// with the specified 32-bit integral values.
3936 /// \headerfile <x86intrin.h>
3938 /// This intrinsic is a utility function and does not correspond to a specific
3942 /// A 32-bit integral value used to initialize bits [31:0] of the result.
3944 /// A 32-bit integral value used to initialize bits [63:32] of the result.
3946 /// A 32-bit integral value used to initialize bits [95:64] of the result.
3948 /// A 32-bit integral value used to initialize bits [127:96] of the result.
3950 /// A 32-bit integral value used to initialize bits [159:128] of the result.
3952 /// A 32-bit integral value used to initialize bits [191:160] of the result.
3954 /// A 32-bit integral value used to initialize bits [223:192] of the result.
3956 /// A 32-bit integral value used to initialize bits [255:224] of the result.
3957 /// \returns An initialized 256-bit integer vector.
3958 static __inline __m256i __DEFAULT_FN_ATTRS
3959 _mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
3960 int __i4, int __i5, int __i6, int __i7)
3962 return _mm256_set_epi32(__i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0);
3965 /// Constructs a 256-bit integer vector, initialized in reverse order
3966 /// with the specified 16-bit integral values.
3968 /// \headerfile <x86intrin.h>
3970 /// This intrinsic is a utility function and does not correspond to a specific
3974 /// A 16-bit integral value used to initialize bits [15:0] of the result.
3976 /// A 16-bit integral value used to initialize bits [31:16] of the result.
3978 /// A 16-bit integral value used to initialize bits [47:32] of the result.
3980 /// A 16-bit integral value used to initialize bits [63:48] of the result.
3982 /// A 16-bit integral value used to initialize bits [79:64] of the result.
3984 /// A 16-bit integral value used to initialize bits [95:80] of the result.
3986 /// A 16-bit integral value used to initialize bits [111:96] of the result.
3988 /// A 16-bit integral value used to initialize bits [127:112] of the result.
3990 /// A 16-bit integral value used to initialize bits [143:128] of the result.
3992 /// A 16-bit integral value used to initialize bits [159:144] of the result.
3994 /// A 16-bit integral value used to initialize bits [175:160] of the result.
3996 /// A 16-bit integral value used to initialize bits [191:176] of the result.
3998 /// A 16-bit integral value used to initialize bits [207:192] of the result.
4000 /// A 16-bit integral value used to initialize bits [223:208] of the result.
4002 /// A 16-bit integral value used to initialize bits [239:224] of the result.
4004 /// A 16-bit integral value used to initialize bits [255:240] of the result.
4005 /// \returns An initialized 256-bit integer vector.
4006 static __inline __m256i __DEFAULT_FN_ATTRS
4007 _mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
4008 short __w11, short __w10, short __w09, short __w08,
4009 short __w07, short __w06, short __w05, short __w04,
4010 short __w03, short __w02, short __w01, short __w00)
4012 return _mm256_set_epi16(__w00, __w01, __w02, __w03,
4013 __w04, __w05, __w06, __w07,
4014 __w08, __w09, __w10, __w11,
4015 __w12, __w13, __w14, __w15);
4018 /// Constructs a 256-bit integer vector, initialized in reverse order
4019 /// with the specified 8-bit integral values.
4021 /// \headerfile <x86intrin.h>
4023 /// This intrinsic is a utility function and does not correspond to a specific
4027 /// An 8-bit integral value used to initialize bits [7:0] of the result.
4029 /// An 8-bit integral value used to initialize bits [15:8] of the result.
4031 /// An 8-bit integral value used to initialize bits [23:16] of the result.
4033 /// An 8-bit integral value used to initialize bits [31:24] of the result.
4035 /// An 8-bit integral value used to initialize bits [39:32] of the result.
4037 /// An 8-bit integral value used to initialize bits [47:40] of the result.
4039 /// An 8-bit integral value used to initialize bits [55:48] of the result.
4041 /// An 8-bit integral value used to initialize bits [63:56] of the result.
4043 /// An 8-bit integral value used to initialize bits [71:64] of the result.
4045 /// An 8-bit integral value used to initialize bits [79:72] of the result.
4047 /// An 8-bit integral value used to initialize bits [87:80] of the result.
4049 /// An 8-bit integral value used to initialize bits [95:88] of the result.
4051 /// An 8-bit integral value used to initialize bits [103:96] of the result.
4053 /// An 8-bit integral value used to initialize bits [111:104] of the result.
4055 /// An 8-bit integral value used to initialize bits [119:112] of the result.
4057 /// An 8-bit integral value used to initialize bits [127:120] of the result.
4059 /// An 8-bit integral value used to initialize bits [135:128] of the result.
4061 /// An 8-bit integral value used to initialize bits [143:136] of the result.
4063 /// An 8-bit integral value used to initialize bits [151:144] of the result.
4065 /// An 8-bit integral value used to initialize bits [159:152] of the result.
4067 /// An 8-bit integral value used to initialize bits [167:160] of the result.
4069 /// An 8-bit integral value used to initialize bits [175:168] of the result.
4071 /// An 8-bit integral value used to initialize bits [183:176] of the result.
4073 /// An 8-bit integral value used to initialize bits [191:184] of the result.
4075 /// An 8-bit integral value used to initialize bits [199:192] of the result.
4077 /// An 8-bit integral value used to initialize bits [207:200] of the result.
4079 /// An 8-bit integral value used to initialize bits [215:208] of the result.
4081 /// An 8-bit integral value used to initialize bits [223:216] of the result.
4083 /// An 8-bit integral value used to initialize bits [231:224] of the result.
4085 /// An 8-bit integral value used to initialize bits [239:232] of the result.
4087 /// An 8-bit integral value used to initialize bits [247:240] of the result.
4089 /// An 8-bit integral value used to initialize bits [255:248] of the result.
4090 /// \returns An initialized 256-bit integer vector.
4091 static __inline __m256i __DEFAULT_FN_ATTRS
4092 _mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
4093 char __b27, char __b26, char __b25, char __b24,
4094 char __b23, char __b22, char __b21, char __b20,
4095 char __b19, char __b18, char __b17, char __b16,
4096 char __b15, char __b14, char __b13, char __b12,
4097 char __b11, char __b10, char __b09, char __b08,
4098 char __b07, char __b06, char __b05, char __b04,
4099 char __b03, char __b02, char __b01, char __b00)
4101 return _mm256_set_epi8(__b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
4102 __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
4103 __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
4104 __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31);
4107 /// Constructs a 256-bit integer vector, initialized in reverse order
4108 /// with the specified 64-bit integral values.
4110 /// \headerfile <x86intrin.h>
4112 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
4116 /// A 64-bit integral value used to initialize bits [63:0] of the result.
4118 /// A 64-bit integral value used to initialize bits [127:64] of the result.
4120 /// A 64-bit integral value used to initialize bits [191:128] of the result.
4122 /// A 64-bit integral value used to initialize bits [255:192] of the result.
4123 /// \returns An initialized 256-bit integer vector.
4124 static __inline __m256i __DEFAULT_FN_ATTRS
4125 _mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
4127 return _mm256_set_epi64x(__d, __c, __b, __a);
4130 /* Create vectors with repeated elements */
4131 /// Constructs a 256-bit floating-point vector of [4 x double], with each
4132 /// of the four double-precision floating-point vector elements set to the
4133 /// specified double-precision floating-point value.
4135 /// \headerfile <x86intrin.h>
4137 /// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4140 /// A double-precision floating-point value used to initialize each vector
4141 /// element of the result.
4142 /// \returns An initialized 256-bit floating-point vector of [4 x double].
4143 static __inline __m256d __DEFAULT_FN_ATTRS
4144 _mm256_set1_pd(double __w)
4146 return _mm256_set_pd(__w, __w, __w, __w);
4149 /// Constructs a 256-bit floating-point vector of [8 x float], with each
4150 /// of the eight single-precision floating-point vector elements set to the
4151 /// specified single-precision floating-point value.
4153 /// \headerfile <x86intrin.h>
4155 /// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4159 /// A single-precision floating-point value used to initialize each vector
4160 /// element of the result.
4161 /// \returns An initialized 256-bit floating-point vector of [8 x float].
4162 static __inline __m256 __DEFAULT_FN_ATTRS
4163 _mm256_set1_ps(float __w)
4165 return _mm256_set_ps(__w, __w, __w, __w, __w, __w, __w, __w);
4168 /// Constructs a 256-bit integer vector of [8 x i32], with each of the
4169 /// 32-bit integral vector elements set to the specified 32-bit integral
4172 /// \headerfile <x86intrin.h>
4174 /// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4178 /// A 32-bit integral value used to initialize each vector element of the
4180 /// \returns An initialized 256-bit integer vector of [8 x i32].
4181 static __inline __m256i __DEFAULT_FN_ATTRS
4182 _mm256_set1_epi32(int __i)
4184 return _mm256_set_epi32(__i, __i, __i, __i, __i, __i, __i, __i);
4187 /// Constructs a 256-bit integer vector of [16 x i16], with each of the
4188 /// 16-bit integral vector elements set to the specified 16-bit integral
4191 /// \headerfile <x86intrin.h>
4193 /// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4196 /// A 16-bit integral value used to initialize each vector element of the
4198 /// \returns An initialized 256-bit integer vector of [16 x i16].
4199 static __inline __m256i __DEFAULT_FN_ATTRS
4200 _mm256_set1_epi16(short __w)
4202 return _mm256_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w,
4203 __w, __w, __w, __w, __w, __w, __w, __w);
4206 /// Constructs a 256-bit integer vector of [32 x i8], with each of the
4207 /// 8-bit integral vector elements set to the specified 8-bit integral value.
4209 /// \headerfile <x86intrin.h>
4211 /// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4214 /// An 8-bit integral value used to initialize each vector element of the
4216 /// \returns An initialized 256-bit integer vector of [32 x i8].
4217 static __inline __m256i __DEFAULT_FN_ATTRS
4218 _mm256_set1_epi8(char __b)
4220 return _mm256_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b,
4221 __b, __b, __b, __b, __b, __b, __b, __b,
4222 __b, __b, __b, __b, __b, __b, __b, __b,
4223 __b, __b, __b, __b, __b, __b, __b, __b);
4226 /// Constructs a 256-bit integer vector of [4 x i64], with each of the
4227 /// 64-bit integral vector elements set to the specified 64-bit integral
4230 /// \headerfile <x86intrin.h>
4232 /// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4235 /// A 64-bit integral value used to initialize each vector element of the
4237 /// \returns An initialized 256-bit integer vector of [4 x i64].
4238 static __inline __m256i __DEFAULT_FN_ATTRS
4239 _mm256_set1_epi64x(long long __q)
4241 return _mm256_set_epi64x(__q, __q, __q, __q);
4244 /* Create __zeroed vectors */
4245 /// Constructs a 256-bit floating-point vector of [4 x double] with all
4246 /// vector elements initialized to zero.
4248 /// \headerfile <x86intrin.h>
4250 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4252 /// \returns A 256-bit vector of [4 x double] with all elements set to zero.
4253 static __inline __m256d __DEFAULT_FN_ATTRS
4254 _mm256_setzero_pd(void)
4256 return __extension__ (__m256d){ 0, 0, 0, 0 };
4259 /// Constructs a 256-bit floating-point vector of [8 x float] with all
4260 /// vector elements initialized to zero.
4262 /// \headerfile <x86intrin.h>
4264 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4266 /// \returns A 256-bit vector of [8 x float] with all elements set to zero.
4267 static __inline __m256 __DEFAULT_FN_ATTRS
4268 _mm256_setzero_ps(void)
4270 return __extension__ (__m256){ 0, 0, 0, 0, 0, 0, 0, 0 };
4273 /// Constructs a 256-bit integer vector initialized to zero.
4275 /// \headerfile <x86intrin.h>
4277 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4279 /// \returns A 256-bit integer vector initialized to zero.
4280 static __inline __m256i __DEFAULT_FN_ATTRS
4281 _mm256_setzero_si256(void)
4283 return __extension__ (__m256i)(__v4di){ 0, 0, 0, 0 };
4286 /* Cast between vector types */
4287 /// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4288 /// floating-point vector of [8 x float].
4290 /// \headerfile <x86intrin.h>
4292 /// This intrinsic has no corresponding instruction.
4295 /// A 256-bit floating-point vector of [4 x double].
4296 /// \returns A 256-bit floating-point vector of [8 x float] containing the same
4297 /// bitwise pattern as the parameter.
4298 static __inline __m256 __DEFAULT_FN_ATTRS
4299 _mm256_castpd_ps(__m256d __a)
4304 /// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4307 /// \headerfile <x86intrin.h>
4309 /// This intrinsic has no corresponding instruction.
4312 /// A 256-bit floating-point vector of [4 x double].
4313 /// \returns A 256-bit integer vector containing the same bitwise pattern as the
4315 static __inline __m256i __DEFAULT_FN_ATTRS
4316 _mm256_castpd_si256(__m256d __a)
4318 return (__m256i)__a;
4321 /// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4322 /// floating-point vector of [4 x double].
4324 /// \headerfile <x86intrin.h>
4326 /// This intrinsic has no corresponding instruction.
4329 /// A 256-bit floating-point vector of [8 x float].
4330 /// \returns A 256-bit floating-point vector of [4 x double] containing the same
4331 /// bitwise pattern as the parameter.
4332 static __inline __m256d __DEFAULT_FN_ATTRS
4333 _mm256_castps_pd(__m256 __a)
4335 return (__m256d)__a;
4338 /// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4341 /// \headerfile <x86intrin.h>
4343 /// This intrinsic has no corresponding instruction.
4346 /// A 256-bit floating-point vector of [8 x float].
4347 /// \returns A 256-bit integer vector containing the same bitwise pattern as the
4349 static __inline __m256i __DEFAULT_FN_ATTRS
4350 _mm256_castps_si256(__m256 __a)
4352 return (__m256i)__a;
4355 /// Casts a 256-bit integer vector into a 256-bit floating-point vector
4358 /// \headerfile <x86intrin.h>
4360 /// This intrinsic has no corresponding instruction.
4363 /// A 256-bit integer vector.
4364 /// \returns A 256-bit floating-point vector of [8 x float] containing the same
4365 /// bitwise pattern as the parameter.
4366 static __inline __m256 __DEFAULT_FN_ATTRS
4367 _mm256_castsi256_ps(__m256i __a)
4372 /// Casts a 256-bit integer vector into a 256-bit floating-point vector
4373 /// of [4 x double].
4375 /// \headerfile <x86intrin.h>
4377 /// This intrinsic has no corresponding instruction.
4380 /// A 256-bit integer vector.
4381 /// \returns A 256-bit floating-point vector of [4 x double] containing the same
4382 /// bitwise pattern as the parameter.
4383 static __inline __m256d __DEFAULT_FN_ATTRS
4384 _mm256_castsi256_pd(__m256i __a)
4386 return (__m256d)__a;
4389 /// Returns the lower 128 bits of a 256-bit floating-point vector of
4390 /// [4 x double] as a 128-bit floating-point vector of [2 x double].
4392 /// \headerfile <x86intrin.h>
4394 /// This intrinsic has no corresponding instruction.
4397 /// A 256-bit floating-point vector of [4 x double].
4398 /// \returns A 128-bit floating-point vector of [2 x double] containing the
4399 /// lower 128 bits of the parameter.
4400 static __inline __m128d __DEFAULT_FN_ATTRS
4401 _mm256_castpd256_pd128(__m256d __a)
4403 return __builtin_shufflevector((__v4df)__a, (__v4df)__a, 0, 1);
4406 /// Returns the lower 128 bits of a 256-bit floating-point vector of
4407 /// [8 x float] as a 128-bit floating-point vector of [4 x float].
4409 /// \headerfile <x86intrin.h>
4411 /// This intrinsic has no corresponding instruction.
4414 /// A 256-bit floating-point vector of [8 x float].
4415 /// \returns A 128-bit floating-point vector of [4 x float] containing the
4416 /// lower 128 bits of the parameter.
4417 static __inline __m128 __DEFAULT_FN_ATTRS
4418 _mm256_castps256_ps128(__m256 __a)
4420 return __builtin_shufflevector((__v8sf)__a, (__v8sf)__a, 0, 1, 2, 3);
4423 /// Truncates a 256-bit integer vector into a 128-bit integer vector.
4425 /// \headerfile <x86intrin.h>
4427 /// This intrinsic has no corresponding instruction.
4430 /// A 256-bit integer vector.
4431 /// \returns A 128-bit integer vector containing the lower 128 bits of the
4433 static __inline __m128i __DEFAULT_FN_ATTRS
4434 _mm256_castsi256_si128(__m256i __a)
4436 return __builtin_shufflevector((__v4di)__a, (__v4di)__a, 0, 1);
4439 /// Constructs a 256-bit floating-point vector of [4 x double] from a
4440 /// 128-bit floating-point vector of [2 x double].
4442 /// The lower 128 bits contain the value of the source vector. The contents
4443 /// of the upper 128 bits are undefined.
4445 /// \headerfile <x86intrin.h>
4447 /// This intrinsic has no corresponding instruction.
4450 /// A 128-bit vector of [2 x double].
4451 /// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4452 /// contain the value of the parameter. The contents of the upper 128 bits
4454 static __inline __m256d __DEFAULT_FN_ATTRS
4455 _mm256_castpd128_pd256(__m128d __a)
4457 return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 1, -1, -1);
4460 /// Constructs a 256-bit floating-point vector of [8 x float] from a
4461 /// 128-bit floating-point vector of [4 x float].
4463 /// The lower 128 bits contain the value of the source vector. The contents
4464 /// of the upper 128 bits are undefined.
4466 /// \headerfile <x86intrin.h>
4468 /// This intrinsic has no corresponding instruction.
4471 /// A 128-bit vector of [4 x float].
4472 /// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4473 /// contain the value of the parameter. The contents of the upper 128 bits
4475 static __inline __m256 __DEFAULT_FN_ATTRS
4476 _mm256_castps128_ps256(__m128 __a)
4478 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1, 2, 3, -1, -1, -1, -1);
4481 /// Constructs a 256-bit integer vector from a 128-bit integer vector.
4483 /// The lower 128 bits contain the value of the source vector. The contents
4484 /// of the upper 128 bits are undefined.
4486 /// \headerfile <x86intrin.h>
4488 /// This intrinsic has no corresponding instruction.
4491 /// A 128-bit integer vector.
4492 /// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4493 /// the parameter. The contents of the upper 128 bits are undefined.
4494 static __inline __m256i __DEFAULT_FN_ATTRS
4495 _mm256_castsi128_si256(__m128i __a)
4497 return __builtin_shufflevector((__v2di)__a, (__v2di)__a, 0, 1, -1, -1);
4500 /// Constructs a 256-bit floating-point vector of [4 x double] from a
4501 /// 128-bit floating-point vector of [2 x double]. The lower 128 bits
4502 /// contain the value of the source vector. The upper 128 bits are set
4505 /// \headerfile <x86intrin.h>
4507 /// This intrinsic has no corresponding instruction.
4510 /// A 128-bit vector of [2 x double].
4511 /// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4512 /// contain the value of the parameter. The upper 128 bits are set to zero.
4513 static __inline __m256d __DEFAULT_FN_ATTRS
4514 _mm256_zextpd128_pd256(__m128d __a)
4516 return __builtin_shufflevector((__v2df)__a, (__v2df)_mm_setzero_pd(), 0, 1, 2, 3);
4519 /// Constructs a 256-bit floating-point vector of [8 x float] from a
4520 /// 128-bit floating-point vector of [4 x float]. The lower 128 bits contain
4521 /// the value of the source vector. The upper 128 bits are set to zero.
4523 /// \headerfile <x86intrin.h>
4525 /// This intrinsic has no corresponding instruction.
4528 /// A 128-bit vector of [4 x float].
4529 /// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4530 /// contain the value of the parameter. The upper 128 bits are set to zero.
4531 static __inline __m256 __DEFAULT_FN_ATTRS
4532 _mm256_zextps128_ps256(__m128 __a)
4534 return __builtin_shufflevector((__v4sf)__a, (__v4sf)_mm_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7);
4537 /// Constructs a 256-bit integer vector from a 128-bit integer vector.
4538 /// The lower 128 bits contain the value of the source vector. The upper
4539 /// 128 bits are set to zero.
4541 /// \headerfile <x86intrin.h>
4543 /// This intrinsic has no corresponding instruction.
4546 /// A 128-bit integer vector.
4547 /// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4548 /// the parameter. The upper 128 bits are set to zero.
4549 static __inline __m256i __DEFAULT_FN_ATTRS
4550 _mm256_zextsi128_si256(__m128i __a)
4552 return __builtin_shufflevector((__v2di)__a, (__v2di)_mm_setzero_si128(), 0, 1, 2, 3);
4557 We use macros rather than inlines because we only want to accept
4558 invocations where the immediate M is a constant expression.
4560 /// Constructs a new 256-bit vector of [8 x float] by first duplicating
4561 /// a 256-bit vector of [8 x float] given in the first parameter, and then
4562 /// replacing either the upper or the lower 128 bits with the contents of a
4563 /// 128-bit vector of [4 x float] in the second parameter.
4565 /// The immediate integer parameter determines between the upper or the lower
4568 /// \headerfile <x86intrin.h>
4571 /// __m256 _mm256_insertf128_ps(__m256 V1, __m128 V2, const int M);
4574 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4577 /// A 256-bit vector of [8 x float]. This vector is copied to the result
4578 /// first, and then either the upper or the lower 128 bits of the result will
4579 /// be replaced by the contents of \a V2.
4581 /// A 128-bit vector of [4 x float]. The contents of this parameter are
4582 /// written to either the upper or the lower 128 bits of the result depending
4583 /// on the value of parameter \a M.
4585 /// An immediate integer. The least significant bit determines how the values
4586 /// from the two parameters are interleaved: \n
4587 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4588 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4590 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4591 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4593 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
4594 #define _mm256_insertf128_ps(V1, V2, M) \
4595 (__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)(__m256)(V1), \
4596 (__v4sf)(__m128)(V2), (int)(M))
4598 /// Constructs a new 256-bit vector of [4 x double] by first duplicating
4599 /// a 256-bit vector of [4 x double] given in the first parameter, and then
4600 /// replacing either the upper or the lower 128 bits with the contents of a
4601 /// 128-bit vector of [2 x double] in the second parameter.
4603 /// The immediate integer parameter determines between the upper or the lower
4606 /// \headerfile <x86intrin.h>
4609 /// __m256d _mm256_insertf128_pd(__m256d V1, __m128d V2, const int M);
4612 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4615 /// A 256-bit vector of [4 x double]. This vector is copied to the result
4616 /// first, and then either the upper or the lower 128 bits of the result will
4617 /// be replaced by the contents of \a V2.
4619 /// A 128-bit vector of [2 x double]. The contents of this parameter are
4620 /// written to either the upper or the lower 128 bits of the result depending
4621 /// on the value of parameter \a M.
4623 /// An immediate integer. The least significant bit determines how the values
4624 /// from the two parameters are interleaved: \n
4625 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4626 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4628 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4629 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4631 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
4632 #define _mm256_insertf128_pd(V1, V2, M) \
4633 (__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)(__m256d)(V1), \
4634 (__v2df)(__m128d)(V2), (int)(M))
4636 /// Constructs a new 256-bit integer vector by first duplicating a
4637 /// 256-bit integer vector given in the first parameter, and then replacing
4638 /// either the upper or the lower 128 bits with the contents of a 128-bit
4639 /// integer vector in the second parameter.
4641 /// The immediate integer parameter determines between the upper or the lower
4644 /// \headerfile <x86intrin.h>
4647 /// __m256i _mm256_insertf128_si256(__m256i V1, __m128i V2, const int M);
4650 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4653 /// A 256-bit integer vector. This vector is copied to the result first, and
4654 /// then either the upper or the lower 128 bits of the result will be
4655 /// replaced by the contents of \a V2.
4657 /// A 128-bit integer vector. The contents of this parameter are written to
4658 /// either the upper or the lower 128 bits of the result depending on the
4659 /// value of parameter \a M.
4661 /// An immediate integer. The least significant bit determines how the values
4662 /// from the two parameters are interleaved: \n
4663 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4664 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4666 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4667 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4669 /// \returns A 256-bit integer vector containing the interleaved values.
4670 #define _mm256_insertf128_si256(V1, V2, M) \
4671 (__m256i)__builtin_ia32_vinsertf128_si256((__v8si)(__m256i)(V1), \
4672 (__v4si)(__m128i)(V2), (int)(M))
4676 We use macros rather than inlines because we only want to accept
4677 invocations where the immediate M is a constant expression.
4679 /// Extracts either the upper or the lower 128 bits from a 256-bit vector
4680 /// of [8 x float], as determined by the immediate integer parameter, and
4681 /// returns the extracted bits as a 128-bit vector of [4 x float].
4683 /// \headerfile <x86intrin.h>
4686 /// __m128 _mm256_extractf128_ps(__m256 V, const int M);
4689 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4692 /// A 256-bit vector of [8 x float].
4694 /// An immediate integer. The least significant bit determines which bits are
4695 /// extracted from the first parameter: \n
4696 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4698 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4699 /// \returns A 128-bit vector of [4 x float] containing the extracted bits.
4700 #define _mm256_extractf128_ps(V, M) \
4701 (__m128)__builtin_ia32_vextractf128_ps256((__v8sf)(__m256)(V), (int)(M))
4703 /// Extracts either the upper or the lower 128 bits from a 256-bit vector
4704 /// of [4 x double], as determined by the immediate integer parameter, and
4705 /// returns the extracted bits as a 128-bit vector of [2 x double].
4707 /// \headerfile <x86intrin.h>
4710 /// __m128d _mm256_extractf128_pd(__m256d V, const int M);
4713 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4716 /// A 256-bit vector of [4 x double].
4718 /// An immediate integer. The least significant bit determines which bits are
4719 /// extracted from the first parameter: \n
4720 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4722 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4723 /// \returns A 128-bit vector of [2 x double] containing the extracted bits.
4724 #define _mm256_extractf128_pd(V, M) \
4725 (__m128d)__builtin_ia32_vextractf128_pd256((__v4df)(__m256d)(V), (int)(M))
4727 /// Extracts either the upper or the lower 128 bits from a 256-bit
4728 /// integer vector, as determined by the immediate integer parameter, and
4729 /// returns the extracted bits as a 128-bit integer vector.
4731 /// \headerfile <x86intrin.h>
4734 /// __m128i _mm256_extractf128_si256(__m256i V, const int M);
4737 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4740 /// A 256-bit integer vector.
4742 /// An immediate integer. The least significant bit determines which bits are
4743 /// extracted from the first parameter: \n
4744 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4746 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4747 /// \returns A 128-bit integer vector containing the extracted bits.
4748 #define _mm256_extractf128_si256(V, M) \
4749 (__m128i)__builtin_ia32_vextractf128_si256((__v8si)(__m256i)(V), (int)(M))
4751 /* SIMD load ops (unaligned) */
4752 /// Loads two 128-bit floating-point vectors of [4 x float] from
4753 /// unaligned memory locations and constructs a 256-bit floating-point vector
4754 /// of [8 x float] by concatenating the two 128-bit vectors.
4756 /// \headerfile <x86intrin.h>
4758 /// This intrinsic corresponds to load instructions followed by the
4759 /// <c> VINSERTF128 </c> instruction.
4761 /// \param __addr_hi
4762 /// A pointer to a 128-bit memory location containing 4 consecutive
4763 /// single-precision floating-point values. These values are to be copied to
4764 /// bits[255:128] of the result. The address of the memory location does not
4765 /// have to be aligned.
4766 /// \param __addr_lo
4767 /// A pointer to a 128-bit memory location containing 4 consecutive
4768 /// single-precision floating-point values. These values are to be copied to
4769 /// bits[127:0] of the result. The address of the memory location does not
4770 /// have to be aligned.
4771 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4772 /// concatenated result.
4773 static __inline __m256 __DEFAULT_FN_ATTRS
4774 _mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
4776 __m256 __v256 = _mm256_castps128_ps256(_mm_loadu_ps(__addr_lo));
4777 return _mm256_insertf128_ps(__v256, _mm_loadu_ps(__addr_hi), 1);
4780 /// Loads two 128-bit floating-point vectors of [2 x double] from
4781 /// unaligned memory locations and constructs a 256-bit floating-point vector
4782 /// of [4 x double] by concatenating the two 128-bit vectors.
4784 /// \headerfile <x86intrin.h>
4786 /// This intrinsic corresponds to load instructions followed by the
4787 /// <c> VINSERTF128 </c> instruction.
4789 /// \param __addr_hi
4790 /// A pointer to a 128-bit memory location containing two consecutive
4791 /// double-precision floating-point values. These values are to be copied to
4792 /// bits[255:128] of the result. The address of the memory location does not
4793 /// have to be aligned.
4794 /// \param __addr_lo
4795 /// A pointer to a 128-bit memory location containing two consecutive
4796 /// double-precision floating-point values. These values are to be copied to
4797 /// bits[127:0] of the result. The address of the memory location does not
4798 /// have to be aligned.
4799 /// \returns A 256-bit floating-point vector of [4 x double] containing the
4800 /// concatenated result.
4801 static __inline __m256d __DEFAULT_FN_ATTRS
4802 _mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo)
4804 __m256d __v256 = _mm256_castpd128_pd256(_mm_loadu_pd(__addr_lo));
4805 return _mm256_insertf128_pd(__v256, _mm_loadu_pd(__addr_hi), 1);
4808 /// Loads two 128-bit integer vectors from unaligned memory locations and
4809 /// constructs a 256-bit integer vector by concatenating the two 128-bit
4812 /// \headerfile <x86intrin.h>
4814 /// This intrinsic corresponds to load instructions followed by the
4815 /// <c> VINSERTF128 </c> instruction.
4817 /// \param __addr_hi
4818 /// A pointer to a 128-bit memory location containing a 128-bit integer
4819 /// vector. This vector is to be copied to bits[255:128] of the result. The
4820 /// address of the memory location does not have to be aligned.
4821 /// \param __addr_lo
4822 /// A pointer to a 128-bit memory location containing a 128-bit integer
4823 /// vector. This vector is to be copied to bits[127:0] of the result. The
4824 /// address of the memory location does not have to be aligned.
4825 /// \returns A 256-bit integer vector containing the concatenated result.
4826 static __inline __m256i __DEFAULT_FN_ATTRS
4827 _mm256_loadu2_m128i(__m128i_u const *__addr_hi, __m128i_u const *__addr_lo)
4829 __m256i __v256 = _mm256_castsi128_si256(_mm_loadu_si128(__addr_lo));
4830 return _mm256_insertf128_si256(__v256, _mm_loadu_si128(__addr_hi), 1);
4833 /* SIMD store ops (unaligned) */
4834 /// Stores the upper and lower 128 bits of a 256-bit floating-point
4835 /// vector of [8 x float] into two different unaligned memory locations.
4837 /// \headerfile <x86intrin.h>
4839 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
4840 /// store instructions.
4842 /// \param __addr_hi
4843 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
4844 /// copied to this memory location. The address of this memory location does
4845 /// not have to be aligned.
4846 /// \param __addr_lo
4847 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
4848 /// copied to this memory location. The address of this memory location does
4849 /// not have to be aligned.
4851 /// A 256-bit floating-point vector of [8 x float].
4852 static __inline void __DEFAULT_FN_ATTRS
4853 _mm256_storeu2_m128(float *__addr_hi, float *__addr_lo, __m256 __a)
4857 __v128 = _mm256_castps256_ps128(__a);
4858 _mm_storeu_ps(__addr_lo, __v128);
4859 __v128 = _mm256_extractf128_ps(__a, 1);
4860 _mm_storeu_ps(__addr_hi, __v128);
4863 /// Stores the upper and lower 128 bits of a 256-bit floating-point
4864 /// vector of [4 x double] into two different unaligned memory locations.
4866 /// \headerfile <x86intrin.h>
4868 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
4869 /// store instructions.
4871 /// \param __addr_hi
4872 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
4873 /// copied to this memory location. The address of this memory location does
4874 /// not have to be aligned.
4875 /// \param __addr_lo
4876 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
4877 /// copied to this memory location. The address of this memory location does
4878 /// not have to be aligned.
4880 /// A 256-bit floating-point vector of [4 x double].
4881 static __inline void __DEFAULT_FN_ATTRS
4882 _mm256_storeu2_m128d(double *__addr_hi, double *__addr_lo, __m256d __a)
4886 __v128 = _mm256_castpd256_pd128(__a);
4887 _mm_storeu_pd(__addr_lo, __v128);
4888 __v128 = _mm256_extractf128_pd(__a, 1);
4889 _mm_storeu_pd(__addr_hi, __v128);
4892 /// Stores the upper and lower 128 bits of a 256-bit integer vector into
4893 /// two different unaligned memory locations.
4895 /// \headerfile <x86intrin.h>
4897 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
4898 /// store instructions.
4900 /// \param __addr_hi
4901 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
4902 /// copied to this memory location. The address of this memory location does
4903 /// not have to be aligned.
4904 /// \param __addr_lo
4905 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
4906 /// copied to this memory location. The address of this memory location does
4907 /// not have to be aligned.
4909 /// A 256-bit integer vector.
4910 static __inline void __DEFAULT_FN_ATTRS
4911 _mm256_storeu2_m128i(__m128i_u *__addr_hi, __m128i_u *__addr_lo, __m256i __a)
4915 __v128 = _mm256_castsi256_si128(__a);
4916 _mm_storeu_si128(__addr_lo, __v128);
4917 __v128 = _mm256_extractf128_si256(__a, 1);
4918 _mm_storeu_si128(__addr_hi, __v128);
4921 /// Constructs a 256-bit floating-point vector of [8 x float] by
4922 /// concatenating two 128-bit floating-point vectors of [4 x float].
4924 /// \headerfile <x86intrin.h>
4926 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4929 /// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4930 /// 128 bits of the result.
4932 /// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4933 /// 128 bits of the result.
4934 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4935 /// concatenated result.
4936 static __inline __m256 __DEFAULT_FN_ATTRS
4937 _mm256_set_m128 (__m128 __hi, __m128 __lo)
4939 return (__m256) __builtin_shufflevector((__v4sf)__lo, (__v4sf)__hi, 0, 1, 2, 3, 4, 5, 6, 7);
4942 /// Constructs a 256-bit floating-point vector of [4 x double] by
4943 /// concatenating two 128-bit floating-point vectors of [2 x double].
4945 /// \headerfile <x86intrin.h>
4947 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4950 /// A 128-bit floating-point vector of [2 x double] to be copied to the upper
4951 /// 128 bits of the result.
4953 /// A 128-bit floating-point vector of [2 x double] to be copied to the lower
4954 /// 128 bits of the result.
4955 /// \returns A 256-bit floating-point vector of [4 x double] containing the
4956 /// concatenated result.
4957 static __inline __m256d __DEFAULT_FN_ATTRS
4958 _mm256_set_m128d (__m128d __hi, __m128d __lo)
4960 return (__m256d) __builtin_shufflevector((__v2df)__lo, (__v2df)__hi, 0, 1, 2, 3);
4963 /// Constructs a 256-bit integer vector by concatenating two 128-bit
4964 /// integer vectors.
4966 /// \headerfile <x86intrin.h>
4968 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4971 /// A 128-bit integer vector to be copied to the upper 128 bits of the
4974 /// A 128-bit integer vector to be copied to the lower 128 bits of the
4976 /// \returns A 256-bit integer vector containing the concatenated result.
4977 static __inline __m256i __DEFAULT_FN_ATTRS
4978 _mm256_set_m128i (__m128i __hi, __m128i __lo)
4980 return (__m256i) __builtin_shufflevector((__v2di)__lo, (__v2di)__hi, 0, 1, 2, 3);
4983 /// Constructs a 256-bit floating-point vector of [8 x float] by
4984 /// concatenating two 128-bit floating-point vectors of [4 x float]. This is
4985 /// similar to _mm256_set_m128, but the order of the input parameters is
4988 /// \headerfile <x86intrin.h>
4990 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4993 /// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4994 /// 128 bits of the result.
4996 /// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4997 /// 128 bits of the result.
4998 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4999 /// concatenated result.
5000 static __inline __m256 __DEFAULT_FN_ATTRS
5001 _mm256_setr_m128 (__m128 __lo, __m128 __hi)
5003 return _mm256_set_m128(__hi, __lo);
5006 /// Constructs a 256-bit floating-point vector of [4 x double] by
5007 /// concatenating two 128-bit floating-point vectors of [2 x double]. This is
5008 /// similar to _mm256_set_m128d, but the order of the input parameters is
5011 /// \headerfile <x86intrin.h>
5013 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
5016 /// A 128-bit floating-point vector of [2 x double] to be copied to the lower
5017 /// 128 bits of the result.
5019 /// A 128-bit floating-point vector of [2 x double] to be copied to the upper
5020 /// 128 bits of the result.
5021 /// \returns A 256-bit floating-point vector of [4 x double] containing the
5022 /// concatenated result.
5023 static __inline __m256d __DEFAULT_FN_ATTRS
5024 _mm256_setr_m128d (__m128d __lo, __m128d __hi)
5026 return (__m256d)_mm256_set_m128d(__hi, __lo);
5029 /// Constructs a 256-bit integer vector by concatenating two 128-bit
5030 /// integer vectors. This is similar to _mm256_set_m128i, but the order of
5031 /// the input parameters is swapped.
5033 /// \headerfile <x86intrin.h>
5035 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
5038 /// A 128-bit integer vector to be copied to the lower 128 bits of the
5041 /// A 128-bit integer vector to be copied to the upper 128 bits of the
5043 /// \returns A 256-bit integer vector containing the concatenated result.
5044 static __inline __m256i __DEFAULT_FN_ATTRS
5045 _mm256_setr_m128i (__m128i __lo, __m128i __hi)
5047 return (__m256i)_mm256_set_m128i(__hi, __lo);
5050 #undef __DEFAULT_FN_ATTRS
5051 #undef __DEFAULT_FN_ATTRS128
5053 #endif /* __AVXINTRIN_H */