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)));
43 /* Both _Float16 and __bf16 require SSE2 being enabled. */
44 typedef _Float16 __v16hf
__attribute__((__vector_size__(32), __aligned__(32)));
45 typedef _Float16 __m256h
__attribute__((__vector_size__(32), __aligned__(32)));
46 typedef _Float16 __m256h_u
__attribute__((__vector_size__(32), __aligned__(1)));
48 typedef __bf16 __v16bf
__attribute__((__vector_size__(32), __aligned__(32)));
49 typedef __bf16 __m256bh
__attribute__((__vector_size__(32), __aligned__(32)));
52 /* Define the default attributes for the functions in this file. */
53 #define __DEFAULT_FN_ATTRS \
54 __attribute__((__always_inline__, __nodebug__, __target__("avx,no-evex512"), \
55 __min_vector_width__(256)))
56 #define __DEFAULT_FN_ATTRS128 \
57 __attribute__((__always_inline__, __nodebug__, __target__("avx,no-evex512"), \
58 __min_vector_width__(128)))
61 /// Adds two 256-bit vectors of [4 x double].
63 /// \headerfile <x86intrin.h>
65 /// This intrinsic corresponds to the <c> VADDPD </c> instruction.
68 /// A 256-bit vector of [4 x double] containing one of the source operands.
70 /// A 256-bit vector of [4 x double] containing one of the source operands.
71 /// \returns A 256-bit vector of [4 x double] containing the sums of both
73 static __inline __m256d __DEFAULT_FN_ATTRS
74 _mm256_add_pd(__m256d __a
, __m256d __b
)
76 return (__m256d
)((__v4df
)__a
+(__v4df
)__b
);
79 /// Adds two 256-bit vectors of [8 x float].
81 /// \headerfile <x86intrin.h>
83 /// This intrinsic corresponds to the <c> VADDPS </c> instruction.
86 /// A 256-bit vector of [8 x float] containing one of the source operands.
88 /// A 256-bit vector of [8 x float] containing one of the source operands.
89 /// \returns A 256-bit vector of [8 x float] containing the sums of both
91 static __inline __m256 __DEFAULT_FN_ATTRS
92 _mm256_add_ps(__m256 __a
, __m256 __b
)
94 return (__m256
)((__v8sf
)__a
+(__v8sf
)__b
);
97 /// Subtracts two 256-bit vectors of [4 x double].
99 /// \headerfile <x86intrin.h>
101 /// This intrinsic corresponds to the <c> VSUBPD </c> instruction.
104 /// A 256-bit vector of [4 x double] containing the minuend.
106 /// A 256-bit vector of [4 x double] containing the subtrahend.
107 /// \returns A 256-bit vector of [4 x double] containing the differences between
109 static __inline __m256d __DEFAULT_FN_ATTRS
110 _mm256_sub_pd(__m256d __a
, __m256d __b
)
112 return (__m256d
)((__v4df
)__a
-(__v4df
)__b
);
115 /// Subtracts two 256-bit vectors of [8 x float].
117 /// \headerfile <x86intrin.h>
119 /// This intrinsic corresponds to the <c> VSUBPS </c> instruction.
122 /// A 256-bit vector of [8 x float] containing the minuend.
124 /// A 256-bit vector of [8 x float] containing the subtrahend.
125 /// \returns A 256-bit vector of [8 x float] containing the differences between
127 static __inline __m256 __DEFAULT_FN_ATTRS
128 _mm256_sub_ps(__m256 __a
, __m256 __b
)
130 return (__m256
)((__v8sf
)__a
-(__v8sf
)__b
);
133 /// Adds the even-indexed values and subtracts the odd-indexed values of
134 /// two 256-bit vectors of [4 x double].
136 /// \headerfile <x86intrin.h>
138 /// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction.
141 /// A 256-bit vector of [4 x double] containing the left source operand.
143 /// A 256-bit vector of [4 x double] containing the right source operand.
144 /// \returns A 256-bit vector of [4 x double] containing the alternating sums
145 /// and differences between both operands.
146 static __inline __m256d __DEFAULT_FN_ATTRS
147 _mm256_addsub_pd(__m256d __a
, __m256d __b
)
149 return (__m256d
)__builtin_ia32_addsubpd256((__v4df
)__a
, (__v4df
)__b
);
152 /// Adds the even-indexed values and subtracts the odd-indexed values of
153 /// two 256-bit vectors of [8 x float].
155 /// \headerfile <x86intrin.h>
157 /// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction.
160 /// A 256-bit vector of [8 x float] containing the left source operand.
162 /// A 256-bit vector of [8 x float] containing the right source operand.
163 /// \returns A 256-bit vector of [8 x float] containing the alternating sums and
164 /// differences between both operands.
165 static __inline __m256 __DEFAULT_FN_ATTRS
166 _mm256_addsub_ps(__m256 __a
, __m256 __b
)
168 return (__m256
)__builtin_ia32_addsubps256((__v8sf
)__a
, (__v8sf
)__b
);
171 /// Divides two 256-bit vectors of [4 x double].
173 /// \headerfile <x86intrin.h>
175 /// This intrinsic corresponds to the <c> VDIVPD </c> instruction.
178 /// A 256-bit vector of [4 x double] containing the dividend.
180 /// A 256-bit vector of [4 x double] containing the divisor.
181 /// \returns A 256-bit vector of [4 x double] containing the quotients of both
183 static __inline __m256d __DEFAULT_FN_ATTRS
184 _mm256_div_pd(__m256d __a
, __m256d __b
)
186 return (__m256d
)((__v4df
)__a
/(__v4df
)__b
);
189 /// Divides two 256-bit vectors of [8 x float].
191 /// \headerfile <x86intrin.h>
193 /// This intrinsic corresponds to the <c> VDIVPS </c> instruction.
196 /// A 256-bit vector of [8 x float] containing the dividend.
198 /// A 256-bit vector of [8 x float] containing the divisor.
199 /// \returns A 256-bit vector of [8 x float] containing the quotients of both
201 static __inline __m256 __DEFAULT_FN_ATTRS
202 _mm256_div_ps(__m256 __a
, __m256 __b
)
204 return (__m256
)((__v8sf
)__a
/(__v8sf
)__b
);
207 /// Compares two 256-bit vectors of [4 x double] and returns the greater
208 /// of each pair of values.
210 /// \headerfile <x86intrin.h>
212 /// This intrinsic corresponds to the <c> VMAXPD </c> instruction.
215 /// A 256-bit vector of [4 x double] containing one of the operands.
217 /// A 256-bit vector of [4 x double] containing one of the operands.
218 /// \returns A 256-bit vector of [4 x double] containing the maximum values
219 /// between both operands.
220 static __inline __m256d __DEFAULT_FN_ATTRS
221 _mm256_max_pd(__m256d __a
, __m256d __b
)
223 return (__m256d
)__builtin_ia32_maxpd256((__v4df
)__a
, (__v4df
)__b
);
226 /// Compares two 256-bit vectors of [8 x float] and returns the greater
227 /// of each pair of values.
229 /// \headerfile <x86intrin.h>
231 /// This intrinsic corresponds to the <c> VMAXPS </c> instruction.
234 /// A 256-bit vector of [8 x float] containing one of the operands.
236 /// A 256-bit vector of [8 x float] containing one of the operands.
237 /// \returns A 256-bit vector of [8 x float] containing the maximum values
238 /// between both operands.
239 static __inline __m256 __DEFAULT_FN_ATTRS
240 _mm256_max_ps(__m256 __a
, __m256 __b
)
242 return (__m256
)__builtin_ia32_maxps256((__v8sf
)__a
, (__v8sf
)__b
);
245 /// Compares two 256-bit vectors of [4 x double] and returns the lesser
246 /// of each pair of values.
248 /// \headerfile <x86intrin.h>
250 /// This intrinsic corresponds to the <c> VMINPD </c> instruction.
253 /// A 256-bit vector of [4 x double] containing one of the operands.
255 /// A 256-bit vector of [4 x double] containing one of the operands.
256 /// \returns A 256-bit vector of [4 x double] containing the minimum values
257 /// between both operands.
258 static __inline __m256d __DEFAULT_FN_ATTRS
259 _mm256_min_pd(__m256d __a
, __m256d __b
)
261 return (__m256d
)__builtin_ia32_minpd256((__v4df
)__a
, (__v4df
)__b
);
264 /// Compares two 256-bit vectors of [8 x float] and returns the lesser
265 /// of each pair of values.
267 /// \headerfile <x86intrin.h>
269 /// This intrinsic corresponds to the <c> VMINPS </c> instruction.
272 /// A 256-bit vector of [8 x float] containing one of the operands.
274 /// A 256-bit vector of [8 x float] containing one of the operands.
275 /// \returns A 256-bit vector of [8 x float] containing the minimum values
276 /// between both operands.
277 static __inline __m256 __DEFAULT_FN_ATTRS
278 _mm256_min_ps(__m256 __a
, __m256 __b
)
280 return (__m256
)__builtin_ia32_minps256((__v8sf
)__a
, (__v8sf
)__b
);
283 /// Multiplies two 256-bit vectors of [4 x double].
285 /// \headerfile <x86intrin.h>
287 /// This intrinsic corresponds to the <c> VMULPD </c> instruction.
290 /// A 256-bit vector of [4 x double] containing one of the operands.
292 /// A 256-bit vector of [4 x double] containing one of the operands.
293 /// \returns A 256-bit vector of [4 x double] containing the products of both
295 static __inline __m256d __DEFAULT_FN_ATTRS
296 _mm256_mul_pd(__m256d __a
, __m256d __b
)
298 return (__m256d
)((__v4df
)__a
* (__v4df
)__b
);
301 /// Multiplies two 256-bit vectors of [8 x float].
303 /// \headerfile <x86intrin.h>
305 /// This intrinsic corresponds to the <c> VMULPS </c> instruction.
308 /// A 256-bit vector of [8 x float] containing one of the operands.
310 /// A 256-bit vector of [8 x float] containing one of the operands.
311 /// \returns A 256-bit vector of [8 x float] containing the products of both
313 static __inline __m256 __DEFAULT_FN_ATTRS
314 _mm256_mul_ps(__m256 __a
, __m256 __b
)
316 return (__m256
)((__v8sf
)__a
* (__v8sf
)__b
);
319 /// Calculates the square roots of the values in a 256-bit vector of
322 /// \headerfile <x86intrin.h>
324 /// This intrinsic corresponds to the <c> VSQRTPD </c> instruction.
327 /// A 256-bit vector of [4 x double].
328 /// \returns A 256-bit vector of [4 x double] containing the square roots of the
329 /// values in the operand.
330 static __inline __m256d __DEFAULT_FN_ATTRS
331 _mm256_sqrt_pd(__m256d __a
)
333 return (__m256d
)__builtin_ia32_sqrtpd256((__v4df
)__a
);
336 /// Calculates the square roots of the values in a 256-bit vector of
339 /// \headerfile <x86intrin.h>
341 /// This intrinsic corresponds to the <c> VSQRTPS </c> instruction.
344 /// A 256-bit vector of [8 x float].
345 /// \returns A 256-bit vector of [8 x float] containing the square roots of the
346 /// values in the operand.
347 static __inline __m256 __DEFAULT_FN_ATTRS
348 _mm256_sqrt_ps(__m256 __a
)
350 return (__m256
)__builtin_ia32_sqrtps256((__v8sf
)__a
);
353 /// Calculates the reciprocal square roots of the values in a 256-bit
354 /// vector of [8 x float].
356 /// \headerfile <x86intrin.h>
358 /// This intrinsic corresponds to the <c> VRSQRTPS </c> instruction.
361 /// A 256-bit vector of [8 x float].
362 /// \returns A 256-bit vector of [8 x float] containing the reciprocal square
363 /// roots of the values in the operand.
364 static __inline __m256 __DEFAULT_FN_ATTRS
365 _mm256_rsqrt_ps(__m256 __a
)
367 return (__m256
)__builtin_ia32_rsqrtps256((__v8sf
)__a
);
370 /// Calculates the reciprocals of the values in a 256-bit vector of
373 /// \headerfile <x86intrin.h>
375 /// This intrinsic corresponds to the <c> VRCPPS </c> instruction.
378 /// A 256-bit vector of [8 x float].
379 /// \returns A 256-bit vector of [8 x float] containing the reciprocals of the
380 /// values in the operand.
381 static __inline __m256 __DEFAULT_FN_ATTRS
382 _mm256_rcp_ps(__m256 __a
)
384 return (__m256
)__builtin_ia32_rcpps256((__v8sf
)__a
);
387 /// Rounds the values in a 256-bit vector of [4 x double] as specified
388 /// by the byte operand. The source values are rounded to integer values and
389 /// returned as 64-bit double-precision floating-point values.
391 /// \headerfile <x86intrin.h>
394 /// __m256d _mm256_round_pd(__m256d V, const int M);
397 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
400 /// A 256-bit vector of [4 x double].
402 /// An integer value that specifies the rounding operation. \n
403 /// Bits [7:4] are reserved. \n
404 /// Bit [3] is a precision exception value: \n
405 /// 0: A normal PE exception is used. \n
406 /// 1: The PE field is not updated. \n
407 /// Bit [2] is the rounding control source: \n
408 /// 0: Use bits [1:0] of \a M. \n
409 /// 1: Use the current MXCSR setting. \n
410 /// Bits [1:0] contain the rounding control definition: \n
412 /// 01: Downward (toward negative infinity). \n
413 /// 10: Upward (toward positive infinity). \n
415 /// \returns A 256-bit vector of [4 x double] containing the rounded values.
416 #define _mm256_round_pd(V, M) \
417 ((__m256d)__builtin_ia32_roundpd256((__v4df)(__m256d)(V), (M)))
419 /// Rounds the values stored in a 256-bit vector of [8 x float] as
420 /// specified by the byte operand. The source values are rounded to integer
421 /// values and returned as floating-point values.
423 /// \headerfile <x86intrin.h>
426 /// __m256 _mm256_round_ps(__m256 V, const int M);
429 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
432 /// A 256-bit vector of [8 x float].
434 /// An integer value that specifies the rounding operation. \n
435 /// Bits [7:4] are reserved. \n
436 /// Bit [3] is a precision exception value: \n
437 /// 0: A normal PE exception is used. \n
438 /// 1: The PE field is not updated. \n
439 /// Bit [2] is the rounding control source: \n
440 /// 0: Use bits [1:0] of \a M. \n
441 /// 1: Use the current MXCSR setting. \n
442 /// Bits [1:0] contain the rounding control definition: \n
444 /// 01: Downward (toward negative infinity). \n
445 /// 10: Upward (toward positive infinity). \n
447 /// \returns A 256-bit vector of [8 x float] containing the rounded values.
448 #define _mm256_round_ps(V, M) \
449 ((__m256)__builtin_ia32_roundps256((__v8sf)(__m256)(V), (M)))
451 /// Rounds up the values stored in a 256-bit vector of [4 x double]. The
452 /// source values are rounded up to integer values and returned as 64-bit
453 /// double-precision floating-point values.
455 /// \headerfile <x86intrin.h>
458 /// __m256d _mm256_ceil_pd(__m256d V);
461 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
464 /// A 256-bit vector of [4 x double].
465 /// \returns A 256-bit vector of [4 x double] containing the rounded up values.
466 #define _mm256_ceil_pd(V) _mm256_round_pd((V), _MM_FROUND_CEIL)
468 /// Rounds down the values stored in a 256-bit vector of [4 x double].
469 /// The source values are rounded down to integer values and returned as
470 /// 64-bit double-precision floating-point values.
472 /// \headerfile <x86intrin.h>
475 /// __m256d _mm256_floor_pd(__m256d V);
478 /// This intrinsic corresponds to the <c> VROUNDPD </c> instruction.
481 /// A 256-bit vector of [4 x double].
482 /// \returns A 256-bit vector of [4 x double] containing the rounded down
484 #define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)
486 /// Rounds up the values stored in a 256-bit vector of [8 x float]. The
487 /// source values are rounded up to integer values and returned as
488 /// floating-point values.
490 /// \headerfile <x86intrin.h>
493 /// __m256 _mm256_ceil_ps(__m256 V);
496 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
499 /// A 256-bit vector of [8 x float].
500 /// \returns A 256-bit vector of [8 x float] containing the rounded up values.
501 #define _mm256_ceil_ps(V) _mm256_round_ps((V), _MM_FROUND_CEIL)
503 /// Rounds down the values stored in a 256-bit vector of [8 x float]. The
504 /// source values are rounded down to integer values and returned as
505 /// floating-point values.
507 /// \headerfile <x86intrin.h>
510 /// __m256 _mm256_floor_ps(__m256 V);
513 /// This intrinsic corresponds to the <c> VROUNDPS </c> instruction.
516 /// A 256-bit vector of [8 x float].
517 /// \returns A 256-bit vector of [8 x float] containing the rounded down values.
518 #define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
521 /// Performs a bitwise AND of two 256-bit vectors of [4 x double].
523 /// \headerfile <x86intrin.h>
525 /// This intrinsic corresponds to the <c> VANDPD </c> instruction.
528 /// A 256-bit vector of [4 x double] containing one of the source operands.
530 /// A 256-bit vector of [4 x double] containing one of the source operands.
531 /// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
532 /// values between both operands.
533 static __inline __m256d __DEFAULT_FN_ATTRS
534 _mm256_and_pd(__m256d __a
, __m256d __b
)
536 return (__m256d
)((__v4du
)__a
& (__v4du
)__b
);
539 /// Performs a bitwise AND of two 256-bit vectors of [8 x float].
541 /// \headerfile <x86intrin.h>
543 /// This intrinsic corresponds to the <c> VANDPS </c> instruction.
546 /// A 256-bit vector of [8 x float] containing one of the source operands.
548 /// A 256-bit vector of [8 x float] containing one of the source operands.
549 /// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
550 /// values between both operands.
551 static __inline __m256 __DEFAULT_FN_ATTRS
552 _mm256_and_ps(__m256 __a
, __m256 __b
)
554 return (__m256
)((__v8su
)__a
& (__v8su
)__b
);
557 /// Performs a bitwise AND of two 256-bit vectors of [4 x double], using
558 /// the one's complement of the values contained in the first source operand.
560 /// \headerfile <x86intrin.h>
562 /// This intrinsic corresponds to the <c> VANDNPD </c> instruction.
565 /// A 256-bit vector of [4 x double] containing the left source operand. The
566 /// one's complement of this value is used in the bitwise AND.
568 /// A 256-bit vector of [4 x double] containing the right source operand.
569 /// \returns A 256-bit vector of [4 x double] containing the bitwise AND of the
570 /// values of the second operand and the one's complement of the first
572 static __inline __m256d __DEFAULT_FN_ATTRS
573 _mm256_andnot_pd(__m256d __a
, __m256d __b
)
575 return (__m256d
)(~(__v4du
)__a
& (__v4du
)__b
);
578 /// Performs a bitwise AND of two 256-bit vectors of [8 x float], using
579 /// the one's complement of the values contained in the first source operand.
581 /// \headerfile <x86intrin.h>
583 /// This intrinsic corresponds to the <c> VANDNPS </c> instruction.
586 /// A 256-bit vector of [8 x float] containing the left source operand. The
587 /// one's complement of this value is used in the bitwise AND.
589 /// A 256-bit vector of [8 x float] containing the right source operand.
590 /// \returns A 256-bit vector of [8 x float] containing the bitwise AND of the
591 /// values of the second operand and the one's complement of the first
593 static __inline __m256 __DEFAULT_FN_ATTRS
594 _mm256_andnot_ps(__m256 __a
, __m256 __b
)
596 return (__m256
)(~(__v8su
)__a
& (__v8su
)__b
);
599 /// Performs a bitwise OR of two 256-bit vectors of [4 x double].
601 /// \headerfile <x86intrin.h>
603 /// This intrinsic corresponds to the <c> VORPD </c> instruction.
606 /// A 256-bit vector of [4 x double] containing one of the source operands.
608 /// A 256-bit vector of [4 x double] containing one of the source operands.
609 /// \returns A 256-bit vector of [4 x double] containing the bitwise OR of the
610 /// values between both operands.
611 static __inline __m256d __DEFAULT_FN_ATTRS
612 _mm256_or_pd(__m256d __a
, __m256d __b
)
614 return (__m256d
)((__v4du
)__a
| (__v4du
)__b
);
617 /// Performs a bitwise OR of two 256-bit vectors of [8 x float].
619 /// \headerfile <x86intrin.h>
621 /// This intrinsic corresponds to the <c> VORPS </c> instruction.
624 /// A 256-bit vector of [8 x float] containing one of the source operands.
626 /// A 256-bit vector of [8 x float] containing one of the source operands.
627 /// \returns A 256-bit vector of [8 x float] containing the bitwise OR of the
628 /// values between both operands.
629 static __inline __m256 __DEFAULT_FN_ATTRS
630 _mm256_or_ps(__m256 __a
, __m256 __b
)
632 return (__m256
)((__v8su
)__a
| (__v8su
)__b
);
635 /// Performs a bitwise XOR of two 256-bit vectors of [4 x double].
637 /// \headerfile <x86intrin.h>
639 /// This intrinsic corresponds to the <c> VXORPD </c> instruction.
642 /// A 256-bit vector of [4 x double] containing one of the source operands.
644 /// A 256-bit vector of [4 x double] containing one of the source operands.
645 /// \returns A 256-bit vector of [4 x double] containing the bitwise XOR of the
646 /// values between both operands.
647 static __inline __m256d __DEFAULT_FN_ATTRS
648 _mm256_xor_pd(__m256d __a
, __m256d __b
)
650 return (__m256d
)((__v4du
)__a
^ (__v4du
)__b
);
653 /// Performs a bitwise XOR of two 256-bit vectors of [8 x float].
655 /// \headerfile <x86intrin.h>
657 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
660 /// A 256-bit vector of [8 x float] containing one of the source operands.
662 /// A 256-bit vector of [8 x float] containing one of the source operands.
663 /// \returns A 256-bit vector of [8 x float] containing the bitwise XOR of the
664 /// values between both operands.
665 static __inline __m256 __DEFAULT_FN_ATTRS
666 _mm256_xor_ps(__m256 __a
, __m256 __b
)
668 return (__m256
)((__v8su
)__a
^ (__v8su
)__b
);
671 /* Horizontal arithmetic */
672 /// Horizontally adds the adjacent pairs of values contained in two
673 /// 256-bit vectors of [4 x double].
675 /// \headerfile <x86intrin.h>
677 /// This intrinsic corresponds to the <c> VHADDPD </c> instruction.
680 /// A 256-bit vector of [4 x double] containing one of the source operands.
681 /// The horizontal sums of the values are returned in the even-indexed
682 /// elements of a vector of [4 x double].
684 /// A 256-bit vector of [4 x double] containing one of the source operands.
685 /// The horizontal sums of the values are returned in the odd-indexed
686 /// elements of a vector of [4 x double].
687 /// \returns A 256-bit vector of [4 x double] containing the horizontal sums of
689 static __inline __m256d __DEFAULT_FN_ATTRS
690 _mm256_hadd_pd(__m256d __a
, __m256d __b
)
692 return (__m256d
)__builtin_ia32_haddpd256((__v4df
)__a
, (__v4df
)__b
);
695 /// Horizontally adds the adjacent pairs of values contained in two
696 /// 256-bit vectors of [8 x float].
698 /// \headerfile <x86intrin.h>
700 /// This intrinsic corresponds to the <c> VHADDPS </c> instruction.
703 /// A 256-bit vector of [8 x float] containing one of the source operands.
704 /// The horizontal sums of the values are returned in the elements with
705 /// index 0, 1, 4, 5 of a vector of [8 x float].
707 /// A 256-bit vector of [8 x float] containing one of the source operands.
708 /// The horizontal sums of the values are returned in the elements with
709 /// index 2, 3, 6, 7 of a vector of [8 x float].
710 /// \returns A 256-bit vector of [8 x float] containing the horizontal sums of
712 static __inline __m256 __DEFAULT_FN_ATTRS
713 _mm256_hadd_ps(__m256 __a
, __m256 __b
)
715 return (__m256
)__builtin_ia32_haddps256((__v8sf
)__a
, (__v8sf
)__b
);
718 /// Horizontally subtracts the adjacent pairs of values contained in two
719 /// 256-bit vectors of [4 x double].
721 /// \headerfile <x86intrin.h>
723 /// This intrinsic corresponds to the <c> VHSUBPD </c> instruction.
726 /// A 256-bit vector of [4 x double] containing one of the source operands.
727 /// The horizontal differences between the values are returned in the
728 /// even-indexed elements of a vector of [4 x double].
730 /// A 256-bit vector of [4 x double] containing one of the source operands.
731 /// The horizontal differences between the values are returned in the
732 /// odd-indexed elements of a vector of [4 x double].
733 /// \returns A 256-bit vector of [4 x double] containing the horizontal
734 /// differences of both operands.
735 static __inline __m256d __DEFAULT_FN_ATTRS
736 _mm256_hsub_pd(__m256d __a
, __m256d __b
)
738 return (__m256d
)__builtin_ia32_hsubpd256((__v4df
)__a
, (__v4df
)__b
);
741 /// Horizontally subtracts the adjacent pairs of values contained in two
742 /// 256-bit vectors of [8 x float].
744 /// \headerfile <x86intrin.h>
746 /// This intrinsic corresponds to the <c> VHSUBPS </c> instruction.
749 /// A 256-bit vector of [8 x float] containing one of the source operands.
750 /// The horizontal differences between the values are returned in the
751 /// elements with index 0, 1, 4, 5 of a vector of [8 x float].
753 /// A 256-bit vector of [8 x float] containing one of the source operands.
754 /// The horizontal differences between the values are returned in the
755 /// elements with index 2, 3, 6, 7 of a vector of [8 x float].
756 /// \returns A 256-bit vector of [8 x float] containing the horizontal
757 /// differences of both operands.
758 static __inline __m256 __DEFAULT_FN_ATTRS
759 _mm256_hsub_ps(__m256 __a
, __m256 __b
)
761 return (__m256
)__builtin_ia32_hsubps256((__v8sf
)__a
, (__v8sf
)__b
);
764 /* Vector permutations */
765 /// Copies the values in a 128-bit vector of [2 x double] as specified
766 /// by the 128-bit integer vector operand.
768 /// \headerfile <x86intrin.h>
770 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
773 /// A 128-bit vector of [2 x double].
775 /// A 128-bit integer vector operand specifying how the values are to be
778 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
780 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
781 /// returned vector. \n
783 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
784 /// returned vector. \n
785 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
787 /// \returns A 128-bit vector of [2 x double] containing the copied values.
788 static __inline __m128d __DEFAULT_FN_ATTRS128
789 _mm_permutevar_pd(__m128d __a
, __m128i __c
)
791 return (__m128d
)__builtin_ia32_vpermilvarpd((__v2df
)__a
, (__v2di
)__c
);
794 /// Copies the values in a 256-bit vector of [4 x double] as specified
795 /// by the 256-bit integer vector operand.
797 /// \headerfile <x86intrin.h>
799 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
802 /// A 256-bit vector of [4 x double].
804 /// A 256-bit integer vector operand specifying how the values are to be
807 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
809 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
810 /// returned vector. \n
812 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
813 /// returned vector. \n
814 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
815 /// returned vector. \n
817 /// 0: Bits [191:128] of the source are copied to bits [191:128] of the
818 /// returned vector. \n
819 /// 1: Bits [255:192] of the source are copied to bits [191:128] of the
820 /// returned vector. \n
822 /// 0: Bits [191:128] of the source are copied to bits [255:192] of the
823 /// returned vector. \n
824 /// 1: Bits [255:192] of the source are copied to bits [255:192] of the
826 /// \returns A 256-bit vector of [4 x double] containing the copied values.
827 static __inline __m256d __DEFAULT_FN_ATTRS
828 _mm256_permutevar_pd(__m256d __a
, __m256i __c
)
830 return (__m256d
)__builtin_ia32_vpermilvarpd256((__v4df
)__a
, (__v4di
)__c
);
833 /// Copies the values stored in a 128-bit vector of [4 x float] as
834 /// specified by the 128-bit integer vector operand.
835 /// \headerfile <x86intrin.h>
837 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
840 /// A 128-bit vector of [4 x float].
842 /// A 128-bit integer vector operand specifying how the values are to be
845 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
846 /// returned vector. \n
847 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
848 /// returned vector. \n
849 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
850 /// returned vector. \n
851 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
852 /// returned vector. \n
854 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
855 /// returned vector. \n
856 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
857 /// returned vector. \n
858 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
859 /// returned vector. \n
860 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
861 /// returned vector. \n
863 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
864 /// returned vector. \n
865 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
866 /// returned vector. \n
867 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
868 /// returned vector. \n
869 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
870 /// returned vector. \n
872 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
873 /// returned vector. \n
874 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
875 /// returned vector. \n
876 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
877 /// returned vector. \n
878 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
880 /// \returns A 128-bit vector of [4 x float] containing the copied values.
881 static __inline __m128 __DEFAULT_FN_ATTRS128
882 _mm_permutevar_ps(__m128 __a
, __m128i __c
)
884 return (__m128
)__builtin_ia32_vpermilvarps((__v4sf
)__a
, (__v4si
)__c
);
887 /// Copies the values stored in a 256-bit vector of [8 x float] as
888 /// specified by the 256-bit integer vector operand.
890 /// \headerfile <x86intrin.h>
892 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
895 /// A 256-bit vector of [8 x float].
897 /// A 256-bit integer vector operand specifying how the values are to be
900 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
901 /// returned vector. \n
902 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
903 /// returned vector. \n
904 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
905 /// returned vector. \n
906 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
907 /// returned vector. \n
909 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
910 /// returned vector. \n
911 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
912 /// returned vector. \n
913 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
914 /// returned vector. \n
915 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
916 /// returned vector. \n
918 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
919 /// returned vector. \n
920 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
921 /// returned vector. \n
922 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
923 /// returned vector. \n
924 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
925 /// returned vector. \n
927 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
928 /// returned vector. \n
929 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
930 /// returned vector. \n
931 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
932 /// returned vector. \n
933 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
934 /// returned vector. \n
935 /// Bits [129:128]: \n
936 /// 00: Bits [159:128] of the source are copied to bits [159:128] of the
937 /// returned vector. \n
938 /// 01: Bits [191:160] of the source are copied to bits [159:128] of the
939 /// returned vector. \n
940 /// 10: Bits [223:192] of the source are copied to bits [159:128] of the
941 /// returned vector. \n
942 /// 11: Bits [255:224] of the source are copied to bits [159:128] of the
943 /// returned vector. \n
944 /// Bits [161:160]: \n
945 /// 00: Bits [159:128] of the source are copied to bits [191:160] of the
946 /// returned vector. \n
947 /// 01: Bits [191:160] of the source are copied to bits [191:160] of the
948 /// returned vector. \n
949 /// 10: Bits [223:192] of the source are copied to bits [191:160] of the
950 /// returned vector. \n
951 /// 11: Bits [255:224] of the source are copied to bits [191:160] of the
952 /// returned vector. \n
953 /// Bits [193:192]: \n
954 /// 00: Bits [159:128] of the source are copied to bits [223:192] of the
955 /// returned vector. \n
956 /// 01: Bits [191:160] of the source are copied to bits [223:192] of the
957 /// returned vector. \n
958 /// 10: Bits [223:192] of the source are copied to bits [223:192] of the
959 /// returned vector. \n
960 /// 11: Bits [255:224] of the source are copied to bits [223:192] of the
961 /// returned vector. \n
962 /// Bits [225:224]: \n
963 /// 00: Bits [159:128] of the source are copied to bits [255:224] of the
964 /// returned vector. \n
965 /// 01: Bits [191:160] of the source are copied to bits [255:224] of the
966 /// returned vector. \n
967 /// 10: Bits [223:192] of the source are copied to bits [255:224] of the
968 /// returned vector. \n
969 /// 11: Bits [255:224] of the source are copied to bits [255:224] of the
971 /// \returns A 256-bit vector of [8 x float] containing the copied values.
972 static __inline __m256 __DEFAULT_FN_ATTRS
973 _mm256_permutevar_ps(__m256 __a
, __m256i __c
)
975 return (__m256
)__builtin_ia32_vpermilvarps256((__v8sf
)__a
, (__v8si
)__c
);
978 /// Copies the values in a 128-bit vector of [2 x double] as specified
979 /// by the immediate integer operand.
981 /// \headerfile <x86intrin.h>
984 /// __m128d _mm_permute_pd(__m128d A, const int C);
987 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
990 /// A 128-bit vector of [2 x double].
992 /// An immediate integer operand specifying how the values are to be
995 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
997 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
998 /// returned vector. \n
1000 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
1001 /// returned vector. \n
1002 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
1003 /// returned vector.
1004 /// \returns A 128-bit vector of [2 x double] containing the copied values.
1005 #define _mm_permute_pd(A, C) \
1006 ((__m128d)__builtin_ia32_vpermilpd((__v2df)(__m128d)(A), (int)(C)))
1008 /// Copies the values in a 256-bit vector of [4 x double] as specified by
1009 /// the immediate integer operand.
1011 /// \headerfile <x86intrin.h>
1014 /// __m256d _mm256_permute_pd(__m256d A, const int C);
1017 /// This intrinsic corresponds to the <c> VPERMILPD </c> instruction.
1020 /// A 256-bit vector of [4 x double].
1022 /// An immediate integer operand specifying how the values are to be
1025 /// 0: Bits [63:0] of the source are copied to bits [63:0] of the returned
1027 /// 1: Bits [127:64] of the source are copied to bits [63:0] of the
1028 /// returned vector. \n
1030 /// 0: Bits [63:0] of the source are copied to bits [127:64] of the
1031 /// returned vector. \n
1032 /// 1: Bits [127:64] of the source are copied to bits [127:64] of the
1033 /// returned vector. \n
1035 /// 0: Bits [191:128] of the source are copied to bits [191:128] of the
1036 /// returned vector. \n
1037 /// 1: Bits [255:192] of the source are copied to bits [191:128] of the
1038 /// returned vector. \n
1040 /// 0: Bits [191:128] of the source are copied to bits [255:192] of the
1041 /// returned vector. \n
1042 /// 1: Bits [255:192] of the source are copied to bits [255:192] of the
1043 /// returned vector.
1044 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1045 #define _mm256_permute_pd(A, C) \
1046 ((__m256d)__builtin_ia32_vpermilpd256((__v4df)(__m256d)(A), (int)(C)))
1048 /// Copies the values in a 128-bit vector of [4 x float] as specified by
1049 /// the immediate integer operand.
1051 /// \headerfile <x86intrin.h>
1054 /// __m128 _mm_permute_ps(__m128 A, const int C);
1057 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1060 /// A 128-bit vector of [4 x float].
1062 /// An immediate integer operand specifying how the values are to be
1065 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1066 /// returned vector. \n
1067 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1068 /// returned vector. \n
1069 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1070 /// returned vector. \n
1071 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1072 /// returned vector. \n
1074 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1075 /// returned vector. \n
1076 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1077 /// returned vector. \n
1078 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1079 /// returned vector. \n
1080 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1081 /// returned vector. \n
1083 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1084 /// returned vector. \n
1085 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1086 /// returned vector. \n
1087 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1088 /// returned vector. \n
1089 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1090 /// returned vector. \n
1092 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1093 /// returned vector. \n
1094 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1095 /// returned vector. \n
1096 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1097 /// returned vector. \n
1098 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1099 /// returned vector.
1100 /// \returns A 128-bit vector of [4 x float] containing the copied values.
1101 #define _mm_permute_ps(A, C) \
1102 ((__m128)__builtin_ia32_vpermilps((__v4sf)(__m128)(A), (int)(C)))
1104 /// Copies the values in a 256-bit vector of [8 x float] as specified by
1105 /// the immediate integer operand.
1107 /// \headerfile <x86intrin.h>
1110 /// __m256 _mm256_permute_ps(__m256 A, const int C);
1113 /// This intrinsic corresponds to the <c> VPERMILPS </c> instruction.
1116 /// A 256-bit vector of [8 x float].
1118 /// An immediate integer operand specifying how the values are to be
1121 /// 00: Bits [31:0] of the source are copied to bits [31:0] of the
1122 /// returned vector. \n
1123 /// 01: Bits [63:32] of the source are copied to bits [31:0] of the
1124 /// returned vector. \n
1125 /// 10: Bits [95:64] of the source are copied to bits [31:0] of the
1126 /// returned vector. \n
1127 /// 11: Bits [127:96] of the source are copied to bits [31:0] of the
1128 /// returned vector. \n
1130 /// 00: Bits [31:0] of the source are copied to bits [63:32] of the
1131 /// returned vector. \n
1132 /// 01: Bits [63:32] of the source are copied to bits [63:32] of the
1133 /// returned vector. \n
1134 /// 10: Bits [95:64] of the source are copied to bits [63:32] of the
1135 /// returned vector. \n
1136 /// 11: Bits [127:96] of the source are copied to bits [63:32] of the
1137 /// returned vector. \n
1139 /// 00: Bits [31:0] of the source are copied to bits [95:64] of the
1140 /// returned vector. \n
1141 /// 01: Bits [63:32] of the source are copied to bits [95:64] of the
1142 /// returned vector. \n
1143 /// 10: Bits [95:64] of the source are copied to bits [95:64] of the
1144 /// returned vector. \n
1145 /// 11: Bits [127:96] of the source are copied to bits [95:64] of the
1146 /// returned vector. \n
1148 /// 00: Bits [31:0] of the source are copied to bits [127:96] of the
1149 /// returned vector. \n
1150 /// 01: Bits [63:32] of the source are copied to bits [127:96] of the
1151 /// returned vector. \n
1152 /// 10: Bits [95:64] of the source are copied to bits [127:96] of the
1153 /// returned vector. \n
1154 /// 11: Bits [127:96] of the source are copied to bits [127:96] of the
1155 /// returned vector. \n
1157 /// 00: Bits [159:128] of the source are copied to bits [159:128] of the
1158 /// returned vector. \n
1159 /// 01: Bits [191:160] of the source are copied to bits [159:128] of the
1160 /// returned vector. \n
1161 /// 10: Bits [223:192] of the source are copied to bits [159:128] of the
1162 /// returned vector. \n
1163 /// 11: Bits [255:224] of the source are copied to bits [159:128] of the
1164 /// returned vector. \n
1166 /// 00: Bits [159:128] of the source are copied to bits [191:160] of the
1167 /// returned vector. \n
1168 /// 01: Bits [191:160] of the source are copied to bits [191:160] of the
1169 /// returned vector. \n
1170 /// 10: Bits [223:192] of the source are copied to bits [191:160] of the
1171 /// returned vector. \n
1172 /// 11: Bits [255:224] of the source are copied to bits [191:160] of the
1173 /// returned vector. \n
1175 /// 00: Bits [159:128] of the source are copied to bits [223:192] of the
1176 /// returned vector. \n
1177 /// 01: Bits [191:160] of the source are copied to bits [223:192] of the
1178 /// returned vector. \n
1179 /// 10: Bits [223:192] of the source are copied to bits [223:192] of the
1180 /// returned vector. \n
1181 /// 11: Bits [255:224] of the source are copied to bits [223:192] of the
1182 /// returned vector. \n
1184 /// 00: Bits [159:128] of the source are copied to bits [255:224] of the
1185 /// returned vector. \n
1186 /// 01: Bits [191:160] of the source are copied to bits [255:224] of the
1187 /// returned vector. \n
1188 /// 10: Bits [223:192] of the source are copied to bits [255:224] of the
1189 /// returned vector. \n
1190 /// 11: Bits [255:224] of the source are copied to bits [255:224] of the
1191 /// returned vector.
1192 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1193 #define _mm256_permute_ps(A, C) \
1194 ((__m256)__builtin_ia32_vpermilps256((__v8sf)(__m256)(A), (int)(C)))
1196 /// Permutes 128-bit data values stored in two 256-bit vectors of
1197 /// [4 x double], as specified by the immediate integer operand.
1199 /// \headerfile <x86intrin.h>
1202 /// __m256d _mm256_permute2f128_pd(__m256d V1, __m256d V2, const int M);
1205 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1208 /// A 256-bit vector of [4 x double].
1210 /// A 256-bit vector of [4 x double.
1212 /// An immediate integer operand specifying how the values are to be
1215 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1217 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1219 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1221 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1224 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1226 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1228 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1230 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1232 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1233 #define _mm256_permute2f128_pd(V1, V2, M) \
1234 ((__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)(__m256d)(V1), \
1235 (__v4df)(__m256d)(V2), (int)(M)))
1237 /// Permutes 128-bit data values stored in two 256-bit vectors of
1238 /// [8 x float], as specified by the immediate integer operand.
1240 /// \headerfile <x86intrin.h>
1243 /// __m256 _mm256_permute2f128_ps(__m256 V1, __m256 V2, const int M);
1246 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1249 /// A 256-bit vector of [8 x float].
1251 /// A 256-bit vector of [8 x float].
1253 /// An immediate integer operand specifying how the values are to be
1256 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1258 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1260 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1262 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1265 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1267 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1269 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1271 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1273 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1274 #define _mm256_permute2f128_ps(V1, V2, M) \
1275 ((__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)(__m256)(V1), \
1276 (__v8sf)(__m256)(V2), (int)(M)))
1278 /// Permutes 128-bit data values stored in two 256-bit integer vectors,
1279 /// as specified by the immediate integer operand.
1281 /// \headerfile <x86intrin.h>
1284 /// __m256i _mm256_permute2f128_si256(__m256i V1, __m256i V2, const int M);
1287 /// This intrinsic corresponds to the <c> VPERM2F128 </c> instruction.
1290 /// A 256-bit integer vector.
1292 /// A 256-bit integer vector.
1294 /// An immediate integer operand specifying how the values are to be copied.
1296 /// 00: Bits [127:0] of operand \a V1 are copied to bits [127:0] of the
1298 /// 01: Bits [255:128] of operand \a V1 are copied to bits [127:0] of the
1300 /// 10: Bits [127:0] of operand \a V2 are copied to bits [127:0] of the
1302 /// 11: Bits [255:128] of operand \a V2 are copied to bits [127:0] of the
1305 /// 00: Bits [127:0] of operand \a V1 are copied to bits [255:128] of the
1307 /// 01: Bits [255:128] of operand \a V1 are copied to bits [255:128] of the
1309 /// 10: Bits [127:0] of operand \a V2 are copied to bits [255:128] of the
1311 /// 11: Bits [255:128] of operand \a V2 are copied to bits [255:128] of the
1313 /// \returns A 256-bit integer vector containing the copied values.
1314 #define _mm256_permute2f128_si256(V1, V2, M) \
1315 ((__m256i)__builtin_ia32_vperm2f128_si256((__v8si)(__m256i)(V1), \
1316 (__v8si)(__m256i)(V2), (int)(M)))
1319 /// Merges 64-bit double-precision data values stored in either of the
1320 /// two 256-bit vectors of [4 x double], as specified by the immediate
1321 /// integer operand.
1323 /// \headerfile <x86intrin.h>
1326 /// __m256d _mm256_blend_pd(__m256d V1, __m256d V2, const int M);
1329 /// This intrinsic corresponds to the <c> VBLENDPD </c> instruction.
1332 /// A 256-bit vector of [4 x double].
1334 /// A 256-bit vector of [4 x double].
1336 /// An immediate integer operand, with mask bits [3:0] specifying how the
1337 /// values are to be copied. The position of the mask bit corresponds to the
1338 /// index of a copied value. When a mask bit is 0, the corresponding 64-bit
1339 /// element in operand \a V1 is copied to the same position in the
1340 /// destination. When a mask bit is 1, the corresponding 64-bit element in
1341 /// operand \a V2 is copied to the same position in the destination.
1342 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1343 #define _mm256_blend_pd(V1, V2, M) \
1344 ((__m256d)__builtin_ia32_blendpd256((__v4df)(__m256d)(V1), \
1345 (__v4df)(__m256d)(V2), (int)(M)))
1347 /// Merges 32-bit single-precision data values stored in either of the
1348 /// two 256-bit vectors of [8 x float], as specified by the immediate
1349 /// integer operand.
1351 /// \headerfile <x86intrin.h>
1354 /// __m256 _mm256_blend_ps(__m256 V1, __m256 V2, const int M);
1357 /// This intrinsic corresponds to the <c> VBLENDPS </c> instruction.
1360 /// A 256-bit vector of [8 x float].
1362 /// A 256-bit vector of [8 x float].
1364 /// An immediate integer operand, with mask bits [7:0] specifying how the
1365 /// values are to be copied. The position of the mask bit corresponds to the
1366 /// index of a copied value. When a mask bit is 0, the corresponding 32-bit
1367 /// element in operand \a V1 is copied to the same position in the
1368 /// destination. When a mask bit is 1, the corresponding 32-bit element in
1369 /// operand \a V2 is copied to the same position in the destination.
1370 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1371 #define _mm256_blend_ps(V1, V2, M) \
1372 ((__m256)__builtin_ia32_blendps256((__v8sf)(__m256)(V1), \
1373 (__v8sf)(__m256)(V2), (int)(M)))
1375 /// Merges 64-bit double-precision data values stored in either of the
1376 /// two 256-bit vectors of [4 x double], as specified by the 256-bit vector
1379 /// \headerfile <x86intrin.h>
1381 /// This intrinsic corresponds to the <c> VBLENDVPD </c> instruction.
1384 /// A 256-bit vector of [4 x double].
1386 /// A 256-bit vector of [4 x double].
1388 /// A 256-bit vector operand, with mask bits 255, 191, 127, and 63 specifying
1389 /// how the values are to be copied. The position of the mask bit corresponds
1390 /// to the most significant bit of a copied value. When a mask bit is 0, the
1391 /// corresponding 64-bit element in operand \a __a is copied to the same
1392 /// position in the destination. When a mask bit is 1, the corresponding
1393 /// 64-bit element in operand \a __b is copied to the same position in the
1395 /// \returns A 256-bit vector of [4 x double] containing the copied values.
1396 static __inline __m256d __DEFAULT_FN_ATTRS
1397 _mm256_blendv_pd(__m256d __a
, __m256d __b
, __m256d __c
)
1399 return (__m256d
)__builtin_ia32_blendvpd256(
1400 (__v4df
)__a
, (__v4df
)__b
, (__v4df
)__c
);
1403 /// Merges 32-bit single-precision data values stored in either of the
1404 /// two 256-bit vectors of [8 x float], as specified by the 256-bit vector
1407 /// \headerfile <x86intrin.h>
1409 /// This intrinsic corresponds to the <c> VBLENDVPS </c> instruction.
1412 /// A 256-bit vector of [8 x float].
1414 /// A 256-bit vector of [8 x float].
1416 /// A 256-bit vector operand, with mask bits 255, 223, 191, 159, 127, 95, 63,
1417 /// and 31 specifying how the values are to be copied. The position of the
1418 /// mask bit corresponds to the most significant bit of a copied value. When
1419 /// a mask bit is 0, the corresponding 32-bit element in operand \a __a is
1420 /// copied to the same position in the destination. When a mask bit is 1, the
1421 /// corresponding 32-bit element in operand \a __b is copied to the same
1422 /// position in the destination.
1423 /// \returns A 256-bit vector of [8 x float] containing the copied values.
1424 static __inline __m256 __DEFAULT_FN_ATTRS
1425 _mm256_blendv_ps(__m256 __a
, __m256 __b
, __m256 __c
)
1427 return (__m256
)__builtin_ia32_blendvps256(
1428 (__v8sf
)__a
, (__v8sf
)__b
, (__v8sf
)__c
);
1431 /* Vector Dot Product */
1432 /// Computes two dot products in parallel, using the lower and upper
1433 /// halves of two [8 x float] vectors as input to the two computations, and
1434 /// returning the two dot products in the lower and upper halves of the
1435 /// [8 x float] result.
1437 /// The immediate integer operand controls which input elements will
1438 /// contribute to the dot product, and where the final results are returned.
1439 /// In general, for each dot product, the four corresponding elements of the
1440 /// input vectors are multiplied; the first two and second two products are
1441 /// summed, then the two sums are added to form the final result.
1443 /// \headerfile <x86intrin.h>
1446 /// __m256 _mm256_dp_ps(__m256 V1, __m256 V2, const int M);
1449 /// This intrinsic corresponds to the <c> VDPPS </c> instruction.
1452 /// A vector of [8 x float] values, treated as two [4 x float] vectors.
1454 /// A vector of [8 x float] values, treated as two [4 x float] vectors.
1456 /// An immediate integer argument. Bits [7:4] determine which elements of
1457 /// the input vectors are used, with bit [4] corresponding to the lowest
1458 /// element and bit [7] corresponding to the highest element of each [4 x
1459 /// float] subvector. If a bit is set, the corresponding elements from the
1460 /// two input vectors are used as an input for dot product; otherwise that
1461 /// input is treated as zero. Bits [3:0] determine which elements of the
1462 /// result will receive a copy of the final dot product, with bit [0]
1463 /// corresponding to the lowest element and bit [3] corresponding to the
1464 /// highest element of each [4 x float] subvector. If a bit is set, the dot
1465 /// product is returned in the corresponding element; otherwise that element
1466 /// is set to zero. The bitmask is applied in the same way to each of the
1467 /// two parallel dot product computations.
1468 /// \returns A 256-bit vector of [8 x float] containing the two dot products.
1469 #define _mm256_dp_ps(V1, V2, M) \
1470 ((__m256)__builtin_ia32_dpps256((__v8sf)(__m256)(V1), \
1471 (__v8sf)(__m256)(V2), (M)))
1473 /* Vector shuffle */
1474 /// Selects 8 float values from the 256-bit operands of [8 x float], as
1475 /// specified by the immediate value operand.
1477 /// The four selected elements in each operand are copied to the destination
1478 /// according to the bits specified in the immediate operand. The selected
1479 /// elements from the first 256-bit operand are copied to bits [63:0] and
1480 /// bits [191:128] of the destination, and the selected elements from the
1481 /// second 256-bit operand are copied to bits [127:64] and bits [255:192] of
1482 /// the destination. For example, if bits [7:0] of the immediate operand
1483 /// contain a value of 0xFF, the 256-bit destination vector would contain the
1484 /// following values: b[7], b[7], a[7], a[7], b[3], b[3], a[3], a[3].
1486 /// \headerfile <x86intrin.h>
1489 /// __m256 _mm256_shuffle_ps(__m256 a, __m256 b, const int mask);
1492 /// This intrinsic corresponds to the <c> VSHUFPS </c> instruction.
1495 /// A 256-bit vector of [8 x float]. The four selected elements in this
1496 /// operand are copied to bits [63:0] and bits [191:128] in the destination,
1497 /// according to the bits specified in the immediate operand.
1499 /// A 256-bit vector of [8 x float]. The four selected elements in this
1500 /// operand are copied to bits [127:64] and bits [255:192] in the
1501 /// destination, according to the bits specified in the immediate operand.
1503 /// An immediate value containing an 8-bit value specifying which elements to
1504 /// copy from \a a and \a b \n.
1505 /// Bits [3:0] specify the values copied from operand \a a. \n
1506 /// Bits [7:4] specify the values copied from operand \a b. \n
1507 /// The destinations within the 256-bit destination are assigned values as
1508 /// follows, according to the bit value assignments described below: \n
1509 /// Bits [1:0] are used to assign values to bits [31:0] and [159:128] in the
1511 /// Bits [3:2] are used to assign values to bits [63:32] and [191:160] in the
1513 /// Bits [5:4] are used to assign values to bits [95:64] and [223:192] in the
1515 /// Bits [7:6] are used to assign values to bits [127:96] and [255:224] in
1516 /// the destination. \n
1517 /// Bit value assignments: \n
1518 /// 00: Bits [31:0] and [159:128] are copied from the selected operand. \n
1519 /// 01: Bits [63:32] and [191:160] are copied from the selected operand. \n
1520 /// 10: Bits [95:64] and [223:192] are copied from the selected operand. \n
1521 /// 11: Bits [127:96] and [255:224] are copied from the selected operand. \n
1522 /// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
1523 /// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
1524 /// <c>[b6, b4, b2, b0]</c>.
1525 /// \returns A 256-bit vector of [8 x float] containing the shuffled values.
1526 #define _mm256_shuffle_ps(a, b, mask) \
1527 ((__m256)__builtin_ia32_shufps256((__v8sf)(__m256)(a), \
1528 (__v8sf)(__m256)(b), (int)(mask)))
1530 /// Selects four double-precision values from the 256-bit operands of
1531 /// [4 x double], as specified by the immediate value operand.
1533 /// The selected elements from the first 256-bit operand are copied to bits
1534 /// [63:0] and bits [191:128] in the destination, and the selected elements
1535 /// from the second 256-bit operand are copied to bits [127:64] and bits
1536 /// [255:192] in the destination. For example, if bits [3:0] of the immediate
1537 /// operand contain a value of 0xF, the 256-bit destination vector would
1538 /// contain the following values: b[3], a[3], b[1], a[1].
1540 /// \headerfile <x86intrin.h>
1543 /// __m256d _mm256_shuffle_pd(__m256d a, __m256d b, const int mask);
1546 /// This intrinsic corresponds to the <c> VSHUFPD </c> instruction.
1549 /// A 256-bit vector of [4 x double].
1551 /// A 256-bit vector of [4 x double].
1553 /// An immediate value containing 8-bit values specifying which elements to
1554 /// copy from \a a and \a b: \n
1555 /// Bit [0]=0: Bits [63:0] are copied from \a a to bits [63:0] of the
1557 /// Bit [0]=1: Bits [127:64] are copied from \a a to bits [63:0] of the
1559 /// Bit [1]=0: Bits [63:0] are copied from \a b to bits [127:64] of the
1561 /// Bit [1]=1: Bits [127:64] are copied from \a b to bits [127:64] of the
1563 /// Bit [2]=0: Bits [191:128] are copied from \a a to bits [191:128] of the
1565 /// Bit [2]=1: Bits [255:192] are copied from \a a to bits [191:128] of the
1567 /// Bit [3]=0: Bits [191:128] are copied from \a b to bits [255:192] of the
1569 /// Bit [3]=1: Bits [255:192] are copied from \a b to bits [255:192] of the
1571 /// \returns A 256-bit vector of [4 x double] containing the shuffled values.
1572 #define _mm256_shuffle_pd(a, b, mask) \
1573 ((__m256d)__builtin_ia32_shufpd256((__v4df)(__m256d)(a), \
1574 (__v4df)(__m256d)(b), (int)(mask)))
1577 #define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
1578 #define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */
1579 #define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */
1580 #define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */
1581 #define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */
1582 #define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */
1583 #define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */
1584 #define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */
1585 #define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */
1586 #define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unordered, signaling) */
1587 #define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */
1588 #define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */
1589 #define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */
1590 #define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */
1591 #define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */
1592 #define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */
1593 #define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */
1594 #define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */
1595 #define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */
1596 #define _CMP_UNORD_S 0x13 /* Unordered (signaling) */
1597 #define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */
1598 #define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */
1599 #define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unordered, non-signaling) */
1600 #define _CMP_ORD_S 0x17 /* Ordered (signaling) */
1601 #define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */
1602 #define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unordered, non-signaling) */
1603 #define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */
1604 #define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */
1605 #define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */
1606 #define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */
1607 #define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */
1608 #define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */
1610 /// Compares each of the corresponding double-precision values of two
1611 /// 128-bit vectors of [2 x double], using the operation specified by the
1612 /// immediate integer operand.
1614 /// Returns a [2 x double] vector consisting of two doubles corresponding to
1615 /// the two comparison results: zero if the comparison is false, and all 1's
1616 /// if the comparison is true.
1618 /// \headerfile <x86intrin.h>
1621 /// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
1624 /// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1627 /// A 128-bit vector of [2 x double].
1629 /// A 128-bit vector of [2 x double].
1631 /// An immediate integer operand, with bits [4:0] specifying which comparison
1632 /// operation to use: \n
1633 /// 0x00: Equal (ordered, non-signaling) \n
1634 /// 0x01: Less-than (ordered, signaling) \n
1635 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1636 /// 0x03: Unordered (non-signaling) \n
1637 /// 0x04: Not-equal (unordered, non-signaling) \n
1638 /// 0x05: Not-less-than (unordered, signaling) \n
1639 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1640 /// 0x07: Ordered (non-signaling) \n
1641 /// 0x08: Equal (unordered, non-signaling) \n
1642 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1643 /// 0x0A: Not-greater-than (unordered, signaling) \n
1644 /// 0x0B: False (ordered, non-signaling) \n
1645 /// 0x0C: Not-equal (ordered, non-signaling) \n
1646 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1647 /// 0x0E: Greater-than (ordered, signaling) \n
1648 /// 0x0F: True (unordered, non-signaling) \n
1649 /// 0x10: Equal (ordered, signaling) \n
1650 /// 0x11: Less-than (ordered, non-signaling) \n
1651 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1652 /// 0x13: Unordered (signaling) \n
1653 /// 0x14: Not-equal (unordered, signaling) \n
1654 /// 0x15: Not-less-than (unordered, non-signaling) \n
1655 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1656 /// 0x17: Ordered (signaling) \n
1657 /// 0x18: Equal (unordered, signaling) \n
1658 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1659 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1660 /// 0x1B: False (ordered, signaling) \n
1661 /// 0x1C: Not-equal (ordered, signaling) \n
1662 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1663 /// 0x1E: Greater-than (ordered, non-signaling) \n
1664 /// 0x1F: True (unordered, signaling)
1665 /// \returns A 128-bit vector of [2 x double] containing the comparison results.
1666 #define _mm_cmp_pd(a, b, c) \
1667 ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), \
1668 (__v2df)(__m128d)(b), (c)))
1670 /// Compares each of the corresponding values of two 128-bit vectors of
1671 /// [4 x float], using the operation specified by the immediate integer
1674 /// Returns a [4 x float] vector consisting of four floats corresponding to
1675 /// the four comparison results: zero if the comparison is false, and all 1's
1676 /// if the comparison is true.
1678 /// \headerfile <x86intrin.h>
1681 /// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
1684 /// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1687 /// A 128-bit vector of [4 x float].
1689 /// A 128-bit vector of [4 x float].
1691 /// An immediate integer operand, with bits [4:0] specifying which comparison
1692 /// operation to use: \n
1693 /// 0x00: Equal (ordered, non-signaling) \n
1694 /// 0x01: Less-than (ordered, signaling) \n
1695 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1696 /// 0x03: Unordered (non-signaling) \n
1697 /// 0x04: Not-equal (unordered, non-signaling) \n
1698 /// 0x05: Not-less-than (unordered, signaling) \n
1699 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1700 /// 0x07: Ordered (non-signaling) \n
1701 /// 0x08: Equal (unordered, non-signaling) \n
1702 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1703 /// 0x0A: Not-greater-than (unordered, signaling) \n
1704 /// 0x0B: False (ordered, non-signaling) \n
1705 /// 0x0C: Not-equal (ordered, non-signaling) \n
1706 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1707 /// 0x0E: Greater-than (ordered, signaling) \n
1708 /// 0x0F: True (unordered, non-signaling) \n
1709 /// 0x10: Equal (ordered, signaling) \n
1710 /// 0x11: Less-than (ordered, non-signaling) \n
1711 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1712 /// 0x13: Unordered (signaling) \n
1713 /// 0x14: Not-equal (unordered, signaling) \n
1714 /// 0x15: Not-less-than (unordered, non-signaling) \n
1715 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1716 /// 0x17: Ordered (signaling) \n
1717 /// 0x18: Equal (unordered, signaling) \n
1718 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1719 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1720 /// 0x1B: False (ordered, signaling) \n
1721 /// 0x1C: Not-equal (ordered, signaling) \n
1722 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1723 /// 0x1E: Greater-than (ordered, non-signaling) \n
1724 /// 0x1F: True (unordered, signaling)
1725 /// \returns A 128-bit vector of [4 x float] containing the comparison results.
1726 #define _mm_cmp_ps(a, b, c) \
1727 ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), \
1728 (__v4sf)(__m128)(b), (c)))
1730 /// Compares each of the corresponding double-precision values of two
1731 /// 256-bit vectors of [4 x double], using the operation specified by the
1732 /// immediate integer operand.
1734 /// Returns a [4 x double] vector consisting of four doubles corresponding to
1735 /// the four comparison results: zero if the comparison is false, and all 1's
1736 /// if the comparison is true.
1738 /// \headerfile <x86intrin.h>
1741 /// __m256d _mm256_cmp_pd(__m256d a, __m256d b, const int c);
1744 /// This intrinsic corresponds to the <c> VCMPPD </c> instruction.
1747 /// A 256-bit vector of [4 x double].
1749 /// A 256-bit vector of [4 x double].
1751 /// An immediate integer operand, with bits [4:0] specifying which comparison
1752 /// operation to use: \n
1753 /// 0x00: Equal (ordered, non-signaling) \n
1754 /// 0x01: Less-than (ordered, signaling) \n
1755 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1756 /// 0x03: Unordered (non-signaling) \n
1757 /// 0x04: Not-equal (unordered, non-signaling) \n
1758 /// 0x05: Not-less-than (unordered, signaling) \n
1759 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1760 /// 0x07: Ordered (non-signaling) \n
1761 /// 0x08: Equal (unordered, non-signaling) \n
1762 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1763 /// 0x0A: Not-greater-than (unordered, signaling) \n
1764 /// 0x0B: False (ordered, non-signaling) \n
1765 /// 0x0C: Not-equal (ordered, non-signaling) \n
1766 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1767 /// 0x0E: Greater-than (ordered, signaling) \n
1768 /// 0x0F: True (unordered, non-signaling) \n
1769 /// 0x10: Equal (ordered, signaling) \n
1770 /// 0x11: Less-than (ordered, non-signaling) \n
1771 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1772 /// 0x13: Unordered (signaling) \n
1773 /// 0x14: Not-equal (unordered, signaling) \n
1774 /// 0x15: Not-less-than (unordered, non-signaling) \n
1775 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1776 /// 0x17: Ordered (signaling) \n
1777 /// 0x18: Equal (unordered, signaling) \n
1778 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1779 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1780 /// 0x1B: False (ordered, signaling) \n
1781 /// 0x1C: Not-equal (ordered, signaling) \n
1782 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1783 /// 0x1E: Greater-than (ordered, non-signaling) \n
1784 /// 0x1F: True (unordered, signaling)
1785 /// \returns A 256-bit vector of [4 x double] containing the comparison results.
1786 #define _mm256_cmp_pd(a, b, c) \
1787 ((__m256d)__builtin_ia32_cmppd256((__v4df)(__m256d)(a), \
1788 (__v4df)(__m256d)(b), (c)))
1790 /// Compares each of the corresponding values of two 256-bit vectors of
1791 /// [8 x float], using the operation specified by the immediate integer
1794 /// Returns a [8 x float] vector consisting of eight floats corresponding to
1795 /// the eight comparison results: zero if the comparison is false, and all
1796 /// 1's if the comparison is true.
1798 /// \headerfile <x86intrin.h>
1801 /// __m256 _mm256_cmp_ps(__m256 a, __m256 b, const int c);
1804 /// This intrinsic corresponds to the <c> VCMPPS </c> instruction.
1807 /// A 256-bit vector of [8 x float].
1809 /// A 256-bit vector of [8 x float].
1811 /// An immediate integer operand, with bits [4:0] specifying which comparison
1812 /// operation to use: \n
1813 /// 0x00: Equal (ordered, non-signaling) \n
1814 /// 0x01: Less-than (ordered, signaling) \n
1815 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1816 /// 0x03: Unordered (non-signaling) \n
1817 /// 0x04: Not-equal (unordered, non-signaling) \n
1818 /// 0x05: Not-less-than (unordered, signaling) \n
1819 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1820 /// 0x07: Ordered (non-signaling) \n
1821 /// 0x08: Equal (unordered, non-signaling) \n
1822 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1823 /// 0x0A: Not-greater-than (unordered, signaling) \n
1824 /// 0x0B: False (ordered, non-signaling) \n
1825 /// 0x0C: Not-equal (ordered, non-signaling) \n
1826 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1827 /// 0x0E: Greater-than (ordered, signaling) \n
1828 /// 0x0F: True (unordered, non-signaling) \n
1829 /// 0x10: Equal (ordered, signaling) \n
1830 /// 0x11: Less-than (ordered, non-signaling) \n
1831 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1832 /// 0x13: Unordered (signaling) \n
1833 /// 0x14: Not-equal (unordered, signaling) \n
1834 /// 0x15: Not-less-than (unordered, non-signaling) \n
1835 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1836 /// 0x17: Ordered (signaling) \n
1837 /// 0x18: Equal (unordered, signaling) \n
1838 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1839 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1840 /// 0x1B: False (ordered, signaling) \n
1841 /// 0x1C: Not-equal (ordered, signaling) \n
1842 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1843 /// 0x1E: Greater-than (ordered, non-signaling) \n
1844 /// 0x1F: True (unordered, signaling)
1845 /// \returns A 256-bit vector of [8 x float] containing the comparison results.
1846 #define _mm256_cmp_ps(a, b, c) \
1847 ((__m256)__builtin_ia32_cmpps256((__v8sf)(__m256)(a), \
1848 (__v8sf)(__m256)(b), (c)))
1850 /// Compares each of the corresponding scalar double-precision values of
1851 /// two 128-bit vectors of [2 x double], using the operation specified by the
1852 /// immediate integer operand.
1854 /// If the result is true, all 64 bits of the destination vector are set;
1855 /// otherwise they are cleared.
1857 /// \headerfile <x86intrin.h>
1860 /// __m128d _mm_cmp_sd(__m128d a, __m128d b, const int c);
1863 /// This intrinsic corresponds to the <c> VCMPSD </c> instruction.
1866 /// A 128-bit vector of [2 x double].
1868 /// A 128-bit vector of [2 x double].
1870 /// An immediate integer operand, with bits [4:0] specifying which comparison
1871 /// operation to use: \n
1872 /// 0x00: Equal (ordered, non-signaling) \n
1873 /// 0x01: Less-than (ordered, signaling) \n
1874 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1875 /// 0x03: Unordered (non-signaling) \n
1876 /// 0x04: Not-equal (unordered, non-signaling) \n
1877 /// 0x05: Not-less-than (unordered, signaling) \n
1878 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1879 /// 0x07: Ordered (non-signaling) \n
1880 /// 0x08: Equal (unordered, non-signaling) \n
1881 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1882 /// 0x0A: Not-greater-than (unordered, signaling) \n
1883 /// 0x0B: False (ordered, non-signaling) \n
1884 /// 0x0C: Not-equal (ordered, non-signaling) \n
1885 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1886 /// 0x0E: Greater-than (ordered, signaling) \n
1887 /// 0x0F: True (unordered, non-signaling) \n
1888 /// 0x10: Equal (ordered, signaling) \n
1889 /// 0x11: Less-than (ordered, non-signaling) \n
1890 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1891 /// 0x13: Unordered (signaling) \n
1892 /// 0x14: Not-equal (unordered, signaling) \n
1893 /// 0x15: Not-less-than (unordered, non-signaling) \n
1894 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1895 /// 0x17: Ordered (signaling) \n
1896 /// 0x18: Equal (unordered, signaling) \n
1897 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1898 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1899 /// 0x1B: False (ordered, signaling) \n
1900 /// 0x1C: Not-equal (ordered, signaling) \n
1901 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1902 /// 0x1E: Greater-than (ordered, non-signaling) \n
1903 /// 0x1F: True (unordered, signaling)
1904 /// \returns A 128-bit vector of [2 x double] containing the comparison results.
1905 #define _mm_cmp_sd(a, b, c) \
1906 ((__m128d)__builtin_ia32_cmpsd((__v2df)(__m128d)(a), \
1907 (__v2df)(__m128d)(b), (c)))
1909 /// Compares each of the corresponding scalar values of two 128-bit
1910 /// vectors of [4 x float], using the operation specified by the immediate
1911 /// integer operand.
1913 /// If the result is true, all 32 bits of the destination vector are set;
1914 /// otherwise they are cleared.
1916 /// \headerfile <x86intrin.h>
1919 /// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c);
1922 /// This intrinsic corresponds to the <c> VCMPSS </c> instruction.
1925 /// A 128-bit vector of [4 x float].
1927 /// A 128-bit vector of [4 x float].
1929 /// An immediate integer operand, with bits [4:0] specifying which comparison
1930 /// operation to use: \n
1931 /// 0x00: Equal (ordered, non-signaling) \n
1932 /// 0x01: Less-than (ordered, signaling) \n
1933 /// 0x02: Less-than-or-equal (ordered, signaling) \n
1934 /// 0x03: Unordered (non-signaling) \n
1935 /// 0x04: Not-equal (unordered, non-signaling) \n
1936 /// 0x05: Not-less-than (unordered, signaling) \n
1937 /// 0x06: Not-less-than-or-equal (unordered, signaling) \n
1938 /// 0x07: Ordered (non-signaling) \n
1939 /// 0x08: Equal (unordered, non-signaling) \n
1940 /// 0x09: Not-greater-than-or-equal (unordered, signaling) \n
1941 /// 0x0A: Not-greater-than (unordered, signaling) \n
1942 /// 0x0B: False (ordered, non-signaling) \n
1943 /// 0x0C: Not-equal (ordered, non-signaling) \n
1944 /// 0x0D: Greater-than-or-equal (ordered, signaling) \n
1945 /// 0x0E: Greater-than (ordered, signaling) \n
1946 /// 0x0F: True (unordered, non-signaling) \n
1947 /// 0x10: Equal (ordered, signaling) \n
1948 /// 0x11: Less-than (ordered, non-signaling) \n
1949 /// 0x12: Less-than-or-equal (ordered, non-signaling) \n
1950 /// 0x13: Unordered (signaling) \n
1951 /// 0x14: Not-equal (unordered, signaling) \n
1952 /// 0x15: Not-less-than (unordered, non-signaling) \n
1953 /// 0x16: Not-less-than-or-equal (unordered, non-signaling) \n
1954 /// 0x17: Ordered (signaling) \n
1955 /// 0x18: Equal (unordered, signaling) \n
1956 /// 0x19: Not-greater-than-or-equal (unordered, non-signaling) \n
1957 /// 0x1A: Not-greater-than (unordered, non-signaling) \n
1958 /// 0x1B: False (ordered, signaling) \n
1959 /// 0x1C: Not-equal (ordered, signaling) \n
1960 /// 0x1D: Greater-than-or-equal (ordered, non-signaling) \n
1961 /// 0x1E: Greater-than (ordered, non-signaling) \n
1962 /// 0x1F: True (unordered, signaling)
1963 /// \returns A 128-bit vector of [4 x float] containing the comparison results.
1964 #define _mm_cmp_ss(a, b, c) \
1965 ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), \
1966 (__v4sf)(__m128)(b), (c)))
1968 /// Takes a [8 x i32] vector and returns the vector element value
1969 /// indexed by the immediate constant operand.
1971 /// \headerfile <x86intrin.h>
1974 /// int _mm256_extract_epi32(__m256i X, const int N);
1977 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
1981 /// A 256-bit vector of [8 x i32].
1983 /// An immediate integer operand with bits [2:0] determining which vector
1984 /// element is extracted and returned.
1985 /// \returns A 32-bit integer containing the extracted 32 bits of extended
1987 #define _mm256_extract_epi32(X, N) \
1988 ((int)__builtin_ia32_vec_ext_v8si((__v8si)(__m256i)(X), (int)(N)))
1990 /// Takes a [16 x i16] vector and returns the vector element value
1991 /// indexed by the immediate constant operand.
1993 /// \headerfile <x86intrin.h>
1996 /// int _mm256_extract_epi16(__m256i X, const int N);
1999 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2003 /// A 256-bit integer vector of [16 x i16].
2005 /// An immediate integer operand with bits [3:0] determining which vector
2006 /// element is extracted and returned.
2007 /// \returns A 32-bit integer containing the extracted 16 bits of zero extended
2009 #define _mm256_extract_epi16(X, N) \
2010 ((int)(unsigned short)__builtin_ia32_vec_ext_v16hi((__v16hi)(__m256i)(X), \
2013 /// Takes a [32 x i8] vector and returns the vector element value
2014 /// indexed by the immediate constant operand.
2016 /// \headerfile <x86intrin.h>
2019 /// int _mm256_extract_epi8(__m256i X, const int N);
2022 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2026 /// A 256-bit integer vector of [32 x i8].
2028 /// An immediate integer operand with bits [4:0] determining which vector
2029 /// element is extracted and returned.
2030 /// \returns A 32-bit integer containing the extracted 8 bits of zero extended
2032 #define _mm256_extract_epi8(X, N) \
2033 ((int)(unsigned char)__builtin_ia32_vec_ext_v32qi((__v32qi)(__m256i)(X), \
2037 /// Takes a [4 x i64] vector and returns the vector element value
2038 /// indexed by the immediate constant operand.
2040 /// \headerfile <x86intrin.h>
2043 /// long long _mm256_extract_epi64(__m256i X, const int N);
2046 /// This intrinsic corresponds to the <c> VEXTRACTF128+COMPOSITE </c>
2050 /// A 256-bit integer vector of [4 x i64].
2052 /// An immediate integer operand with bits [1:0] determining which vector
2053 /// element is extracted and returned.
2054 /// \returns A 64-bit integer containing the extracted 64 bits of extended
2056 #define _mm256_extract_epi64(X, N) \
2057 ((long long)__builtin_ia32_vec_ext_v4di((__v4di)(__m256i)(X), (int)(N)))
2060 /// Takes a [8 x i32] vector and replaces the vector element value
2061 /// indexed by the immediate constant operand by a new value. Returns the
2062 /// modified vector.
2064 /// \headerfile <x86intrin.h>
2067 /// __m256i _mm256_insert_epi32(__m256i X, int I, const int N);
2070 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2074 /// A vector of [8 x i32] to be used by the insert operation.
2076 /// An integer value. The replacement value for the insert operation.
2078 /// An immediate integer specifying the index of the vector element to be
2080 /// \returns A copy of vector \a X, after replacing its element indexed by
2082 #define _mm256_insert_epi32(X, I, N) \
2083 ((__m256i)__builtin_ia32_vec_set_v8si((__v8si)(__m256i)(X), \
2084 (int)(I), (int)(N)))
2087 /// Takes a [16 x i16] vector and replaces the vector element value
2088 /// indexed by the immediate constant operand with a new value. Returns the
2089 /// modified vector.
2091 /// \headerfile <x86intrin.h>
2094 /// __m256i _mm256_insert_epi16(__m256i X, int I, const int N);
2097 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2101 /// A vector of [16 x i16] to be used by the insert operation.
2103 /// An i16 integer value. The replacement value for the insert operation.
2105 /// An immediate integer specifying the index of the vector element to be
2107 /// \returns A copy of vector \a X, after replacing its element indexed by
2109 #define _mm256_insert_epi16(X, I, N) \
2110 ((__m256i)__builtin_ia32_vec_set_v16hi((__v16hi)(__m256i)(X), \
2111 (int)(I), (int)(N)))
2113 /// Takes a [32 x i8] vector and replaces the vector element value
2114 /// indexed by the immediate constant operand with a new value. Returns the
2115 /// modified vector.
2117 /// \headerfile <x86intrin.h>
2120 /// __m256i _mm256_insert_epi8(__m256i X, int I, const int N);
2123 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2127 /// A vector of [32 x i8] to be used by the insert operation.
2129 /// An i8 integer value. The replacement value for the insert operation.
2131 /// An immediate integer specifying the index of the vector element to be
2133 /// \returns A copy of vector \a X, after replacing its element indexed by
2135 #define _mm256_insert_epi8(X, I, N) \
2136 ((__m256i)__builtin_ia32_vec_set_v32qi((__v32qi)(__m256i)(X), \
2137 (int)(I), (int)(N)))
2140 /// Takes a [4 x i64] vector and replaces the vector element value
2141 /// indexed by the immediate constant operand with a new value. Returns the
2142 /// modified vector.
2144 /// \headerfile <x86intrin.h>
2147 /// __m256i _mm256_insert_epi64(__m256i X, int I, const int N);
2150 /// This intrinsic corresponds to the <c> VINSERTF128+COMPOSITE </c>
2154 /// A vector of [4 x i64] to be used by the insert operation.
2156 /// A 64-bit integer value. The replacement value for the insert operation.
2158 /// An immediate integer specifying the index of the vector element to be
2160 /// \returns A copy of vector \a X, after replacing its element indexed by
2162 #define _mm256_insert_epi64(X, I, N) \
2163 ((__m256i)__builtin_ia32_vec_set_v4di((__v4di)(__m256i)(X), \
2164 (long long)(I), (int)(N)))
2168 /// Converts a vector of [4 x i32] into a vector of [4 x double].
2170 /// \headerfile <x86intrin.h>
2172 /// This intrinsic corresponds to the <c> VCVTDQ2PD </c> instruction.
2175 /// A 128-bit integer vector of [4 x i32].
2176 /// \returns A 256-bit vector of [4 x double] containing the converted values.
2177 static __inline __m256d __DEFAULT_FN_ATTRS
2178 _mm256_cvtepi32_pd(__m128i __a
)
2180 return (__m256d
)__builtin_convertvector((__v4si
)__a
, __v4df
);
2183 /// Converts a vector of [8 x i32] into a vector of [8 x float].
2185 /// \headerfile <x86intrin.h>
2187 /// This intrinsic corresponds to the <c> VCVTDQ2PS </c> instruction.
2190 /// A 256-bit integer vector.
2191 /// \returns A 256-bit vector of [8 x float] containing the converted values.
2192 static __inline __m256 __DEFAULT_FN_ATTRS
2193 _mm256_cvtepi32_ps(__m256i __a
)
2195 return (__m256
)__builtin_convertvector((__v8si
)__a
, __v8sf
);
2198 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
2201 /// \headerfile <x86intrin.h>
2203 /// This intrinsic corresponds to the <c> VCVTPD2PS </c> instruction.
2206 /// A 256-bit vector of [4 x double].
2207 /// \returns A 128-bit vector of [4 x float] containing the converted values.
2208 static __inline __m128 __DEFAULT_FN_ATTRS
2209 _mm256_cvtpd_ps(__m256d __a
)
2211 return (__m128
)__builtin_ia32_cvtpd2ps256((__v4df
) __a
);
2214 /// Converts a vector of [8 x float] into a vector of [8 x i32].
2216 /// \headerfile <x86intrin.h>
2218 /// This intrinsic corresponds to the <c> VCVTPS2DQ </c> instruction.
2221 /// A 256-bit vector of [8 x float].
2222 /// \returns A 256-bit integer vector containing the converted values.
2223 static __inline __m256i __DEFAULT_FN_ATTRS
2224 _mm256_cvtps_epi32(__m256 __a
)
2226 return (__m256i
)__builtin_ia32_cvtps2dq256((__v8sf
) __a
);
2229 /// Converts a 128-bit vector of [4 x float] into a 256-bit vector of [4
2232 /// \headerfile <x86intrin.h>
2234 /// This intrinsic corresponds to the <c> VCVTPS2PD </c> instruction.
2237 /// A 128-bit vector of [4 x float].
2238 /// \returns A 256-bit vector of [4 x double] containing the converted values.
2239 static __inline __m256d __DEFAULT_FN_ATTRS
2240 _mm256_cvtps_pd(__m128 __a
)
2242 return (__m256d
)__builtin_convertvector((__v4sf
)__a
, __v4df
);
2245 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
2246 /// x i32], truncating the result by rounding towards zero when it is
2249 /// \headerfile <x86intrin.h>
2251 /// This intrinsic corresponds to the <c> VCVTTPD2DQ </c> instruction.
2254 /// A 256-bit vector of [4 x double].
2255 /// \returns A 128-bit integer vector containing the converted values.
2256 static __inline __m128i __DEFAULT_FN_ATTRS
2257 _mm256_cvttpd_epi32(__m256d __a
)
2259 return (__m128i
)__builtin_ia32_cvttpd2dq256((__v4df
) __a
);
2262 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
2263 /// x i32]. When a conversion is inexact, the value returned is rounded
2264 /// according to the rounding control bits in the MXCSR register.
2266 /// \headerfile <x86intrin.h>
2268 /// This intrinsic corresponds to the <c> VCVTPD2DQ </c> instruction.
2271 /// A 256-bit vector of [4 x double].
2272 /// \returns A 128-bit integer vector containing the converted values.
2273 static __inline __m128i __DEFAULT_FN_ATTRS
2274 _mm256_cvtpd_epi32(__m256d __a
)
2276 return (__m128i
)__builtin_ia32_cvtpd2dq256((__v4df
) __a
);
2279 /// Converts a vector of [8 x float] into a vector of [8 x i32],
2280 /// truncating the result by rounding towards zero when it is inexact.
2282 /// \headerfile <x86intrin.h>
2284 /// This intrinsic corresponds to the <c> VCVTTPS2DQ </c> instruction.
2287 /// A 256-bit vector of [8 x float].
2288 /// \returns A 256-bit integer vector containing the converted values.
2289 static __inline __m256i __DEFAULT_FN_ATTRS
2290 _mm256_cvttps_epi32(__m256 __a
)
2292 return (__m256i
)__builtin_ia32_cvttps2dq256((__v8sf
) __a
);
2295 /// Returns the first element of the input vector of [4 x double].
2297 /// \headerfile <x86intrin.h>
2299 /// This intrinsic is a utility function and does not correspond to a specific
2303 /// A 256-bit vector of [4 x double].
2304 /// \returns A 64 bit double containing the first element of the input vector.
2305 static __inline
double __DEFAULT_FN_ATTRS
2306 _mm256_cvtsd_f64(__m256d __a
)
2311 /// Returns the first element of the input vector of [8 x i32].
2313 /// \headerfile <x86intrin.h>
2315 /// This intrinsic is a utility function and does not correspond to a specific
2319 /// A 256-bit vector of [8 x i32].
2320 /// \returns A 32 bit integer containing the first element of the input vector.
2321 static __inline
int __DEFAULT_FN_ATTRS
2322 _mm256_cvtsi256_si32(__m256i __a
)
2324 __v8si __b
= (__v8si
)__a
;
2328 /// Returns the first element of the input vector of [8 x float].
2330 /// \headerfile <x86intrin.h>
2332 /// This intrinsic is a utility function and does not correspond to a specific
2336 /// A 256-bit vector of [8 x float].
2337 /// \returns A 32 bit float containing the first element of the input vector.
2338 static __inline
float __DEFAULT_FN_ATTRS
2339 _mm256_cvtss_f32(__m256 __a
)
2344 /* Vector replicate */
2345 /// Moves and duplicates odd-indexed values from a 256-bit vector of
2346 /// [8 x float] to float values in a 256-bit vector of [8 x float].
2348 /// \headerfile <x86intrin.h>
2350 /// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction.
2353 /// A 256-bit vector of [8 x float]. \n
2354 /// Bits [255:224] of \a __a are written to bits [255:224] and [223:192] of
2355 /// the return value. \n
2356 /// Bits [191:160] of \a __a are written to bits [191:160] and [159:128] of
2357 /// the return value. \n
2358 /// Bits [127:96] of \a __a are written to bits [127:96] and [95:64] of the
2359 /// return value. \n
2360 /// Bits [63:32] of \a __a are written to bits [63:32] and [31:0] of the
2362 /// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2364 static __inline __m256 __DEFAULT_FN_ATTRS
2365 _mm256_movehdup_ps(__m256 __a
)
2367 return __builtin_shufflevector((__v8sf
)__a
, (__v8sf
)__a
, 1, 1, 3, 3, 5, 5, 7, 7);
2370 /// Moves and duplicates even-indexed values from a 256-bit vector of
2371 /// [8 x float] to float values in a 256-bit vector of [8 x float].
2373 /// \headerfile <x86intrin.h>
2375 /// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction.
2378 /// A 256-bit vector of [8 x float]. \n
2379 /// Bits [223:192] of \a __a are written to bits [255:224] and [223:192] of
2380 /// the return value. \n
2381 /// Bits [159:128] of \a __a are written to bits [191:160] and [159:128] of
2382 /// the return value. \n
2383 /// Bits [95:64] of \a __a are written to bits [127:96] and [95:64] of the
2384 /// return value. \n
2385 /// Bits [31:0] of \a __a are written to bits [63:32] and [31:0] of the
2387 /// \returns A 256-bit vector of [8 x float] containing the moved and duplicated
2389 static __inline __m256 __DEFAULT_FN_ATTRS
2390 _mm256_moveldup_ps(__m256 __a
)
2392 return __builtin_shufflevector((__v8sf
)__a
, (__v8sf
)__a
, 0, 0, 2, 2, 4, 4, 6, 6);
2395 /// Moves and duplicates double-precision floating point values from a
2396 /// 256-bit vector of [4 x double] to double-precision values in a 256-bit
2397 /// vector of [4 x double].
2399 /// \headerfile <x86intrin.h>
2401 /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction.
2404 /// A 256-bit vector of [4 x double]. \n
2405 /// Bits [63:0] of \a __a are written to bits [127:64] and [63:0] of the
2406 /// return value. \n
2407 /// Bits [191:128] of \a __a are written to bits [255:192] and [191:128] of
2408 /// the return value.
2409 /// \returns A 256-bit vector of [4 x double] containing the moved and
2410 /// duplicated values.
2411 static __inline __m256d __DEFAULT_FN_ATTRS
2412 _mm256_movedup_pd(__m256d __a
)
2414 return __builtin_shufflevector((__v4df
)__a
, (__v4df
)__a
, 0, 0, 2, 2);
2417 /* Unpack and Interleave */
2418 /// Unpacks the odd-indexed vector elements from two 256-bit vectors of
2419 /// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2421 /// \headerfile <x86intrin.h>
2423 /// This intrinsic corresponds to the <c> VUNPCKHPD </c> instruction.
2426 /// A 256-bit floating-point vector of [4 x double]. \n
2427 /// Bits [127:64] are written to bits [63:0] of the return value. \n
2428 /// Bits [255:192] are written to bits [191:128] of the return value. \n
2430 /// A 256-bit floating-point vector of [4 x double]. \n
2431 /// Bits [127:64] are written to bits [127:64] of the return value. \n
2432 /// Bits [255:192] are written to bits [255:192] of the return value. \n
2433 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2434 static __inline __m256d __DEFAULT_FN_ATTRS
2435 _mm256_unpackhi_pd(__m256d __a
, __m256d __b
)
2437 return __builtin_shufflevector((__v4df
)__a
, (__v4df
)__b
, 1, 5, 1+2, 5+2);
2440 /// Unpacks the even-indexed vector elements from two 256-bit vectors of
2441 /// [4 x double] and interleaves them into a 256-bit vector of [4 x double].
2443 /// \headerfile <x86intrin.h>
2445 /// This intrinsic corresponds to the <c> VUNPCKLPD </c> instruction.
2448 /// A 256-bit floating-point vector of [4 x double]. \n
2449 /// Bits [63:0] are written to bits [63:0] of the return value. \n
2450 /// Bits [191:128] are written to bits [191:128] of the return value.
2452 /// A 256-bit floating-point vector of [4 x double]. \n
2453 /// Bits [63:0] are written to bits [127:64] of the return value. \n
2454 /// Bits [191:128] are written to bits [255:192] of the return value. \n
2455 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
2456 static __inline __m256d __DEFAULT_FN_ATTRS
2457 _mm256_unpacklo_pd(__m256d __a
, __m256d __b
)
2459 return __builtin_shufflevector((__v4df
)__a
, (__v4df
)__b
, 0, 4, 0+2, 4+2);
2462 /// Unpacks the 32-bit vector elements 2, 3, 6 and 7 from each of the
2463 /// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2464 /// vector of [8 x float].
2466 /// \headerfile <x86intrin.h>
2468 /// This intrinsic corresponds to the <c> VUNPCKHPS </c> instruction.
2471 /// A 256-bit vector of [8 x float]. \n
2472 /// Bits [95:64] are written to bits [31:0] of the return value. \n
2473 /// Bits [127:96] are written to bits [95:64] of the return value. \n
2474 /// Bits [223:192] are written to bits [159:128] of the return value. \n
2475 /// Bits [255:224] are written to bits [223:192] of the return value.
2477 /// A 256-bit vector of [8 x float]. \n
2478 /// Bits [95:64] are written to bits [63:32] of the return value. \n
2479 /// Bits [127:96] are written to bits [127:96] of the return value. \n
2480 /// Bits [223:192] are written to bits [191:160] of the return value. \n
2481 /// Bits [255:224] are written to bits [255:224] of the return value.
2482 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2483 static __inline __m256 __DEFAULT_FN_ATTRS
2484 _mm256_unpackhi_ps(__m256 __a
, __m256 __b
)
2486 return __builtin_shufflevector((__v8sf
)__a
, (__v8sf
)__b
, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
2489 /// Unpacks the 32-bit vector elements 0, 1, 4 and 5 from each of the
2490 /// two 256-bit vectors of [8 x float] and interleaves them into a 256-bit
2491 /// vector of [8 x float].
2493 /// \headerfile <x86intrin.h>
2495 /// This intrinsic corresponds to the <c> VUNPCKLPS </c> instruction.
2498 /// A 256-bit vector of [8 x float]. \n
2499 /// Bits [31:0] are written to bits [31:0] of the return value. \n
2500 /// Bits [63:32] are written to bits [95:64] of the return value. \n
2501 /// Bits [159:128] are written to bits [159:128] of the return value. \n
2502 /// Bits [191:160] are written to bits [223:192] of the return value.
2504 /// A 256-bit vector of [8 x float]. \n
2505 /// Bits [31:0] are written to bits [63:32] of the return value. \n
2506 /// Bits [63:32] are written to bits [127:96] of the return value. \n
2507 /// Bits [159:128] are written to bits [191:160] of the return value. \n
2508 /// Bits [191:160] are written to bits [255:224] of the return value.
2509 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
2510 static __inline __m256 __DEFAULT_FN_ATTRS
2511 _mm256_unpacklo_ps(__m256 __a
, __m256 __b
)
2513 return __builtin_shufflevector((__v8sf
)__a
, (__v8sf
)__b
, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
2517 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2518 /// element-by-element comparison of the double-precision element in the
2519 /// first source vector and the corresponding element in the second source
2522 /// The EFLAGS register is updated as follows: \n
2523 /// If there is at least one pair of double-precision elements where the
2524 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2525 /// ZF flag is set to 1. \n
2526 /// If there is at least one pair of double-precision elements where the
2527 /// sign-bit of the first element is 0 and the sign-bit of the second element
2528 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2529 /// This intrinsic returns the value of the ZF flag.
2531 /// \headerfile <x86intrin.h>
2533 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2536 /// A 128-bit vector of [2 x double].
2538 /// A 128-bit vector of [2 x double].
2539 /// \returns the ZF flag in the EFLAGS register.
2540 static __inline
int __DEFAULT_FN_ATTRS128
2541 _mm_testz_pd(__m128d __a
, __m128d __b
)
2543 return __builtin_ia32_vtestzpd((__v2df
)__a
, (__v2df
)__b
);
2546 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2547 /// element-by-element comparison of the double-precision element in the
2548 /// first source vector and the corresponding element in the second source
2551 /// The EFLAGS register is updated as follows: \n
2552 /// If there is at least one pair of double-precision elements where the
2553 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2554 /// ZF flag is set to 1. \n
2555 /// If there is at least one pair of double-precision elements where the
2556 /// sign-bit of the first element is 0 and the sign-bit of the second element
2557 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2558 /// This intrinsic returns the value of the CF flag.
2560 /// \headerfile <x86intrin.h>
2562 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2565 /// A 128-bit vector of [2 x double].
2567 /// A 128-bit vector of [2 x double].
2568 /// \returns the CF flag in the EFLAGS register.
2569 static __inline
int __DEFAULT_FN_ATTRS128
2570 _mm_testc_pd(__m128d __a
, __m128d __b
)
2572 return __builtin_ia32_vtestcpd((__v2df
)__a
, (__v2df
)__b
);
2575 /// Given two 128-bit floating-point vectors of [2 x double], perform an
2576 /// element-by-element comparison of the double-precision element in the
2577 /// first source vector and the corresponding element in the second source
2580 /// The EFLAGS register is updated as follows: \n
2581 /// If there is at least one pair of double-precision elements where the
2582 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2583 /// ZF flag is set to 1. \n
2584 /// If there is at least one pair of double-precision elements where the
2585 /// sign-bit of the first element is 0 and the sign-bit of the second element
2586 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2587 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2588 /// otherwise it returns 0.
2590 /// \headerfile <x86intrin.h>
2592 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2595 /// A 128-bit vector of [2 x double].
2597 /// A 128-bit vector of [2 x double].
2598 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2599 static __inline
int __DEFAULT_FN_ATTRS128
2600 _mm_testnzc_pd(__m128d __a
, __m128d __b
)
2602 return __builtin_ia32_vtestnzcpd((__v2df
)__a
, (__v2df
)__b
);
2605 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2606 /// element-by-element comparison of the single-precision element in the
2607 /// first source vector and the corresponding element in the second source
2610 /// The EFLAGS register is updated as follows: \n
2611 /// If there is at least one pair of single-precision elements where the
2612 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2613 /// ZF flag is set to 1. \n
2614 /// If there is at least one pair of single-precision elements where the
2615 /// sign-bit of the first element is 0 and the sign-bit of the second element
2616 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2617 /// This intrinsic returns the value of the ZF flag.
2619 /// \headerfile <x86intrin.h>
2621 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2624 /// A 128-bit vector of [4 x float].
2626 /// A 128-bit vector of [4 x float].
2627 /// \returns the ZF flag.
2628 static __inline
int __DEFAULT_FN_ATTRS128
2629 _mm_testz_ps(__m128 __a
, __m128 __b
)
2631 return __builtin_ia32_vtestzps((__v4sf
)__a
, (__v4sf
)__b
);
2634 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2635 /// element-by-element comparison of the single-precision element in the
2636 /// first source vector and the corresponding element in the second source
2639 /// The EFLAGS register is updated as follows: \n
2640 /// If there is at least one pair of single-precision elements where the
2641 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2642 /// ZF flag is set to 1. \n
2643 /// If there is at least one pair of single-precision elements where the
2644 /// sign-bit of the first element is 0 and the sign-bit of the second element
2645 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2646 /// This intrinsic returns the value of the CF flag.
2648 /// \headerfile <x86intrin.h>
2650 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2653 /// A 128-bit vector of [4 x float].
2655 /// A 128-bit vector of [4 x float].
2656 /// \returns the CF flag.
2657 static __inline
int __DEFAULT_FN_ATTRS128
2658 _mm_testc_ps(__m128 __a
, __m128 __b
)
2660 return __builtin_ia32_vtestcps((__v4sf
)__a
, (__v4sf
)__b
);
2663 /// Given two 128-bit floating-point vectors of [4 x float], perform an
2664 /// element-by-element comparison of the single-precision element in the
2665 /// first source vector and the corresponding element in the second source
2668 /// The EFLAGS register is updated as follows: \n
2669 /// If there is at least one pair of single-precision elements where the
2670 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2671 /// ZF flag is set to 1. \n
2672 /// If there is at least one pair of single-precision elements where the
2673 /// sign-bit of the first element is 0 and the sign-bit of the second element
2674 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2675 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2676 /// otherwise it returns 0.
2678 /// \headerfile <x86intrin.h>
2680 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2683 /// A 128-bit vector of [4 x float].
2685 /// A 128-bit vector of [4 x float].
2686 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2687 static __inline
int __DEFAULT_FN_ATTRS128
2688 _mm_testnzc_ps(__m128 __a
, __m128 __b
)
2690 return __builtin_ia32_vtestnzcps((__v4sf
)__a
, (__v4sf
)__b
);
2693 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2694 /// element-by-element comparison of the double-precision elements in the
2695 /// first source vector and the corresponding elements in the second source
2698 /// The EFLAGS register is updated as follows: \n
2699 /// If there is at least one pair of double-precision elements where the
2700 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2701 /// ZF flag is set to 1. \n
2702 /// If there is at least one pair of double-precision elements where the
2703 /// sign-bit of the first element is 0 and the sign-bit of the second element
2704 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2705 /// This intrinsic returns the value of the ZF flag.
2707 /// \headerfile <x86intrin.h>
2709 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2712 /// A 256-bit vector of [4 x double].
2714 /// A 256-bit vector of [4 x double].
2715 /// \returns the ZF flag.
2716 static __inline
int __DEFAULT_FN_ATTRS
2717 _mm256_testz_pd(__m256d __a
, __m256d __b
)
2719 return __builtin_ia32_vtestzpd256((__v4df
)__a
, (__v4df
)__b
);
2722 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2723 /// element-by-element comparison of the double-precision elements in the
2724 /// first source vector and the corresponding elements in the second source
2727 /// The EFLAGS register is updated as follows: \n
2728 /// If there is at least one pair of double-precision elements where the
2729 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2730 /// ZF flag is set to 1. \n
2731 /// If there is at least one pair of double-precision elements where the
2732 /// sign-bit of the first element is 0 and the sign-bit of the second element
2733 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2734 /// This intrinsic returns the value of the CF flag.
2736 /// \headerfile <x86intrin.h>
2738 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2741 /// A 256-bit vector of [4 x double].
2743 /// A 256-bit vector of [4 x double].
2744 /// \returns the CF flag.
2745 static __inline
int __DEFAULT_FN_ATTRS
2746 _mm256_testc_pd(__m256d __a
, __m256d __b
)
2748 return __builtin_ia32_vtestcpd256((__v4df
)__a
, (__v4df
)__b
);
2751 /// Given two 256-bit floating-point vectors of [4 x double], perform an
2752 /// element-by-element comparison of the double-precision elements in the
2753 /// first source vector and the corresponding elements in the second source
2756 /// The EFLAGS register is updated as follows: \n
2757 /// If there is at least one pair of double-precision elements where the
2758 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2759 /// ZF flag is set to 1. \n
2760 /// If there is at least one pair of double-precision elements where the
2761 /// sign-bit of the first element is 0 and the sign-bit of the second element
2762 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2763 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2764 /// otherwise it returns 0.
2766 /// \headerfile <x86intrin.h>
2768 /// This intrinsic corresponds to the <c> VTESTPD </c> instruction.
2771 /// A 256-bit vector of [4 x double].
2773 /// A 256-bit vector of [4 x double].
2774 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2775 static __inline
int __DEFAULT_FN_ATTRS
2776 _mm256_testnzc_pd(__m256d __a
, __m256d __b
)
2778 return __builtin_ia32_vtestnzcpd256((__v4df
)__a
, (__v4df
)__b
);
2781 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2782 /// element-by-element comparison of the single-precision element in the
2783 /// first source vector and the corresponding element in the second source
2786 /// The EFLAGS register is updated as follows: \n
2787 /// If there is at least one pair of single-precision elements where the
2788 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2789 /// ZF flag is set to 1. \n
2790 /// If there is at least one pair of single-precision elements where the
2791 /// sign-bit of the first element is 0 and the sign-bit of the second element
2792 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2793 /// This intrinsic returns the value of the ZF flag.
2795 /// \headerfile <x86intrin.h>
2797 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2800 /// A 256-bit vector of [8 x float].
2802 /// A 256-bit vector of [8 x float].
2803 /// \returns the ZF flag.
2804 static __inline
int __DEFAULT_FN_ATTRS
2805 _mm256_testz_ps(__m256 __a
, __m256 __b
)
2807 return __builtin_ia32_vtestzps256((__v8sf
)__a
, (__v8sf
)__b
);
2810 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2811 /// element-by-element comparison of the single-precision element in the
2812 /// first source vector and the corresponding element in the second source
2815 /// The EFLAGS register is updated as follows: \n
2816 /// If there is at least one pair of single-precision elements where the
2817 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2818 /// ZF flag is set to 1. \n
2819 /// If there is at least one pair of single-precision elements where the
2820 /// sign-bit of the first element is 0 and the sign-bit of the second element
2821 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2822 /// This intrinsic returns the value of the CF flag.
2824 /// \headerfile <x86intrin.h>
2826 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2829 /// A 256-bit vector of [8 x float].
2831 /// A 256-bit vector of [8 x float].
2832 /// \returns the CF flag.
2833 static __inline
int __DEFAULT_FN_ATTRS
2834 _mm256_testc_ps(__m256 __a
, __m256 __b
)
2836 return __builtin_ia32_vtestcps256((__v8sf
)__a
, (__v8sf
)__b
);
2839 /// Given two 256-bit floating-point vectors of [8 x float], perform an
2840 /// element-by-element comparison of the single-precision elements in the
2841 /// first source vector and the corresponding elements in the second source
2844 /// The EFLAGS register is updated as follows: \n
2845 /// If there is at least one pair of single-precision elements where the
2846 /// sign-bits of both elements are 1, the ZF flag is set to 0. Otherwise the
2847 /// ZF flag is set to 1. \n
2848 /// If there is at least one pair of single-precision elements where the
2849 /// sign-bit of the first element is 0 and the sign-bit of the second element
2850 /// is 1, the CF flag is set to 0. Otherwise the CF flag is set to 1. \n
2851 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2852 /// otherwise it returns 0.
2854 /// \headerfile <x86intrin.h>
2856 /// This intrinsic corresponds to the <c> VTESTPS </c> instruction.
2859 /// A 256-bit vector of [8 x float].
2861 /// A 256-bit vector of [8 x float].
2862 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2863 static __inline
int __DEFAULT_FN_ATTRS
2864 _mm256_testnzc_ps(__m256 __a
, __m256 __b
)
2866 return __builtin_ia32_vtestnzcps256((__v8sf
)__a
, (__v8sf
)__b
);
2869 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2870 /// of the two source vectors.
2872 /// The EFLAGS register is updated as follows: \n
2873 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2874 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2875 /// If there is at least one pair of bits where the bit from the first source
2876 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2877 /// is set to 0. Otherwise the CF flag is set to 1. \n
2878 /// This intrinsic returns the value of the ZF flag.
2880 /// \headerfile <x86intrin.h>
2882 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2885 /// A 256-bit integer vector.
2887 /// A 256-bit integer vector.
2888 /// \returns the ZF flag.
2889 static __inline
int __DEFAULT_FN_ATTRS
2890 _mm256_testz_si256(__m256i __a
, __m256i __b
)
2892 return __builtin_ia32_ptestz256((__v4di
)__a
, (__v4di
)__b
);
2895 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2896 /// of the two source vectors.
2898 /// The EFLAGS register is updated as follows: \n
2899 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2900 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2901 /// If there is at least one pair of bits where the bit from the first source
2902 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2903 /// is set to 0. Otherwise the CF flag is set to 1. \n
2904 /// This intrinsic returns the value of the CF flag.
2906 /// \headerfile <x86intrin.h>
2908 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2911 /// A 256-bit integer vector.
2913 /// A 256-bit integer vector.
2914 /// \returns the CF flag.
2915 static __inline
int __DEFAULT_FN_ATTRS
2916 _mm256_testc_si256(__m256i __a
, __m256i __b
)
2918 return __builtin_ia32_ptestc256((__v4di
)__a
, (__v4di
)__b
);
2921 /// Given two 256-bit integer vectors, perform a bit-by-bit comparison
2922 /// of the two source vectors.
2924 /// The EFLAGS register is updated as follows: \n
2925 /// If there is at least one pair of bits where both bits are 1, the ZF flag
2926 /// is set to 0. Otherwise the ZF flag is set to 1. \n
2927 /// If there is at least one pair of bits where the bit from the first source
2928 /// vector is 0 and the bit from the second source vector is 1, the CF flag
2929 /// is set to 0. Otherwise the CF flag is set to 1. \n
2930 /// This intrinsic returns 1 if both the ZF and CF flags are set to 0,
2931 /// otherwise it returns 0.
2933 /// \headerfile <x86intrin.h>
2935 /// This intrinsic corresponds to the <c> VPTEST </c> instruction.
2938 /// A 256-bit integer vector.
2940 /// A 256-bit integer vector.
2941 /// \returns 1 if both the ZF and CF flags are set to 0, otherwise returns 0.
2942 static __inline
int __DEFAULT_FN_ATTRS
2943 _mm256_testnzc_si256(__m256i __a
, __m256i __b
)
2945 return __builtin_ia32_ptestnzc256((__v4di
)__a
, (__v4di
)__b
);
2948 /* Vector extract sign mask */
2949 /// Extracts the sign bits of double-precision floating point elements
2950 /// in a 256-bit vector of [4 x double] and writes them to the lower order
2951 /// bits of the return value.
2953 /// \headerfile <x86intrin.h>
2955 /// This intrinsic corresponds to the <c> VMOVMSKPD </c> instruction.
2958 /// A 256-bit vector of [4 x double] containing the double-precision
2959 /// floating point values with sign bits to be extracted.
2960 /// \returns The sign bits from the operand, written to bits [3:0].
2961 static __inline
int __DEFAULT_FN_ATTRS
2962 _mm256_movemask_pd(__m256d __a
)
2964 return __builtin_ia32_movmskpd256((__v4df
)__a
);
2967 /// Extracts the sign bits of single-precision floating point elements
2968 /// in a 256-bit vector of [8 x float] and writes them to the lower order
2969 /// bits of the return value.
2971 /// \headerfile <x86intrin.h>
2973 /// This intrinsic corresponds to the <c> VMOVMSKPS </c> instruction.
2976 /// A 256-bit vector of [8 x float] containing the single-precision floating
2977 /// point values with sign bits to be extracted.
2978 /// \returns The sign bits from the operand, written to bits [7:0].
2979 static __inline
int __DEFAULT_FN_ATTRS
2980 _mm256_movemask_ps(__m256 __a
)
2982 return __builtin_ia32_movmskps256((__v8sf
)__a
);
2986 /// Zeroes the contents of all XMM or YMM registers.
2988 /// \headerfile <x86intrin.h>
2990 /// This intrinsic corresponds to the <c> VZEROALL </c> instruction.
2991 static __inline
void __attribute__((__always_inline__
, __nodebug__
, __target__("avx")))
2992 _mm256_zeroall(void)
2994 __builtin_ia32_vzeroall();
2997 /// Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
2999 /// \headerfile <x86intrin.h>
3001 /// This intrinsic corresponds to the <c> VZEROUPPER </c> instruction.
3002 static __inline
void __attribute__((__always_inline__
, __nodebug__
, __target__("avx")))
3003 _mm256_zeroupper(void)
3005 __builtin_ia32_vzeroupper();
3008 /* Vector load with broadcast */
3009 /// Loads a scalar single-precision floating point value from the
3010 /// specified address pointed to by \a __a and broadcasts it to the elements
3011 /// of a [4 x float] vector.
3013 /// \headerfile <x86intrin.h>
3015 /// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
3018 /// The single-precision floating point value to be broadcast.
3019 /// \returns A 128-bit vector of [4 x float] whose 32-bit elements are set
3020 /// equal to the broadcast value.
3021 static __inline __m128 __DEFAULT_FN_ATTRS128
3022 _mm_broadcast_ss(float const *__a
)
3024 struct __mm_broadcast_ss_struct
{
3026 } __attribute__((__packed__
, __may_alias__
));
3027 float __f
= ((const struct __mm_broadcast_ss_struct
*)__a
)->__f
;
3028 return __extension__ (__m128
){ __f
, __f
, __f
, __f
};
3031 /// Loads a scalar double-precision floating point value from the
3032 /// specified address pointed to by \a __a and broadcasts it to the elements
3033 /// of a [4 x double] vector.
3035 /// \headerfile <x86intrin.h>
3037 /// This intrinsic corresponds to the <c> VBROADCASTSD </c> instruction.
3040 /// The double-precision floating point value to be broadcast.
3041 /// \returns A 256-bit vector of [4 x double] whose 64-bit elements are set
3042 /// equal to the broadcast value.
3043 static __inline __m256d __DEFAULT_FN_ATTRS
3044 _mm256_broadcast_sd(double const *__a
)
3046 struct __mm256_broadcast_sd_struct
{
3048 } __attribute__((__packed__
, __may_alias__
));
3049 double __d
= ((const struct __mm256_broadcast_sd_struct
*)__a
)->__d
;
3050 return __extension__ (__m256d
)(__v4df
){ __d
, __d
, __d
, __d
};
3053 /// Loads a scalar single-precision floating point value from the
3054 /// specified address pointed to by \a __a and broadcasts it to the elements
3055 /// of a [8 x float] vector.
3057 /// \headerfile <x86intrin.h>
3059 /// This intrinsic corresponds to the <c> VBROADCASTSS </c> instruction.
3062 /// The single-precision floating point value to be broadcast.
3063 /// \returns A 256-bit vector of [8 x float] whose 32-bit elements are set
3064 /// equal to the broadcast value.
3065 static __inline __m256 __DEFAULT_FN_ATTRS
3066 _mm256_broadcast_ss(float const *__a
)
3068 struct __mm256_broadcast_ss_struct
{
3070 } __attribute__((__packed__
, __may_alias__
));
3071 float __f
= ((const struct __mm256_broadcast_ss_struct
*)__a
)->__f
;
3072 return __extension__ (__m256
)(__v8sf
){ __f
, __f
, __f
, __f
, __f
, __f
, __f
, __f
};
3075 /// Loads the data from a 128-bit vector of [2 x double] from the
3076 /// specified address pointed to by \a __a and broadcasts it to 128-bit
3077 /// elements in a 256-bit vector of [4 x double].
3079 /// \headerfile <x86intrin.h>
3081 /// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3084 /// The 128-bit vector of [2 x double] to be broadcast.
3085 /// \returns A 256-bit vector of [4 x double] whose 128-bit elements are set
3086 /// equal to the broadcast value.
3087 static __inline __m256d __DEFAULT_FN_ATTRS
3088 _mm256_broadcast_pd(__m128d
const *__a
)
3090 __m128d __b
= _mm_loadu_pd((const double *)__a
);
3091 return (__m256d
)__builtin_shufflevector((__v2df
)__b
, (__v2df
)__b
,
3095 /// Loads the data from a 128-bit vector of [4 x float] from the
3096 /// specified address pointed to by \a __a and broadcasts it to 128-bit
3097 /// elements in a 256-bit vector of [8 x float].
3099 /// \headerfile <x86intrin.h>
3101 /// This intrinsic corresponds to the <c> VBROADCASTF128 </c> instruction.
3104 /// The 128-bit vector of [4 x float] to be broadcast.
3105 /// \returns A 256-bit vector of [8 x float] whose 128-bit elements are set
3106 /// equal to the broadcast value.
3107 static __inline __m256 __DEFAULT_FN_ATTRS
3108 _mm256_broadcast_ps(__m128
const *__a
)
3110 __m128 __b
= _mm_loadu_ps((const float *)__a
);
3111 return (__m256
)__builtin_shufflevector((__v4sf
)__b
, (__v4sf
)__b
,
3112 0, 1, 2, 3, 0, 1, 2, 3);
3116 /// Loads 4 double-precision floating point values from a 32-byte aligned
3117 /// memory location pointed to by \a __p into a vector of [4 x double].
3119 /// \headerfile <x86intrin.h>
3121 /// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3124 /// A 32-byte aligned pointer to a memory location containing
3125 /// double-precision floating point values.
3126 /// \returns A 256-bit vector of [4 x double] containing the moved values.
3127 static __inline __m256d __DEFAULT_FN_ATTRS
3128 _mm256_load_pd(double const *__p
)
3130 return *(const __m256d
*)__p
;
3133 /// Loads 8 single-precision floating point values from a 32-byte aligned
3134 /// memory location pointed to by \a __p into a vector of [8 x float].
3136 /// \headerfile <x86intrin.h>
3138 /// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3141 /// A 32-byte aligned pointer to a memory location containing float values.
3142 /// \returns A 256-bit vector of [8 x float] containing the moved values.
3143 static __inline __m256 __DEFAULT_FN_ATTRS
3144 _mm256_load_ps(float const *__p
)
3146 return *(const __m256
*)__p
;
3149 /// Loads 4 double-precision floating point values from an unaligned
3150 /// memory location pointed to by \a __p into a vector of [4 x double].
3152 /// \headerfile <x86intrin.h>
3154 /// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3157 /// A pointer to a memory location containing double-precision floating
3159 /// \returns A 256-bit vector of [4 x double] containing the moved values.
3160 static __inline __m256d __DEFAULT_FN_ATTRS
3161 _mm256_loadu_pd(double const *__p
)
3165 } __attribute__((__packed__
, __may_alias__
));
3166 return ((const struct __loadu_pd
*)__p
)->__v
;
3169 /// Loads 8 single-precision floating point values from an unaligned
3170 /// memory location pointed to by \a __p into a vector of [8 x float].
3172 /// \headerfile <x86intrin.h>
3174 /// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3177 /// A pointer to a memory location containing single-precision floating
3179 /// \returns A 256-bit vector of [8 x float] containing the moved values.
3180 static __inline __m256 __DEFAULT_FN_ATTRS
3181 _mm256_loadu_ps(float const *__p
)
3185 } __attribute__((__packed__
, __may_alias__
));
3186 return ((const struct __loadu_ps
*)__p
)->__v
;
3189 /// Loads 256 bits of integer data from a 32-byte aligned memory
3190 /// location pointed to by \a __p into elements of a 256-bit integer vector.
3192 /// \headerfile <x86intrin.h>
3194 /// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3197 /// A 32-byte aligned pointer to a 256-bit integer vector containing integer
3199 /// \returns A 256-bit integer vector containing the moved values.
3200 static __inline __m256i __DEFAULT_FN_ATTRS
3201 _mm256_load_si256(__m256i
const *__p
)
3206 /// Loads 256 bits of integer data from an unaligned memory location
3207 /// pointed to by \a __p into a 256-bit integer vector.
3209 /// \headerfile <x86intrin.h>
3211 /// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3214 /// A pointer to a 256-bit integer vector containing integer values.
3215 /// \returns A 256-bit integer vector containing the moved values.
3216 static __inline __m256i __DEFAULT_FN_ATTRS
3217 _mm256_loadu_si256(__m256i_u
const *__p
)
3219 struct __loadu_si256
{
3221 } __attribute__((__packed__
, __may_alias__
));
3222 return ((const struct __loadu_si256
*)__p
)->__v
;
3225 /// Loads 256 bits of integer data from an unaligned memory location
3226 /// pointed to by \a __p into a 256-bit integer vector. This intrinsic may
3227 /// perform better than \c _mm256_loadu_si256 when the data crosses a cache
3230 /// \headerfile <x86intrin.h>
3232 /// This intrinsic corresponds to the <c> VLDDQU </c> instruction.
3235 /// A pointer to a 256-bit integer vector containing integer values.
3236 /// \returns A 256-bit integer vector containing the moved values.
3237 static __inline __m256i __DEFAULT_FN_ATTRS
3238 _mm256_lddqu_si256(__m256i_u
const *__p
)
3240 return (__m256i
)__builtin_ia32_lddqu256((char const *)__p
);
3243 /* SIMD store ops */
3244 /// Stores double-precision floating point values from a 256-bit vector
3245 /// of [4 x double] to a 32-byte aligned memory location pointed to by
3248 /// \headerfile <x86intrin.h>
3250 /// This intrinsic corresponds to the <c> VMOVAPD </c> instruction.
3253 /// A 32-byte aligned pointer to a memory location that will receive the
3254 /// double-precision floaing point values.
3256 /// A 256-bit vector of [4 x double] containing the values to be moved.
3257 static __inline
void __DEFAULT_FN_ATTRS
3258 _mm256_store_pd(double *__p
, __m256d __a
)
3260 *(__m256d
*)__p
= __a
;
3263 /// Stores single-precision floating point values from a 256-bit vector
3264 /// of [8 x float] to a 32-byte aligned memory location pointed to by \a __p.
3266 /// \headerfile <x86intrin.h>
3268 /// This intrinsic corresponds to the <c> VMOVAPS </c> instruction.
3271 /// A 32-byte aligned pointer to a memory location that will receive the
3274 /// A 256-bit vector of [8 x float] containing the values to be moved.
3275 static __inline
void __DEFAULT_FN_ATTRS
3276 _mm256_store_ps(float *__p
, __m256 __a
)
3278 *(__m256
*)__p
= __a
;
3281 /// Stores double-precision floating point values from a 256-bit vector
3282 /// of [4 x double] to an unaligned memory location pointed to by \a __p.
3284 /// \headerfile <x86intrin.h>
3286 /// This intrinsic corresponds to the <c> VMOVUPD </c> instruction.
3289 /// A pointer to a memory location that will receive the double-precision
3290 /// floating point values.
3292 /// A 256-bit vector of [4 x double] containing the values to be moved.
3293 static __inline
void __DEFAULT_FN_ATTRS
3294 _mm256_storeu_pd(double *__p
, __m256d __a
)
3296 struct __storeu_pd
{
3298 } __attribute__((__packed__
, __may_alias__
));
3299 ((struct __storeu_pd
*)__p
)->__v
= __a
;
3302 /// Stores single-precision floating point values from a 256-bit vector
3303 /// of [8 x float] to an unaligned memory location pointed to by \a __p.
3305 /// \headerfile <x86intrin.h>
3307 /// This intrinsic corresponds to the <c> VMOVUPS </c> instruction.
3310 /// A pointer to a memory location that will receive the float values.
3312 /// A 256-bit vector of [8 x float] containing the values to be moved.
3313 static __inline
void __DEFAULT_FN_ATTRS
3314 _mm256_storeu_ps(float *__p
, __m256 __a
)
3316 struct __storeu_ps
{
3318 } __attribute__((__packed__
, __may_alias__
));
3319 ((struct __storeu_ps
*)__p
)->__v
= __a
;
3322 /// Stores integer values from a 256-bit integer vector to a 32-byte
3323 /// aligned memory location pointed to by \a __p.
3325 /// \headerfile <x86intrin.h>
3327 /// This intrinsic corresponds to the <c> VMOVDQA </c> instruction.
3330 /// A 32-byte aligned pointer to a memory location that will receive the
3333 /// A 256-bit integer vector containing the values to be moved.
3334 static __inline
void __DEFAULT_FN_ATTRS
3335 _mm256_store_si256(__m256i
*__p
, __m256i __a
)
3340 /// Stores integer values from a 256-bit integer vector to an unaligned
3341 /// memory location pointed to by \a __p.
3343 /// \headerfile <x86intrin.h>
3345 /// This intrinsic corresponds to the <c> VMOVDQU </c> instruction.
3348 /// A pointer to a memory location that will receive the integer values.
3350 /// A 256-bit integer vector containing the values to be moved.
3351 static __inline
void __DEFAULT_FN_ATTRS
3352 _mm256_storeu_si256(__m256i_u
*__p
, __m256i __a
)
3354 struct __storeu_si256
{
3356 } __attribute__((__packed__
, __may_alias__
));
3357 ((struct __storeu_si256
*)__p
)->__v
= __a
;
3360 /* Conditional load ops */
3361 /// Conditionally loads double-precision floating point elements from a
3362 /// memory location pointed to by \a __p into a 128-bit vector of
3363 /// [2 x double], depending on the mask bits associated with each data
3366 /// \headerfile <x86intrin.h>
3368 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3371 /// A pointer to a memory location that contains the double-precision
3372 /// floating point values.
3374 /// A 128-bit integer vector containing the mask. The most significant bit of
3375 /// each data element represents the mask bits. If a mask bit is zero, the
3376 /// corresponding value in the memory location is not loaded and the
3377 /// corresponding field in the return value is set to zero.
3378 /// \returns A 128-bit vector of [2 x double] containing the loaded values.
3379 static __inline __m128d __DEFAULT_FN_ATTRS128
3380 _mm_maskload_pd(double const *__p
, __m128i __m
)
3382 return (__m128d
)__builtin_ia32_maskloadpd((const __v2df
*)__p
, (__v2di
)__m
);
3385 /// Conditionally loads double-precision floating point elements from a
3386 /// memory location pointed to by \a __p into a 256-bit vector of
3387 /// [4 x double], depending on the mask bits associated with each data
3390 /// \headerfile <x86intrin.h>
3392 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3395 /// A pointer to a memory location that contains the double-precision
3396 /// floating point values.
3398 /// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3399 /// significant bit of each quadword element represents the mask bits. If a
3400 /// mask bit is zero, the corresponding value in the memory location is not
3401 /// loaded and the corresponding field in the return value is set to zero.
3402 /// \returns A 256-bit vector of [4 x double] containing the loaded values.
3403 static __inline __m256d __DEFAULT_FN_ATTRS
3404 _mm256_maskload_pd(double const *__p
, __m256i __m
)
3406 return (__m256d
)__builtin_ia32_maskloadpd256((const __v4df
*)__p
,
3410 /// Conditionally loads single-precision floating point elements from a
3411 /// memory location pointed to by \a __p into a 128-bit vector of
3412 /// [4 x float], depending on the mask bits associated with each data
3415 /// \headerfile <x86intrin.h>
3417 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3420 /// A pointer to a memory location that contains the single-precision
3421 /// floating point values.
3423 /// A 128-bit integer vector containing the mask. The most significant bit of
3424 /// each data element represents the mask bits. If a mask bit is zero, the
3425 /// corresponding value in the memory location is not loaded and the
3426 /// corresponding field in the return value is set to zero.
3427 /// \returns A 128-bit vector of [4 x float] containing the loaded values.
3428 static __inline __m128 __DEFAULT_FN_ATTRS128
3429 _mm_maskload_ps(float const *__p
, __m128i __m
)
3431 return (__m128
)__builtin_ia32_maskloadps((const __v4sf
*)__p
, (__v4si
)__m
);
3434 /// Conditionally loads single-precision floating point elements from a
3435 /// memory location pointed to by \a __p into a 256-bit vector of
3436 /// [8 x float], depending on the mask bits associated with each data
3439 /// \headerfile <x86intrin.h>
3441 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3444 /// A pointer to a memory location that contains the single-precision
3445 /// floating point values.
3447 /// A 256-bit integer vector of [8 x dword] containing the mask. The most
3448 /// significant bit of each dword element represents the mask bits. If a mask
3449 /// bit is zero, the corresponding value in the memory location is not loaded
3450 /// and the corresponding field in the return value is set to zero.
3451 /// \returns A 256-bit vector of [8 x float] containing the loaded values.
3452 static __inline __m256 __DEFAULT_FN_ATTRS
3453 _mm256_maskload_ps(float const *__p
, __m256i __m
)
3455 return (__m256
)__builtin_ia32_maskloadps256((const __v8sf
*)__p
, (__v8si
)__m
);
3458 /* Conditional store ops */
3459 /// Moves single-precision floating point values from a 256-bit vector
3460 /// of [8 x float] to a memory location pointed to by \a __p, according to
3461 /// the specified mask.
3463 /// \headerfile <x86intrin.h>
3465 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3468 /// A pointer to a memory location that will receive the float values.
3470 /// A 256-bit integer vector of [8 x dword] containing the mask. The most
3471 /// significant bit of each dword element in the mask vector represents the
3472 /// mask bits. If a mask bit is zero, the corresponding value from vector
3473 /// \a __a is not stored and the corresponding field in the memory location
3474 /// pointed to by \a __p is not changed.
3476 /// A 256-bit vector of [8 x float] containing the values to be stored.
3477 static __inline
void __DEFAULT_FN_ATTRS
3478 _mm256_maskstore_ps(float *__p
, __m256i __m
, __m256 __a
)
3480 __builtin_ia32_maskstoreps256((__v8sf
*)__p
, (__v8si
)__m
, (__v8sf
)__a
);
3483 /// Moves double-precision values from a 128-bit vector of [2 x double]
3484 /// to a memory location pointed to by \a __p, according to the specified
3487 /// \headerfile <x86intrin.h>
3489 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3492 /// A pointer to a memory location that will receive the float values.
3494 /// A 128-bit integer vector containing the mask. The most significant bit of
3495 /// each field in the mask vector represents the mask bits. If a mask bit is
3496 /// zero, the corresponding value from vector \a __a is not stored and the
3497 /// corresponding field in the memory location pointed to by \a __p is not
3500 /// A 128-bit vector of [2 x double] containing the values to be stored.
3501 static __inline
void __DEFAULT_FN_ATTRS128
3502 _mm_maskstore_pd(double *__p
, __m128i __m
, __m128d __a
)
3504 __builtin_ia32_maskstorepd((__v2df
*)__p
, (__v2di
)__m
, (__v2df
)__a
);
3507 /// Moves double-precision values from a 256-bit vector of [4 x double]
3508 /// to a memory location pointed to by \a __p, according to the specified
3511 /// \headerfile <x86intrin.h>
3513 /// This intrinsic corresponds to the <c> VMASKMOVPD </c> instruction.
3516 /// A pointer to a memory location that will receive the float values.
3518 /// A 256-bit integer vector of [4 x quadword] containing the mask. The most
3519 /// significant bit of each quadword element in the mask vector represents
3520 /// the mask bits. If a mask bit is zero, the corresponding value from vector
3521 /// __a is not stored and the corresponding field in the memory location
3522 /// pointed to by \a __p is not changed.
3524 /// A 256-bit vector of [4 x double] containing the values to be stored.
3525 static __inline
void __DEFAULT_FN_ATTRS
3526 _mm256_maskstore_pd(double *__p
, __m256i __m
, __m256d __a
)
3528 __builtin_ia32_maskstorepd256((__v4df
*)__p
, (__v4di
)__m
, (__v4df
)__a
);
3531 /// Moves single-precision floating point values from a 128-bit vector
3532 /// of [4 x float] to a memory location pointed to by \a __p, according to
3533 /// the specified mask.
3535 /// \headerfile <x86intrin.h>
3537 /// This intrinsic corresponds to the <c> VMASKMOVPS </c> instruction.
3540 /// A pointer to a memory location that will receive the float values.
3542 /// A 128-bit integer vector containing the mask. The most significant bit of
3543 /// each field in the mask vector represents the mask bits. If a mask bit is
3544 /// zero, the corresponding value from vector __a is not stored and the
3545 /// corresponding field in the memory location pointed to by \a __p is not
3548 /// A 128-bit vector of [4 x float] containing the values to be stored.
3549 static __inline
void __DEFAULT_FN_ATTRS128
3550 _mm_maskstore_ps(float *__p
, __m128i __m
, __m128 __a
)
3552 __builtin_ia32_maskstoreps((__v4sf
*)__p
, (__v4si
)__m
, (__v4sf
)__a
);
3555 /* Cacheability support ops */
3556 /// Moves integer data from a 256-bit integer vector to a 32-byte
3557 /// aligned memory location. To minimize caching, the data is flagged as
3558 /// non-temporal (unlikely to be used again soon).
3560 /// \headerfile <x86intrin.h>
3562 /// This intrinsic corresponds to the <c> VMOVNTDQ </c> instruction.
3565 /// A pointer to a 32-byte aligned memory location that will receive the
3568 /// A 256-bit integer vector containing the values to be moved.
3569 static __inline
void __DEFAULT_FN_ATTRS
3570 _mm256_stream_si256(void *__a
, __m256i __b
)
3572 typedef __v4di __v4di_aligned
__attribute__((aligned(32)));
3573 __builtin_nontemporal_store((__v4di_aligned
)__b
, (__v4di_aligned
*)__a
);
3576 /// Moves double-precision values from a 256-bit vector of [4 x double]
3577 /// to a 32-byte aligned memory location. To minimize caching, the data is
3578 /// flagged as non-temporal (unlikely to be used again soon).
3580 /// \headerfile <x86intrin.h>
3582 /// This intrinsic corresponds to the <c> VMOVNTPD </c> instruction.
3585 /// A pointer to a 32-byte aligned memory location that will receive the
3586 /// double-precision floating-point values.
3588 /// A 256-bit vector of [4 x double] containing the values to be moved.
3589 static __inline
void __DEFAULT_FN_ATTRS
3590 _mm256_stream_pd(void *__a
, __m256d __b
)
3592 typedef __v4df __v4df_aligned
__attribute__((aligned(32)));
3593 __builtin_nontemporal_store((__v4df_aligned
)__b
, (__v4df_aligned
*)__a
);
3596 /// Moves single-precision floating point values from a 256-bit vector
3597 /// of [8 x float] to a 32-byte aligned memory location. To minimize
3598 /// caching, the data is flagged as non-temporal (unlikely to be used again
3601 /// \headerfile <x86intrin.h>
3603 /// This intrinsic corresponds to the <c> VMOVNTPS </c> instruction.
3606 /// A pointer to a 32-byte aligned memory location that will receive the
3607 /// single-precision floating point values.
3609 /// A 256-bit vector of [8 x float] containing the values to be moved.
3610 static __inline
void __DEFAULT_FN_ATTRS
3611 _mm256_stream_ps(void *__p
, __m256 __a
)
3613 typedef __v8sf __v8sf_aligned
__attribute__((aligned(32)));
3614 __builtin_nontemporal_store((__v8sf_aligned
)__a
, (__v8sf_aligned
*)__p
);
3617 /* Create vectors */
3618 /// Create a 256-bit vector of [4 x double] with undefined values.
3620 /// \headerfile <x86intrin.h>
3622 /// This intrinsic has no corresponding instruction.
3624 /// \returns A 256-bit vector of [4 x double] containing undefined values.
3625 static __inline__ __m256d __DEFAULT_FN_ATTRS
3626 _mm256_undefined_pd(void)
3628 return (__m256d
)__builtin_ia32_undef256();
3631 /// Create a 256-bit vector of [8 x float] with undefined values.
3633 /// \headerfile <x86intrin.h>
3635 /// This intrinsic has no corresponding instruction.
3637 /// \returns A 256-bit vector of [8 x float] containing undefined values.
3638 static __inline__ __m256 __DEFAULT_FN_ATTRS
3639 _mm256_undefined_ps(void)
3641 return (__m256
)__builtin_ia32_undef256();
3644 /// Create a 256-bit integer vector with undefined values.
3646 /// \headerfile <x86intrin.h>
3648 /// This intrinsic has no corresponding instruction.
3650 /// \returns A 256-bit integer vector containing undefined values.
3651 static __inline__ __m256i __DEFAULT_FN_ATTRS
3652 _mm256_undefined_si256(void)
3654 return (__m256i
)__builtin_ia32_undef256();
3657 /// Constructs a 256-bit floating-point vector of [4 x double]
3658 /// initialized with the specified double-precision floating-point values.
3660 /// \headerfile <x86intrin.h>
3662 /// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3666 /// A double-precision floating-point value used to initialize bits [255:192]
3669 /// A double-precision floating-point value used to initialize bits [191:128]
3672 /// A double-precision floating-point value used to initialize bits [127:64]
3675 /// A double-precision floating-point value used to initialize bits [63:0]
3677 /// \returns An initialized 256-bit floating-point vector of [4 x double].
3678 static __inline __m256d __DEFAULT_FN_ATTRS
3679 _mm256_set_pd(double __a
, double __b
, double __c
, double __d
)
3681 return __extension__ (__m256d
){ __d
, __c
, __b
, __a
};
3684 /// Constructs a 256-bit floating-point vector of [8 x float] initialized
3685 /// with the specified single-precision floating-point values.
3687 /// \headerfile <x86intrin.h>
3689 /// This intrinsic is a utility function and does not correspond to a specific
3693 /// A single-precision floating-point value used to initialize bits [255:224]
3696 /// A single-precision floating-point value used to initialize bits [223:192]
3699 /// A single-precision floating-point value used to initialize bits [191:160]
3702 /// A single-precision floating-point value used to initialize bits [159:128]
3705 /// A single-precision floating-point value used to initialize bits [127:96]
3708 /// A single-precision floating-point value used to initialize bits [95:64]
3711 /// A single-precision floating-point value used to initialize bits [63:32]
3714 /// A single-precision floating-point value used to initialize bits [31:0]
3716 /// \returns An initialized 256-bit floating-point vector of [8 x float].
3717 static __inline __m256 __DEFAULT_FN_ATTRS
3718 _mm256_set_ps(float __a
, float __b
, float __c
, float __d
,
3719 float __e
, float __f
, float __g
, float __h
)
3721 return __extension__ (__m256
){ __h
, __g
, __f
, __e
, __d
, __c
, __b
, __a
};
3724 /// Constructs a 256-bit integer vector initialized with the specified
3725 /// 32-bit integral values.
3727 /// \headerfile <x86intrin.h>
3729 /// This intrinsic is a utility function and does not correspond to a specific
3733 /// A 32-bit integral value used to initialize bits [255:224] of the result.
3735 /// A 32-bit integral value used to initialize bits [223:192] of the result.
3737 /// A 32-bit integral value used to initialize bits [191:160] of the result.
3739 /// A 32-bit integral value used to initialize bits [159:128] of the result.
3741 /// A 32-bit integral value used to initialize bits [127:96] of the result.
3743 /// A 32-bit integral value used to initialize bits [95:64] of the result.
3745 /// A 32-bit integral value used to initialize bits [63:32] of the result.
3747 /// A 32-bit integral value used to initialize bits [31:0] of the result.
3748 /// \returns An initialized 256-bit integer vector.
3749 static __inline __m256i __DEFAULT_FN_ATTRS
3750 _mm256_set_epi32(int __i0
, int __i1
, int __i2
, int __i3
,
3751 int __i4
, int __i5
, int __i6
, int __i7
)
3753 return __extension__ (__m256i
)(__v8si
){ __i7
, __i6
, __i5
, __i4
, __i3
, __i2
, __i1
, __i0
};
3756 /// Constructs a 256-bit integer vector initialized with the specified
3757 /// 16-bit integral values.
3759 /// \headerfile <x86intrin.h>
3761 /// This intrinsic is a utility function and does not correspond to a specific
3765 /// A 16-bit integral value used to initialize bits [255:240] of the result.
3767 /// A 16-bit integral value used to initialize bits [239:224] of the result.
3769 /// A 16-bit integral value used to initialize bits [223:208] of the result.
3771 /// A 16-bit integral value used to initialize bits [207:192] of the result.
3773 /// A 16-bit integral value used to initialize bits [191:176] of the result.
3775 /// A 16-bit integral value used to initialize bits [175:160] of the result.
3777 /// A 16-bit integral value used to initialize bits [159:144] of the result.
3779 /// A 16-bit integral value used to initialize bits [143:128] of the result.
3781 /// A 16-bit integral value used to initialize bits [127:112] of the result.
3783 /// A 16-bit integral value used to initialize bits [111:96] of the result.
3785 /// A 16-bit integral value used to initialize bits [95:80] of the result.
3787 /// A 16-bit integral value used to initialize bits [79:64] of the result.
3789 /// A 16-bit integral value used to initialize bits [63:48] of the result.
3791 /// A 16-bit integral value used to initialize bits [47:32] of the result.
3793 /// A 16-bit integral value used to initialize bits [31:16] of the result.
3795 /// A 16-bit integral value used to initialize bits [15:0] of the result.
3796 /// \returns An initialized 256-bit integer vector.
3797 static __inline __m256i __DEFAULT_FN_ATTRS
3798 _mm256_set_epi16(short __w15
, short __w14
, short __w13
, short __w12
,
3799 short __w11
, short __w10
, short __w09
, short __w08
,
3800 short __w07
, short __w06
, short __w05
, short __w04
,
3801 short __w03
, short __w02
, short __w01
, short __w00
)
3803 return __extension__ (__m256i
)(__v16hi
){ __w00
, __w01
, __w02
, __w03
, __w04
, __w05
, __w06
,
3804 __w07
, __w08
, __w09
, __w10
, __w11
, __w12
, __w13
, __w14
, __w15
};
3807 /// Constructs a 256-bit integer vector initialized with the specified
3808 /// 8-bit integral values.
3810 /// \headerfile <x86intrin.h>
3812 /// This intrinsic is a utility function and does not correspond to a specific
3816 /// An 8-bit integral value used to initialize bits [255:248] of the result.
3818 /// An 8-bit integral value used to initialize bits [247:240] of the result.
3820 /// An 8-bit integral value used to initialize bits [239:232] of the result.
3822 /// An 8-bit integral value used to initialize bits [231:224] of the result.
3824 /// An 8-bit integral value used to initialize bits [223:216] of the result.
3826 /// An 8-bit integral value used to initialize bits [215:208] of the result.
3828 /// An 8-bit integral value used to initialize bits [207:200] of the result.
3830 /// An 8-bit integral value used to initialize bits [199:192] of the result.
3832 /// An 8-bit integral value used to initialize bits [191:184] of the result.
3834 /// An 8-bit integral value used to initialize bits [183:176] of the result.
3836 /// An 8-bit integral value used to initialize bits [175:168] of the result.
3838 /// An 8-bit integral value used to initialize bits [167:160] of the result.
3840 /// An 8-bit integral value used to initialize bits [159:152] of the result.
3842 /// An 8-bit integral value used to initialize bits [151:144] of the result.
3844 /// An 8-bit integral value used to initialize bits [143:136] of the result.
3846 /// An 8-bit integral value used to initialize bits [135:128] of the result.
3848 /// An 8-bit integral value used to initialize bits [127:120] of the result.
3850 /// An 8-bit integral value used to initialize bits [119:112] of the result.
3852 /// An 8-bit integral value used to initialize bits [111:104] of the result.
3854 /// An 8-bit integral value used to initialize bits [103:96] of the result.
3856 /// An 8-bit integral value used to initialize bits [95:88] of the result.
3858 /// An 8-bit integral value used to initialize bits [87:80] of the result.
3860 /// An 8-bit integral value used to initialize bits [79:72] of the result.
3862 /// An 8-bit integral value used to initialize bits [71:64] of the result.
3864 /// An 8-bit integral value used to initialize bits [63:56] of the result.
3866 /// An 8-bit integral value used to initialize bits [55:48] of the result.
3868 /// An 8-bit integral value used to initialize bits [47:40] of the result.
3870 /// An 8-bit integral value used to initialize bits [39:32] of the result.
3872 /// An 8-bit integral value used to initialize bits [31:24] of the result.
3874 /// An 8-bit integral value used to initialize bits [23:16] of the result.
3876 /// An 8-bit integral value used to initialize bits [15:8] of the result.
3878 /// An 8-bit integral value used to initialize bits [7:0] of the result.
3879 /// \returns An initialized 256-bit integer vector.
3880 static __inline __m256i __DEFAULT_FN_ATTRS
3881 _mm256_set_epi8(char __b31
, char __b30
, char __b29
, char __b28
,
3882 char __b27
, char __b26
, char __b25
, char __b24
,
3883 char __b23
, char __b22
, char __b21
, char __b20
,
3884 char __b19
, char __b18
, char __b17
, char __b16
,
3885 char __b15
, char __b14
, char __b13
, char __b12
,
3886 char __b11
, char __b10
, char __b09
, char __b08
,
3887 char __b07
, char __b06
, char __b05
, char __b04
,
3888 char __b03
, char __b02
, char __b01
, char __b00
)
3890 return __extension__ (__m256i
)(__v32qi
){
3891 __b00
, __b01
, __b02
, __b03
, __b04
, __b05
, __b06
, __b07
,
3892 __b08
, __b09
, __b10
, __b11
, __b12
, __b13
, __b14
, __b15
,
3893 __b16
, __b17
, __b18
, __b19
, __b20
, __b21
, __b22
, __b23
,
3894 __b24
, __b25
, __b26
, __b27
, __b28
, __b29
, __b30
, __b31
3898 /// Constructs a 256-bit integer vector initialized with the specified
3899 /// 64-bit integral values.
3901 /// \headerfile <x86intrin.h>
3903 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
3907 /// A 64-bit integral value used to initialize bits [255:192] of the result.
3909 /// A 64-bit integral value used to initialize bits [191:128] of the result.
3911 /// A 64-bit integral value used to initialize bits [127:64] of the result.
3913 /// A 64-bit integral value used to initialize bits [63:0] of the result.
3914 /// \returns An initialized 256-bit integer vector.
3915 static __inline __m256i __DEFAULT_FN_ATTRS
3916 _mm256_set_epi64x(long long __a
, long long __b
, long long __c
, long long __d
)
3918 return __extension__ (__m256i
)(__v4di
){ __d
, __c
, __b
, __a
};
3921 /* Create vectors with elements in reverse order */
3922 /// Constructs a 256-bit floating-point vector of [4 x double],
3923 /// initialized in reverse order with the specified double-precision
3924 /// floating-point values.
3926 /// \headerfile <x86intrin.h>
3928 /// This intrinsic corresponds to the <c> VUNPCKLPD+VINSERTF128 </c>
3932 /// A double-precision floating-point value used to initialize bits [63:0]
3935 /// A double-precision floating-point value used to initialize bits [127:64]
3938 /// A double-precision floating-point value used to initialize bits [191:128]
3941 /// A double-precision floating-point value used to initialize bits [255:192]
3943 /// \returns An initialized 256-bit floating-point vector of [4 x double].
3944 static __inline __m256d __DEFAULT_FN_ATTRS
3945 _mm256_setr_pd(double __a
, double __b
, double __c
, double __d
)
3947 return _mm256_set_pd(__d
, __c
, __b
, __a
);
3950 /// Constructs a 256-bit floating-point vector of [8 x float],
3951 /// initialized in reverse order with the specified single-precision
3952 /// float-point values.
3954 /// \headerfile <x86intrin.h>
3956 /// This intrinsic is a utility function and does not correspond to a specific
3960 /// A single-precision floating-point value used to initialize bits [31:0]
3963 /// A single-precision floating-point value used to initialize bits [63:32]
3966 /// A single-precision floating-point value used to initialize bits [95:64]
3969 /// A single-precision floating-point value used to initialize bits [127:96]
3972 /// A single-precision floating-point value used to initialize bits [159:128]
3975 /// A single-precision floating-point value used to initialize bits [191:160]
3978 /// A single-precision floating-point value used to initialize bits [223:192]
3981 /// A single-precision floating-point value used to initialize bits [255:224]
3983 /// \returns An initialized 256-bit floating-point vector of [8 x float].
3984 static __inline __m256 __DEFAULT_FN_ATTRS
3985 _mm256_setr_ps(float __a
, float __b
, float __c
, float __d
,
3986 float __e
, float __f
, float __g
, float __h
)
3988 return _mm256_set_ps(__h
, __g
, __f
, __e
, __d
, __c
, __b
, __a
);
3991 /// Constructs a 256-bit integer vector, initialized in reverse order
3992 /// with the specified 32-bit integral values.
3994 /// \headerfile <x86intrin.h>
3996 /// This intrinsic is a utility function and does not correspond to a specific
4000 /// A 32-bit integral value used to initialize bits [31:0] of the result.
4002 /// A 32-bit integral value used to initialize bits [63:32] of the result.
4004 /// A 32-bit integral value used to initialize bits [95:64] of the result.
4006 /// A 32-bit integral value used to initialize bits [127:96] of the result.
4008 /// A 32-bit integral value used to initialize bits [159:128] of the result.
4010 /// A 32-bit integral value used to initialize bits [191:160] of the result.
4012 /// A 32-bit integral value used to initialize bits [223:192] of the result.
4014 /// A 32-bit integral value used to initialize bits [255:224] of the result.
4015 /// \returns An initialized 256-bit integer vector.
4016 static __inline __m256i __DEFAULT_FN_ATTRS
4017 _mm256_setr_epi32(int __i0
, int __i1
, int __i2
, int __i3
,
4018 int __i4
, int __i5
, int __i6
, int __i7
)
4020 return _mm256_set_epi32(__i7
, __i6
, __i5
, __i4
, __i3
, __i2
, __i1
, __i0
);
4023 /// Constructs a 256-bit integer vector, initialized in reverse order
4024 /// with the specified 16-bit integral values.
4026 /// \headerfile <x86intrin.h>
4028 /// This intrinsic is a utility function and does not correspond to a specific
4032 /// A 16-bit integral value used to initialize bits [15:0] of the result.
4034 /// A 16-bit integral value used to initialize bits [31:16] of the result.
4036 /// A 16-bit integral value used to initialize bits [47:32] of the result.
4038 /// A 16-bit integral value used to initialize bits [63:48] of the result.
4040 /// A 16-bit integral value used to initialize bits [79:64] of the result.
4042 /// A 16-bit integral value used to initialize bits [95:80] of the result.
4044 /// A 16-bit integral value used to initialize bits [111:96] of the result.
4046 /// A 16-bit integral value used to initialize bits [127:112] of the result.
4048 /// A 16-bit integral value used to initialize bits [143:128] of the result.
4050 /// A 16-bit integral value used to initialize bits [159:144] of the result.
4052 /// A 16-bit integral value used to initialize bits [175:160] of the result.
4054 /// A 16-bit integral value used to initialize bits [191:176] of the result.
4056 /// A 16-bit integral value used to initialize bits [207:192] of the result.
4058 /// A 16-bit integral value used to initialize bits [223:208] of the result.
4060 /// A 16-bit integral value used to initialize bits [239:224] of the result.
4062 /// A 16-bit integral value used to initialize bits [255:240] of the result.
4063 /// \returns An initialized 256-bit integer vector.
4064 static __inline __m256i __DEFAULT_FN_ATTRS
4065 _mm256_setr_epi16(short __w15
, short __w14
, short __w13
, short __w12
,
4066 short __w11
, short __w10
, short __w09
, short __w08
,
4067 short __w07
, short __w06
, short __w05
, short __w04
,
4068 short __w03
, short __w02
, short __w01
, short __w00
)
4070 return _mm256_set_epi16(__w00
, __w01
, __w02
, __w03
,
4071 __w04
, __w05
, __w06
, __w07
,
4072 __w08
, __w09
, __w10
, __w11
,
4073 __w12
, __w13
, __w14
, __w15
);
4076 /// Constructs a 256-bit integer vector, initialized in reverse order
4077 /// with the specified 8-bit integral values.
4079 /// \headerfile <x86intrin.h>
4081 /// This intrinsic is a utility function and does not correspond to a specific
4085 /// An 8-bit integral value used to initialize bits [7:0] of the result.
4087 /// An 8-bit integral value used to initialize bits [15:8] of the result.
4089 /// An 8-bit integral value used to initialize bits [23:16] of the result.
4091 /// An 8-bit integral value used to initialize bits [31:24] of the result.
4093 /// An 8-bit integral value used to initialize bits [39:32] of the result.
4095 /// An 8-bit integral value used to initialize bits [47:40] of the result.
4097 /// An 8-bit integral value used to initialize bits [55:48] of the result.
4099 /// An 8-bit integral value used to initialize bits [63:56] of the result.
4101 /// An 8-bit integral value used to initialize bits [71:64] of the result.
4103 /// An 8-bit integral value used to initialize bits [79:72] of the result.
4105 /// An 8-bit integral value used to initialize bits [87:80] of the result.
4107 /// An 8-bit integral value used to initialize bits [95:88] of the result.
4109 /// An 8-bit integral value used to initialize bits [103:96] of the result.
4111 /// An 8-bit integral value used to initialize bits [111:104] of the result.
4113 /// An 8-bit integral value used to initialize bits [119:112] of the result.
4115 /// An 8-bit integral value used to initialize bits [127:120] of the result.
4117 /// An 8-bit integral value used to initialize bits [135:128] of the result.
4119 /// An 8-bit integral value used to initialize bits [143:136] of the result.
4121 /// An 8-bit integral value used to initialize bits [151:144] of the result.
4123 /// An 8-bit integral value used to initialize bits [159:152] of the result.
4125 /// An 8-bit integral value used to initialize bits [167:160] of the result.
4127 /// An 8-bit integral value used to initialize bits [175:168] of the result.
4129 /// An 8-bit integral value used to initialize bits [183:176] of the result.
4131 /// An 8-bit integral value used to initialize bits [191:184] of the result.
4133 /// An 8-bit integral value used to initialize bits [199:192] of the result.
4135 /// An 8-bit integral value used to initialize bits [207:200] of the result.
4137 /// An 8-bit integral value used to initialize bits [215:208] of the result.
4139 /// An 8-bit integral value used to initialize bits [223:216] of the result.
4141 /// An 8-bit integral value used to initialize bits [231:224] of the result.
4143 /// An 8-bit integral value used to initialize bits [239:232] of the result.
4145 /// An 8-bit integral value used to initialize bits [247:240] of the result.
4147 /// An 8-bit integral value used to initialize bits [255:248] of the result.
4148 /// \returns An initialized 256-bit integer vector.
4149 static __inline __m256i __DEFAULT_FN_ATTRS
4150 _mm256_setr_epi8(char __b31
, char __b30
, char __b29
, char __b28
,
4151 char __b27
, char __b26
, char __b25
, char __b24
,
4152 char __b23
, char __b22
, char __b21
, char __b20
,
4153 char __b19
, char __b18
, char __b17
, char __b16
,
4154 char __b15
, char __b14
, char __b13
, char __b12
,
4155 char __b11
, char __b10
, char __b09
, char __b08
,
4156 char __b07
, char __b06
, char __b05
, char __b04
,
4157 char __b03
, char __b02
, char __b01
, char __b00
)
4159 return _mm256_set_epi8(__b00
, __b01
, __b02
, __b03
, __b04
, __b05
, __b06
, __b07
,
4160 __b08
, __b09
, __b10
, __b11
, __b12
, __b13
, __b14
, __b15
,
4161 __b16
, __b17
, __b18
, __b19
, __b20
, __b21
, __b22
, __b23
,
4162 __b24
, __b25
, __b26
, __b27
, __b28
, __b29
, __b30
, __b31
);
4165 /// Constructs a 256-bit integer vector, initialized in reverse order
4166 /// with the specified 64-bit integral values.
4168 /// \headerfile <x86intrin.h>
4170 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ+VINSERTF128 </c>
4174 /// A 64-bit integral value used to initialize bits [63:0] of the result.
4176 /// A 64-bit integral value used to initialize bits [127:64] of the result.
4178 /// A 64-bit integral value used to initialize bits [191:128] of the result.
4180 /// A 64-bit integral value used to initialize bits [255:192] of the result.
4181 /// \returns An initialized 256-bit integer vector.
4182 static __inline __m256i __DEFAULT_FN_ATTRS
4183 _mm256_setr_epi64x(long long __a
, long long __b
, long long __c
, long long __d
)
4185 return _mm256_set_epi64x(__d
, __c
, __b
, __a
);
4188 /* Create vectors with repeated elements */
4189 /// Constructs a 256-bit floating-point vector of [4 x double], with each
4190 /// of the four double-precision floating-point vector elements set to the
4191 /// specified double-precision floating-point value.
4193 /// \headerfile <x86intrin.h>
4195 /// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4198 /// A double-precision floating-point value used to initialize each vector
4199 /// element of the result.
4200 /// \returns An initialized 256-bit floating-point vector of [4 x double].
4201 static __inline __m256d __DEFAULT_FN_ATTRS
4202 _mm256_set1_pd(double __w
)
4204 return _mm256_set_pd(__w
, __w
, __w
, __w
);
4207 /// Constructs a 256-bit floating-point vector of [8 x float], with each
4208 /// of the eight single-precision floating-point vector elements set to the
4209 /// specified single-precision floating-point value.
4211 /// \headerfile <x86intrin.h>
4213 /// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4217 /// A single-precision floating-point value used to initialize each vector
4218 /// element of the result.
4219 /// \returns An initialized 256-bit floating-point vector of [8 x float].
4220 static __inline __m256 __DEFAULT_FN_ATTRS
4221 _mm256_set1_ps(float __w
)
4223 return _mm256_set_ps(__w
, __w
, __w
, __w
, __w
, __w
, __w
, __w
);
4226 /// Constructs a 256-bit integer vector of [8 x i32], with each of the
4227 /// 32-bit integral vector elements set to the specified 32-bit integral
4230 /// \headerfile <x86intrin.h>
4232 /// This intrinsic corresponds to the <c> VPERMILPS+VINSERTF128 </c>
4236 /// A 32-bit integral value used to initialize each vector element of the
4238 /// \returns An initialized 256-bit integer vector of [8 x i32].
4239 static __inline __m256i __DEFAULT_FN_ATTRS
4240 _mm256_set1_epi32(int __i
)
4242 return _mm256_set_epi32(__i
, __i
, __i
, __i
, __i
, __i
, __i
, __i
);
4245 /// Constructs a 256-bit integer vector of [16 x i16], with each of the
4246 /// 16-bit integral vector elements set to the specified 16-bit integral
4249 /// \headerfile <x86intrin.h>
4251 /// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4254 /// A 16-bit integral value used to initialize each vector element of the
4256 /// \returns An initialized 256-bit integer vector of [16 x i16].
4257 static __inline __m256i __DEFAULT_FN_ATTRS
4258 _mm256_set1_epi16(short __w
)
4260 return _mm256_set_epi16(__w
, __w
, __w
, __w
, __w
, __w
, __w
, __w
,
4261 __w
, __w
, __w
, __w
, __w
, __w
, __w
, __w
);
4264 /// Constructs a 256-bit integer vector of [32 x i8], with each of the
4265 /// 8-bit integral vector elements set to the specified 8-bit integral value.
4267 /// \headerfile <x86intrin.h>
4269 /// This intrinsic corresponds to the <c> VPSHUFB+VINSERTF128 </c> instruction.
4272 /// An 8-bit integral value used to initialize each vector element of the
4274 /// \returns An initialized 256-bit integer vector of [32 x i8].
4275 static __inline __m256i __DEFAULT_FN_ATTRS
4276 _mm256_set1_epi8(char __b
)
4278 return _mm256_set_epi8(__b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
,
4279 __b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
,
4280 __b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
,
4281 __b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
);
4284 /// Constructs a 256-bit integer vector of [4 x i64], with each of the
4285 /// 64-bit integral vector elements set to the specified 64-bit integral
4288 /// \headerfile <x86intrin.h>
4290 /// This intrinsic corresponds to the <c> VMOVDDUP+VINSERTF128 </c> instruction.
4293 /// A 64-bit integral value used to initialize each vector element of the
4295 /// \returns An initialized 256-bit integer vector of [4 x i64].
4296 static __inline __m256i __DEFAULT_FN_ATTRS
4297 _mm256_set1_epi64x(long long __q
)
4299 return _mm256_set_epi64x(__q
, __q
, __q
, __q
);
4302 /* Create __zeroed vectors */
4303 /// Constructs a 256-bit floating-point vector of [4 x double] with all
4304 /// vector elements initialized to zero.
4306 /// \headerfile <x86intrin.h>
4308 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4310 /// \returns A 256-bit vector of [4 x double] with all elements set to zero.
4311 static __inline __m256d __DEFAULT_FN_ATTRS
4312 _mm256_setzero_pd(void)
4314 return __extension__ (__m256d
){ 0.0, 0.0, 0.0, 0.0 };
4317 /// Constructs a 256-bit floating-point vector of [8 x float] with all
4318 /// vector elements initialized to zero.
4320 /// \headerfile <x86intrin.h>
4322 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4324 /// \returns A 256-bit vector of [8 x float] with all elements set to zero.
4325 static __inline __m256 __DEFAULT_FN_ATTRS
4326 _mm256_setzero_ps(void)
4328 return __extension__ (__m256
){ 0.0f
, 0.0f
, 0.0f
, 0.0f
, 0.0f
, 0.0f
, 0.0f
, 0.0f
};
4331 /// Constructs a 256-bit integer vector initialized to zero.
4333 /// \headerfile <x86intrin.h>
4335 /// This intrinsic corresponds to the <c> VXORPS </c> instruction.
4337 /// \returns A 256-bit integer vector initialized to zero.
4338 static __inline __m256i __DEFAULT_FN_ATTRS
4339 _mm256_setzero_si256(void)
4341 return __extension__ (__m256i
)(__v4di
){ 0, 0, 0, 0 };
4344 /* Cast between vector types */
4345 /// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4346 /// floating-point vector of [8 x float].
4348 /// \headerfile <x86intrin.h>
4350 /// This intrinsic has no corresponding instruction.
4353 /// A 256-bit floating-point vector of [4 x double].
4354 /// \returns A 256-bit floating-point vector of [8 x float] containing the same
4355 /// bitwise pattern as the parameter.
4356 static __inline __m256 __DEFAULT_FN_ATTRS
4357 _mm256_castpd_ps(__m256d __a
)
4362 /// Casts a 256-bit floating-point vector of [4 x double] into a 256-bit
4365 /// \headerfile <x86intrin.h>
4367 /// This intrinsic has no corresponding instruction.
4370 /// A 256-bit floating-point vector of [4 x double].
4371 /// \returns A 256-bit integer vector containing the same bitwise pattern as the
4373 static __inline __m256i __DEFAULT_FN_ATTRS
4374 _mm256_castpd_si256(__m256d __a
)
4376 return (__m256i
)__a
;
4379 /// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4380 /// floating-point vector of [4 x double].
4382 /// \headerfile <x86intrin.h>
4384 /// This intrinsic has no corresponding instruction.
4387 /// A 256-bit floating-point vector of [8 x float].
4388 /// \returns A 256-bit floating-point vector of [4 x double] containing the same
4389 /// bitwise pattern as the parameter.
4390 static __inline __m256d __DEFAULT_FN_ATTRS
4391 _mm256_castps_pd(__m256 __a
)
4393 return (__m256d
)__a
;
4396 /// Casts a 256-bit floating-point vector of [8 x float] into a 256-bit
4399 /// \headerfile <x86intrin.h>
4401 /// This intrinsic has no corresponding instruction.
4404 /// A 256-bit floating-point vector of [8 x float].
4405 /// \returns A 256-bit integer vector containing the same bitwise pattern as the
4407 static __inline __m256i __DEFAULT_FN_ATTRS
4408 _mm256_castps_si256(__m256 __a
)
4410 return (__m256i
)__a
;
4413 /// Casts a 256-bit integer vector into a 256-bit floating-point vector
4416 /// \headerfile <x86intrin.h>
4418 /// This intrinsic has no corresponding instruction.
4421 /// A 256-bit integer vector.
4422 /// \returns A 256-bit floating-point vector of [8 x float] containing the same
4423 /// bitwise pattern as the parameter.
4424 static __inline __m256 __DEFAULT_FN_ATTRS
4425 _mm256_castsi256_ps(__m256i __a
)
4430 /// Casts a 256-bit integer vector into a 256-bit floating-point vector
4431 /// of [4 x double].
4433 /// \headerfile <x86intrin.h>
4435 /// This intrinsic has no corresponding instruction.
4438 /// A 256-bit integer vector.
4439 /// \returns A 256-bit floating-point vector of [4 x double] containing the same
4440 /// bitwise pattern as the parameter.
4441 static __inline __m256d __DEFAULT_FN_ATTRS
4442 _mm256_castsi256_pd(__m256i __a
)
4444 return (__m256d
)__a
;
4447 /// Returns the lower 128 bits of a 256-bit floating-point vector of
4448 /// [4 x double] as a 128-bit floating-point vector of [2 x double].
4450 /// \headerfile <x86intrin.h>
4452 /// This intrinsic has no corresponding instruction.
4455 /// A 256-bit floating-point vector of [4 x double].
4456 /// \returns A 128-bit floating-point vector of [2 x double] containing the
4457 /// lower 128 bits of the parameter.
4458 static __inline __m128d __DEFAULT_FN_ATTRS
4459 _mm256_castpd256_pd128(__m256d __a
)
4461 return __builtin_shufflevector((__v4df
)__a
, (__v4df
)__a
, 0, 1);
4464 /// Returns the lower 128 bits of a 256-bit floating-point vector of
4465 /// [8 x float] as a 128-bit floating-point vector of [4 x float].
4467 /// \headerfile <x86intrin.h>
4469 /// This intrinsic has no corresponding instruction.
4472 /// A 256-bit floating-point vector of [8 x float].
4473 /// \returns A 128-bit floating-point vector of [4 x float] containing the
4474 /// lower 128 bits of the parameter.
4475 static __inline __m128 __DEFAULT_FN_ATTRS
4476 _mm256_castps256_ps128(__m256 __a
)
4478 return __builtin_shufflevector((__v8sf
)__a
, (__v8sf
)__a
, 0, 1, 2, 3);
4481 /// Truncates a 256-bit integer vector into a 128-bit integer vector.
4483 /// \headerfile <x86intrin.h>
4485 /// This intrinsic has no corresponding instruction.
4488 /// A 256-bit integer vector.
4489 /// \returns A 128-bit integer vector containing the lower 128 bits of the
4491 static __inline __m128i __DEFAULT_FN_ATTRS
4492 _mm256_castsi256_si128(__m256i __a
)
4494 return __builtin_shufflevector((__v4di
)__a
, (__v4di
)__a
, 0, 1);
4497 /// Constructs a 256-bit floating-point vector of [4 x double] from a
4498 /// 128-bit floating-point vector of [2 x double].
4500 /// The lower 128 bits contain the value of the source vector. The contents
4501 /// of the upper 128 bits are undefined.
4503 /// \headerfile <x86intrin.h>
4505 /// This intrinsic has no corresponding instruction.
4508 /// A 128-bit vector of [2 x double].
4509 /// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4510 /// contain the value of the parameter. The contents of the upper 128 bits
4512 static __inline __m256d __DEFAULT_FN_ATTRS
4513 _mm256_castpd128_pd256(__m128d __a
)
4515 return __builtin_shufflevector(
4516 (__v2df
)__a
, (__v2df
)__builtin_nondeterministic_value(__a
), 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].
4522 /// The lower 128 bits contain the value of the source vector. The contents
4523 /// of the upper 128 bits are undefined.
4525 /// \headerfile <x86intrin.h>
4527 /// This intrinsic has no corresponding instruction.
4530 /// A 128-bit vector of [4 x float].
4531 /// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4532 /// contain the value of the parameter. The contents of the upper 128 bits
4534 static __inline __m256 __DEFAULT_FN_ATTRS
4535 _mm256_castps128_ps256(__m128 __a
)
4537 return __builtin_shufflevector((__v4sf
)__a
,
4538 (__v4sf
)__builtin_nondeterministic_value(__a
),
4539 0, 1, 2, 3, 4, 5, 6, 7);
4542 /// Constructs a 256-bit integer vector from a 128-bit integer vector.
4544 /// The lower 128 bits contain the value of the source vector. The contents
4545 /// of the upper 128 bits are undefined.
4547 /// \headerfile <x86intrin.h>
4549 /// This intrinsic has no corresponding instruction.
4552 /// A 128-bit integer vector.
4553 /// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4554 /// the parameter. The contents of the upper 128 bits are undefined.
4555 static __inline __m256i __DEFAULT_FN_ATTRS
4556 _mm256_castsi128_si256(__m128i __a
)
4558 return __builtin_shufflevector(
4559 (__v2di
)__a
, (__v2di
)__builtin_nondeterministic_value(__a
), 0, 1, 2, 3);
4562 /// Constructs a 256-bit floating-point vector of [4 x double] from a
4563 /// 128-bit floating-point vector of [2 x double]. The lower 128 bits
4564 /// contain the value of the source vector. The upper 128 bits are set
4567 /// \headerfile <x86intrin.h>
4569 /// This intrinsic has no corresponding instruction.
4572 /// A 128-bit vector of [2 x double].
4573 /// \returns A 256-bit floating-point vector of [4 x double]. The lower 128 bits
4574 /// contain the value of the parameter. The upper 128 bits are set to zero.
4575 static __inline __m256d __DEFAULT_FN_ATTRS
4576 _mm256_zextpd128_pd256(__m128d __a
)
4578 return __builtin_shufflevector((__v2df
)__a
, (__v2df
)_mm_setzero_pd(), 0, 1, 2, 3);
4581 /// Constructs a 256-bit floating-point vector of [8 x float] from a
4582 /// 128-bit floating-point vector of [4 x float]. The lower 128 bits contain
4583 /// the value of the source vector. The upper 128 bits are set to zero.
4585 /// \headerfile <x86intrin.h>
4587 /// This intrinsic has no corresponding instruction.
4590 /// A 128-bit vector of [4 x float].
4591 /// \returns A 256-bit floating-point vector of [8 x float]. The lower 128 bits
4592 /// contain the value of the parameter. The upper 128 bits are set to zero.
4593 static __inline __m256 __DEFAULT_FN_ATTRS
4594 _mm256_zextps128_ps256(__m128 __a
)
4596 return __builtin_shufflevector((__v4sf
)__a
, (__v4sf
)_mm_setzero_ps(), 0, 1, 2, 3, 4, 5, 6, 7);
4599 /// Constructs a 256-bit integer vector from a 128-bit integer vector.
4600 /// The lower 128 bits contain the value of the source vector. The upper
4601 /// 128 bits are set to zero.
4603 /// \headerfile <x86intrin.h>
4605 /// This intrinsic has no corresponding instruction.
4608 /// A 128-bit integer vector.
4609 /// \returns A 256-bit integer vector. The lower 128 bits contain the value of
4610 /// the parameter. The upper 128 bits are set to zero.
4611 static __inline __m256i __DEFAULT_FN_ATTRS
4612 _mm256_zextsi128_si256(__m128i __a
)
4614 return __builtin_shufflevector((__v2di
)__a
, (__v2di
)_mm_setzero_si128(), 0, 1, 2, 3);
4619 We use macros rather than inlines because we only want to accept
4620 invocations where the immediate M is a constant expression.
4622 /// Constructs a new 256-bit vector of [8 x float] by first duplicating
4623 /// a 256-bit vector of [8 x float] given in the first parameter, and then
4624 /// replacing either the upper or the lower 128 bits with the contents of a
4625 /// 128-bit vector of [4 x float] in the second parameter.
4627 /// The immediate integer parameter determines between the upper or the lower
4630 /// \headerfile <x86intrin.h>
4633 /// __m256 _mm256_insertf128_ps(__m256 V1, __m128 V2, const int M);
4636 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4639 /// A 256-bit vector of [8 x float]. This vector is copied to the result
4640 /// first, and then either the upper or the lower 128 bits of the result will
4641 /// be replaced by the contents of \a V2.
4643 /// A 128-bit vector of [4 x float]. The contents of this parameter are
4644 /// written to either the upper or the lower 128 bits of the result depending
4645 /// on the value of parameter \a M.
4647 /// An immediate integer. The least significant bit determines how the values
4648 /// from the two parameters are interleaved: \n
4649 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4650 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4652 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4653 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4655 /// \returns A 256-bit vector of [8 x float] containing the interleaved values.
4656 #define _mm256_insertf128_ps(V1, V2, M) \
4657 ((__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)(__m256)(V1), \
4658 (__v4sf)(__m128)(V2), (int)(M)))
4660 /// Constructs a new 256-bit vector of [4 x double] by first duplicating
4661 /// a 256-bit vector of [4 x double] given in the first parameter, and then
4662 /// replacing either the upper or the lower 128 bits with the contents of a
4663 /// 128-bit vector of [2 x double] in the second parameter.
4665 /// The immediate integer parameter determines between the upper or the lower
4668 /// \headerfile <x86intrin.h>
4671 /// __m256d _mm256_insertf128_pd(__m256d V1, __m128d V2, const int M);
4674 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4677 /// A 256-bit vector of [4 x double]. This vector is copied to the result
4678 /// first, and then either the upper or the lower 128 bits of the result will
4679 /// be replaced by the contents of \a V2.
4681 /// A 128-bit vector of [2 x double]. The contents of this parameter are
4682 /// written to either the upper or the lower 128 bits of the result depending
4683 /// on the value of parameter \a M.
4685 /// An immediate integer. The least significant bit determines how the values
4686 /// from the two parameters are interleaved: \n
4687 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4688 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4690 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4691 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4693 /// \returns A 256-bit vector of [4 x double] containing the interleaved values.
4694 #define _mm256_insertf128_pd(V1, V2, M) \
4695 ((__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)(__m256d)(V1), \
4696 (__v2df)(__m128d)(V2), (int)(M)))
4698 /// Constructs a new 256-bit integer vector by first duplicating a
4699 /// 256-bit integer vector given in the first parameter, and then replacing
4700 /// either the upper or the lower 128 bits with the contents of a 128-bit
4701 /// integer vector in the second parameter.
4703 /// The immediate integer parameter determines between the upper or the lower
4706 /// \headerfile <x86intrin.h>
4709 /// __m256i _mm256_insertf128_si256(__m256i V1, __m128i V2, const int M);
4712 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4715 /// A 256-bit integer vector. This vector is copied to the result first, and
4716 /// then either the upper or the lower 128 bits of the result will be
4717 /// replaced by the contents of \a V2.
4719 /// A 128-bit integer vector. The contents of this parameter are written to
4720 /// either the upper or the lower 128 bits of the result depending on the
4721 /// value of parameter \a M.
4723 /// An immediate integer. The least significant bit determines how the values
4724 /// from the two parameters are interleaved: \n
4725 /// If bit [0] of \a M is 0, \a V2 are copied to bits [127:0] of the result,
4726 /// and bits [255:128] of \a V1 are copied to bits [255:128] of the
4728 /// If bit [0] of \a M is 1, \a V2 are copied to bits [255:128] of the
4729 /// result, and bits [127:0] of \a V1 are copied to bits [127:0] of the
4731 /// \returns A 256-bit integer vector containing the interleaved values.
4732 #define _mm256_insertf128_si256(V1, V2, M) \
4733 ((__m256i)__builtin_ia32_vinsertf128_si256((__v8si)(__m256i)(V1), \
4734 (__v4si)(__m128i)(V2), (int)(M)))
4738 We use macros rather than inlines because we only want to accept
4739 invocations where the immediate M is a constant expression.
4741 /// Extracts either the upper or the lower 128 bits from a 256-bit vector
4742 /// of [8 x float], as determined by the immediate integer parameter, and
4743 /// returns the extracted bits as a 128-bit vector of [4 x float].
4745 /// \headerfile <x86intrin.h>
4748 /// __m128 _mm256_extractf128_ps(__m256 V, const int M);
4751 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4754 /// A 256-bit vector of [8 x float].
4756 /// An immediate integer. The least significant bit determines which bits are
4757 /// extracted from the first parameter: \n
4758 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4760 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4761 /// \returns A 128-bit vector of [4 x float] containing the extracted bits.
4762 #define _mm256_extractf128_ps(V, M) \
4763 ((__m128)__builtin_ia32_vextractf128_ps256((__v8sf)(__m256)(V), (int)(M)))
4765 /// Extracts either the upper or the lower 128 bits from a 256-bit vector
4766 /// of [4 x double], as determined by the immediate integer parameter, and
4767 /// returns the extracted bits as a 128-bit vector of [2 x double].
4769 /// \headerfile <x86intrin.h>
4772 /// __m128d _mm256_extractf128_pd(__m256d V, const int M);
4775 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4778 /// A 256-bit vector of [4 x double].
4780 /// An immediate integer. The least significant bit determines which bits are
4781 /// extracted from the first parameter: \n
4782 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4784 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4785 /// \returns A 128-bit vector of [2 x double] containing the extracted bits.
4786 #define _mm256_extractf128_pd(V, M) \
4787 ((__m128d)__builtin_ia32_vextractf128_pd256((__v4df)(__m256d)(V), (int)(M)))
4789 /// Extracts either the upper or the lower 128 bits from a 256-bit
4790 /// integer vector, as determined by the immediate integer parameter, and
4791 /// returns the extracted bits as a 128-bit integer vector.
4793 /// \headerfile <x86intrin.h>
4796 /// __m128i _mm256_extractf128_si256(__m256i V, const int M);
4799 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction.
4802 /// A 256-bit integer vector.
4804 /// An immediate integer. The least significant bit determines which bits are
4805 /// extracted from the first parameter: \n
4806 /// If bit [0] of \a M is 0, bits [127:0] of \a V are copied to the
4808 /// If bit [0] of \a M is 1, bits [255:128] of \a V are copied to the result.
4809 /// \returns A 128-bit integer vector containing the extracted bits.
4810 #define _mm256_extractf128_si256(V, M) \
4811 ((__m128i)__builtin_ia32_vextractf128_si256((__v8si)(__m256i)(V), (int)(M)))
4813 /// Constructs a 256-bit floating-point vector of [8 x float] by
4814 /// concatenating two 128-bit floating-point vectors of [4 x float].
4816 /// \headerfile <x86intrin.h>
4818 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4821 /// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4822 /// 128 bits of the result.
4824 /// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4825 /// 128 bits of the result.
4826 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4827 /// concatenated result.
4828 static __inline __m256 __DEFAULT_FN_ATTRS
4829 _mm256_set_m128 (__m128 __hi
, __m128 __lo
)
4831 return (__m256
) __builtin_shufflevector((__v4sf
)__lo
, (__v4sf
)__hi
, 0, 1, 2, 3, 4, 5, 6, 7);
4834 /// Constructs a 256-bit floating-point vector of [4 x double] by
4835 /// concatenating two 128-bit floating-point vectors of [2 x double].
4837 /// \headerfile <x86intrin.h>
4839 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4842 /// A 128-bit floating-point vector of [2 x double] to be copied to the upper
4843 /// 128 bits of the result.
4845 /// A 128-bit floating-point vector of [2 x double] to be copied to the lower
4846 /// 128 bits of the result.
4847 /// \returns A 256-bit floating-point vector of [4 x double] containing the
4848 /// concatenated result.
4849 static __inline __m256d __DEFAULT_FN_ATTRS
4850 _mm256_set_m128d (__m128d __hi
, __m128d __lo
)
4852 return (__m256d
) __builtin_shufflevector((__v2df
)__lo
, (__v2df
)__hi
, 0, 1, 2, 3);
4855 /// Constructs a 256-bit integer vector by concatenating two 128-bit
4856 /// integer vectors.
4858 /// \headerfile <x86intrin.h>
4860 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4863 /// A 128-bit integer vector to be copied to the upper 128 bits of the
4866 /// A 128-bit integer vector to be copied to the lower 128 bits of the
4868 /// \returns A 256-bit integer vector containing the concatenated result.
4869 static __inline __m256i __DEFAULT_FN_ATTRS
4870 _mm256_set_m128i (__m128i __hi
, __m128i __lo
)
4872 return (__m256i
) __builtin_shufflevector((__v2di
)__lo
, (__v2di
)__hi
, 0, 1, 2, 3);
4875 /// Constructs a 256-bit floating-point vector of [8 x float] by
4876 /// concatenating two 128-bit floating-point vectors of [4 x float]. This is
4877 /// similar to _mm256_set_m128, but the order of the input parameters is
4880 /// \headerfile <x86intrin.h>
4882 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4885 /// A 128-bit floating-point vector of [4 x float] to be copied to the lower
4886 /// 128 bits of the result.
4888 /// A 128-bit floating-point vector of [4 x float] to be copied to the upper
4889 /// 128 bits of the result.
4890 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4891 /// concatenated result.
4892 static __inline __m256 __DEFAULT_FN_ATTRS
4893 _mm256_setr_m128 (__m128 __lo
, __m128 __hi
)
4895 return _mm256_set_m128(__hi
, __lo
);
4898 /// Constructs a 256-bit floating-point vector of [4 x double] by
4899 /// concatenating two 128-bit floating-point vectors of [2 x double]. This is
4900 /// similar to _mm256_set_m128d, but the order of the input parameters is
4903 /// \headerfile <x86intrin.h>
4905 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4908 /// A 128-bit floating-point vector of [2 x double] to be copied to the lower
4909 /// 128 bits of the result.
4911 /// A 128-bit floating-point vector of [2 x double] to be copied to the upper
4912 /// 128 bits of the result.
4913 /// \returns A 256-bit floating-point vector of [4 x double] containing the
4914 /// concatenated result.
4915 static __inline __m256d __DEFAULT_FN_ATTRS
4916 _mm256_setr_m128d (__m128d __lo
, __m128d __hi
)
4918 return (__m256d
)_mm256_set_m128d(__hi
, __lo
);
4921 /// Constructs a 256-bit integer vector by concatenating two 128-bit
4922 /// integer vectors. This is similar to _mm256_set_m128i, but the order of
4923 /// the input parameters is swapped.
4925 /// \headerfile <x86intrin.h>
4927 /// This intrinsic corresponds to the <c> VINSERTF128 </c> instruction.
4930 /// A 128-bit integer vector to be copied to the lower 128 bits of the
4933 /// A 128-bit integer vector to be copied to the upper 128 bits of the
4935 /// \returns A 256-bit integer vector containing the concatenated result.
4936 static __inline __m256i __DEFAULT_FN_ATTRS
4937 _mm256_setr_m128i (__m128i __lo
, __m128i __hi
)
4939 return (__m256i
)_mm256_set_m128i(__hi
, __lo
);
4942 /* SIMD load ops (unaligned) */
4943 /// Loads two 128-bit floating-point vectors of [4 x float] from
4944 /// unaligned memory locations and constructs a 256-bit floating-point vector
4945 /// of [8 x float] by concatenating the two 128-bit vectors.
4947 /// \headerfile <x86intrin.h>
4949 /// This intrinsic corresponds to load instructions followed by the
4950 /// <c> VINSERTF128 </c> instruction.
4952 /// \param __addr_hi
4953 /// A pointer to a 128-bit memory location containing 4 consecutive
4954 /// single-precision floating-point values. These values are to be copied to
4955 /// bits[255:128] of the result. The address of the memory location does not
4956 /// have to be aligned.
4957 /// \param __addr_lo
4958 /// A pointer to a 128-bit memory location containing 4 consecutive
4959 /// single-precision floating-point values. These values are to be copied to
4960 /// bits[127:0] of the result. The address of the memory location does not
4961 /// have to be aligned.
4962 /// \returns A 256-bit floating-point vector of [8 x float] containing the
4963 /// concatenated result.
4964 static __inline __m256 __DEFAULT_FN_ATTRS
4965 _mm256_loadu2_m128(float const *__addr_hi
, float const *__addr_lo
)
4967 return _mm256_set_m128(_mm_loadu_ps(__addr_hi
), _mm_loadu_ps(__addr_lo
));
4970 /// Loads two 128-bit floating-point vectors of [2 x double] from
4971 /// unaligned memory locations and constructs a 256-bit floating-point vector
4972 /// of [4 x double] by concatenating the two 128-bit vectors.
4974 /// \headerfile <x86intrin.h>
4976 /// This intrinsic corresponds to load instructions followed by the
4977 /// <c> VINSERTF128 </c> instruction.
4979 /// \param __addr_hi
4980 /// A pointer to a 128-bit memory location containing two consecutive
4981 /// double-precision floating-point values. These values are to be copied to
4982 /// bits[255:128] of the result. The address of the memory location does not
4983 /// have to be aligned.
4984 /// \param __addr_lo
4985 /// A pointer to a 128-bit memory location containing two consecutive
4986 /// double-precision floating-point values. These values are to be copied to
4987 /// bits[127:0] of the result. The address of the memory location does not
4988 /// have to be aligned.
4989 /// \returns A 256-bit floating-point vector of [4 x double] containing the
4990 /// concatenated result.
4991 static __inline __m256d __DEFAULT_FN_ATTRS
4992 _mm256_loadu2_m128d(double const *__addr_hi
, double const *__addr_lo
)
4994 return _mm256_set_m128d(_mm_loadu_pd(__addr_hi
), _mm_loadu_pd(__addr_lo
));
4997 /// Loads two 128-bit integer vectors from unaligned memory locations and
4998 /// constructs a 256-bit integer vector by concatenating the two 128-bit
5001 /// \headerfile <x86intrin.h>
5003 /// This intrinsic corresponds to load instructions followed by the
5004 /// <c> VINSERTF128 </c> instruction.
5006 /// \param __addr_hi
5007 /// A pointer to a 128-bit memory location containing a 128-bit integer
5008 /// vector. This vector is to be copied to bits[255:128] of the result. The
5009 /// address of the memory location does not have to be aligned.
5010 /// \param __addr_lo
5011 /// A pointer to a 128-bit memory location containing a 128-bit integer
5012 /// vector. This vector is to be copied to bits[127:0] of the result. The
5013 /// address of the memory location does not have to be aligned.
5014 /// \returns A 256-bit integer vector containing the concatenated result.
5015 static __inline __m256i __DEFAULT_FN_ATTRS
5016 _mm256_loadu2_m128i(__m128i_u
const *__addr_hi
, __m128i_u
const *__addr_lo
)
5018 return _mm256_set_m128i(_mm_loadu_si128(__addr_hi
), _mm_loadu_si128(__addr_lo
));
5021 /* SIMD store ops (unaligned) */
5022 /// Stores the upper and lower 128 bits of a 256-bit floating-point
5023 /// vector of [8 x float] into two different unaligned memory locations.
5025 /// \headerfile <x86intrin.h>
5027 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
5028 /// store instructions.
5030 /// \param __addr_hi
5031 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
5032 /// copied to this memory location. The address of this memory location does
5033 /// not have to be aligned.
5034 /// \param __addr_lo
5035 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
5036 /// copied to this memory location. The address of this memory location does
5037 /// not have to be aligned.
5039 /// A 256-bit floating-point vector of [8 x float].
5040 static __inline
void __DEFAULT_FN_ATTRS
5041 _mm256_storeu2_m128(float *__addr_hi
, float *__addr_lo
, __m256 __a
)
5045 __v128
= _mm256_castps256_ps128(__a
);
5046 _mm_storeu_ps(__addr_lo
, __v128
);
5047 __v128
= _mm256_extractf128_ps(__a
, 1);
5048 _mm_storeu_ps(__addr_hi
, __v128
);
5051 /// Stores the upper and lower 128 bits of a 256-bit floating-point
5052 /// vector of [4 x double] into two different unaligned memory locations.
5054 /// \headerfile <x86intrin.h>
5056 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
5057 /// store instructions.
5059 /// \param __addr_hi
5060 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
5061 /// copied to this memory location. The address of this memory location does
5062 /// not have to be aligned.
5063 /// \param __addr_lo
5064 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
5065 /// copied to this memory location. The address of this memory location does
5066 /// not have to be aligned.
5068 /// A 256-bit floating-point vector of [4 x double].
5069 static __inline
void __DEFAULT_FN_ATTRS
5070 _mm256_storeu2_m128d(double *__addr_hi
, double *__addr_lo
, __m256d __a
)
5074 __v128
= _mm256_castpd256_pd128(__a
);
5075 _mm_storeu_pd(__addr_lo
, __v128
);
5076 __v128
= _mm256_extractf128_pd(__a
, 1);
5077 _mm_storeu_pd(__addr_hi
, __v128
);
5080 /// Stores the upper and lower 128 bits of a 256-bit integer vector into
5081 /// two different unaligned memory locations.
5083 /// \headerfile <x86intrin.h>
5085 /// This intrinsic corresponds to the <c> VEXTRACTF128 </c> instruction and the
5086 /// store instructions.
5088 /// \param __addr_hi
5089 /// A pointer to a 128-bit memory location. Bits[255:128] of \a __a are to be
5090 /// copied to this memory location. The address of this memory location does
5091 /// not have to be aligned.
5092 /// \param __addr_lo
5093 /// A pointer to a 128-bit memory location. Bits[127:0] of \a __a are to be
5094 /// copied to this memory location. The address of this memory location does
5095 /// not have to be aligned.
5097 /// A 256-bit integer vector.
5098 static __inline
void __DEFAULT_FN_ATTRS
5099 _mm256_storeu2_m128i(__m128i_u
*__addr_hi
, __m128i_u
*__addr_lo
, __m256i __a
)
5103 __v128
= _mm256_castsi256_si128(__a
);
5104 _mm_storeu_si128(__addr_lo
, __v128
);
5105 __v128
= _mm256_extractf128_si256(__a
, 1);
5106 _mm_storeu_si128(__addr_hi
, __v128
);
5109 #undef __DEFAULT_FN_ATTRS
5110 #undef __DEFAULT_FN_ATTRS128
5112 #endif /* __AVXINTRIN_H */