1 /*===---- emmintrin.h - SSE2 intrinsics ------------------------------------===
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 *===-----------------------------------------------------------------------===
27 #include <xmmintrin.h>
29 typedef double __m128d __attribute__((__vector_size__(16)));
30 typedef long long __m128i __attribute__((__vector_size__(16)));
33 typedef double __v2df __attribute__ ((__vector_size__ (16)));
34 typedef long long __v2di __attribute__ ((__vector_size__ (16)));
35 typedef short __v8hi __attribute__((__vector_size__(16)));
36 typedef char __v16qi __attribute__((__vector_size__(16)));
39 typedef unsigned long long __v2du __attribute__ ((__vector_size__ (16)));
40 typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
41 typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
43 /* We need an explicitly signed variant for char. Note that this shouldn't
44 * appear in the interface though. */
45 typedef signed char __v16qs __attribute__((__vector_size__(16)));
47 /* Define the default attributes for the functions in this file. */
48 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128)))
49 #define __DEFAULT_FN_ATTRS_MMX __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64)))
51 /// Adds lower double-precision values in both operands and returns the
52 /// sum in the lower 64 bits of the result. The upper 64 bits of the result
53 /// are copied from the upper double-precision value of the first operand.
55 /// \headerfile <x86intrin.h>
57 /// This intrinsic corresponds to the <c> VADDSD / ADDSD </c> instruction.
60 /// A 128-bit vector of [2 x double] containing one of the source operands.
62 /// A 128-bit vector of [2 x double] containing one of the source operands.
63 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
64 /// sum of the lower 64 bits of both operands. The upper 64 bits are copied
65 /// from the upper 64 bits of the first source operand.
66 static __inline__ __m128d __DEFAULT_FN_ATTRS
67 _mm_add_sd(__m128d __a, __m128d __b)
73 /// Adds two 128-bit vectors of [2 x double].
75 /// \headerfile <x86intrin.h>
77 /// This intrinsic corresponds to the <c> VADDPD / ADDPD </c> instruction.
80 /// A 128-bit vector of [2 x double] containing one of the source operands.
82 /// A 128-bit vector of [2 x double] containing one of the source operands.
83 /// \returns A 128-bit vector of [2 x double] containing the sums of both
85 static __inline__ __m128d __DEFAULT_FN_ATTRS
86 _mm_add_pd(__m128d __a, __m128d __b)
88 return (__m128d)((__v2df)__a + (__v2df)__b);
91 /// Subtracts the lower double-precision value of the second operand
92 /// from the lower double-precision value of the first operand and returns
93 /// the difference in the lower 64 bits of the result. The upper 64 bits of
94 /// the result are copied from the upper double-precision value of the first
97 /// \headerfile <x86intrin.h>
99 /// This intrinsic corresponds to the <c> VSUBSD / SUBSD </c> instruction.
102 /// A 128-bit vector of [2 x double] containing the minuend.
104 /// A 128-bit vector of [2 x double] containing the subtrahend.
105 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
106 /// difference of the lower 64 bits of both operands. The upper 64 bits are
107 /// copied from the upper 64 bits of the first source operand.
108 static __inline__ __m128d __DEFAULT_FN_ATTRS
109 _mm_sub_sd(__m128d __a, __m128d __b)
115 /// Subtracts two 128-bit vectors of [2 x double].
117 /// \headerfile <x86intrin.h>
119 /// This intrinsic corresponds to the <c> VSUBPD / SUBPD </c> instruction.
122 /// A 128-bit vector of [2 x double] containing the minuend.
124 /// A 128-bit vector of [2 x double] containing the subtrahend.
125 /// \returns A 128-bit vector of [2 x double] containing the differences between
127 static __inline__ __m128d __DEFAULT_FN_ATTRS
128 _mm_sub_pd(__m128d __a, __m128d __b)
130 return (__m128d)((__v2df)__a - (__v2df)__b);
133 /// Multiplies lower double-precision values in both operands and returns
134 /// the product in the lower 64 bits of the result. The upper 64 bits of the
135 /// result are copied from the upper double-precision value of the first
138 /// \headerfile <x86intrin.h>
140 /// This intrinsic corresponds to the <c> VMULSD / MULSD </c> instruction.
143 /// A 128-bit vector of [2 x double] containing one of the source operands.
145 /// A 128-bit vector of [2 x double] containing one of the source operands.
146 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
147 /// product of the lower 64 bits of both operands. The upper 64 bits are
148 /// copied from the upper 64 bits of the first source operand.
149 static __inline__ __m128d __DEFAULT_FN_ATTRS
150 _mm_mul_sd(__m128d __a, __m128d __b)
156 /// Multiplies two 128-bit vectors of [2 x double].
158 /// \headerfile <x86intrin.h>
160 /// This intrinsic corresponds to the <c> VMULPD / MULPD </c> instruction.
163 /// A 128-bit vector of [2 x double] containing one of the operands.
165 /// A 128-bit vector of [2 x double] containing one of the operands.
166 /// \returns A 128-bit vector of [2 x double] containing the products of both
168 static __inline__ __m128d __DEFAULT_FN_ATTRS
169 _mm_mul_pd(__m128d __a, __m128d __b)
171 return (__m128d)((__v2df)__a * (__v2df)__b);
174 /// Divides the lower double-precision value of the first operand by the
175 /// lower double-precision value of the second operand and returns the
176 /// quotient in the lower 64 bits of the result. The upper 64 bits of the
177 /// result are copied from the upper double-precision value of the first
180 /// \headerfile <x86intrin.h>
182 /// This intrinsic corresponds to the <c> VDIVSD / DIVSD </c> instruction.
185 /// A 128-bit vector of [2 x double] containing the dividend.
187 /// A 128-bit vector of [2 x double] containing divisor.
188 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
189 /// quotient of the lower 64 bits of both operands. The upper 64 bits are
190 /// copied from the upper 64 bits of the first source operand.
191 static __inline__ __m128d __DEFAULT_FN_ATTRS
192 _mm_div_sd(__m128d __a, __m128d __b)
198 /// Performs an element-by-element division of two 128-bit vectors of
201 /// \headerfile <x86intrin.h>
203 /// This intrinsic corresponds to the <c> VDIVPD / DIVPD </c> instruction.
206 /// A 128-bit vector of [2 x double] containing the dividend.
208 /// A 128-bit vector of [2 x double] containing the divisor.
209 /// \returns A 128-bit vector of [2 x double] containing the quotients of both
211 static __inline__ __m128d __DEFAULT_FN_ATTRS
212 _mm_div_pd(__m128d __a, __m128d __b)
214 return (__m128d)((__v2df)__a / (__v2df)__b);
217 /// Calculates the square root of the lower double-precision value of
218 /// the second operand and returns it in the lower 64 bits of the result.
219 /// The upper 64 bits of the result are copied from the upper
220 /// double-precision value of the first operand.
222 /// \headerfile <x86intrin.h>
224 /// This intrinsic corresponds to the <c> VSQRTSD / SQRTSD </c> instruction.
227 /// A 128-bit vector of [2 x double] containing one of the operands. The
228 /// upper 64 bits of this operand are copied to the upper 64 bits of the
231 /// A 128-bit vector of [2 x double] containing one of the operands. The
232 /// square root is calculated using the lower 64 bits of this operand.
233 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
234 /// square root of the lower 64 bits of operand \a __b, and whose upper 64
235 /// bits are copied from the upper 64 bits of operand \a __a.
236 static __inline__ __m128d __DEFAULT_FN_ATTRS
237 _mm_sqrt_sd(__m128d __a, __m128d __b)
239 __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b);
240 return __extension__ (__m128d) { __c[0], __a[1] };
243 /// Calculates the square root of the each of two values stored in a
244 /// 128-bit vector of [2 x double].
246 /// \headerfile <x86intrin.h>
248 /// This intrinsic corresponds to the <c> VSQRTPD / SQRTPD </c> instruction.
251 /// A 128-bit vector of [2 x double].
252 /// \returns A 128-bit vector of [2 x double] containing the square roots of the
253 /// values in the operand.
254 static __inline__ __m128d __DEFAULT_FN_ATTRS
255 _mm_sqrt_pd(__m128d __a)
257 return __builtin_ia32_sqrtpd((__v2df)__a);
260 /// Compares lower 64-bit double-precision values of both operands, and
261 /// returns the lesser of the pair of values in the lower 64-bits of the
262 /// result. The upper 64 bits of the result are copied from the upper
263 /// double-precision value of the first operand.
265 /// \headerfile <x86intrin.h>
267 /// This intrinsic corresponds to the <c> VMINSD / MINSD </c> instruction.
270 /// A 128-bit vector of [2 x double] containing one of the operands. The
271 /// lower 64 bits of this operand are used in the comparison.
273 /// A 128-bit vector of [2 x double] containing one of the operands. The
274 /// lower 64 bits of this operand are used in the comparison.
275 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
276 /// minimum value between both operands. The upper 64 bits are copied from
277 /// the upper 64 bits of the first source operand.
278 static __inline__ __m128d __DEFAULT_FN_ATTRS
279 _mm_min_sd(__m128d __a, __m128d __b)
281 return __builtin_ia32_minsd((__v2df)__a, (__v2df)__b);
284 /// Performs element-by-element comparison of the two 128-bit vectors of
285 /// [2 x double] and returns the vector containing the lesser of each pair of
288 /// \headerfile <x86intrin.h>
290 /// This intrinsic corresponds to the <c> VMINPD / MINPD </c> instruction.
293 /// A 128-bit vector of [2 x double] containing one of the operands.
295 /// A 128-bit vector of [2 x double] containing one of the operands.
296 /// \returns A 128-bit vector of [2 x double] containing the minimum values
297 /// between both operands.
298 static __inline__ __m128d __DEFAULT_FN_ATTRS
299 _mm_min_pd(__m128d __a, __m128d __b)
301 return __builtin_ia32_minpd((__v2df)__a, (__v2df)__b);
304 /// Compares lower 64-bit double-precision values of both operands, and
305 /// returns the greater of the pair of values in the lower 64-bits of the
306 /// result. The upper 64 bits of the result are copied from the upper
307 /// double-precision value of the first operand.
309 /// \headerfile <x86intrin.h>
311 /// This intrinsic corresponds to the <c> VMAXSD / MAXSD </c> instruction.
314 /// A 128-bit vector of [2 x double] containing one of the operands. The
315 /// lower 64 bits of this operand are used in the comparison.
317 /// A 128-bit vector of [2 x double] containing one of the operands. The
318 /// lower 64 bits of this operand are used in the comparison.
319 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
320 /// maximum value between both operands. The upper 64 bits are copied from
321 /// the upper 64 bits of the first source operand.
322 static __inline__ __m128d __DEFAULT_FN_ATTRS
323 _mm_max_sd(__m128d __a, __m128d __b)
325 return __builtin_ia32_maxsd((__v2df)__a, (__v2df)__b);
328 /// Performs element-by-element comparison of the two 128-bit vectors of
329 /// [2 x double] and returns the vector containing the greater of each pair
332 /// \headerfile <x86intrin.h>
334 /// This intrinsic corresponds to the <c> VMAXPD / MAXPD </c> instruction.
337 /// A 128-bit vector of [2 x double] containing one of the operands.
339 /// A 128-bit vector of [2 x double] containing one of the operands.
340 /// \returns A 128-bit vector of [2 x double] containing the maximum values
341 /// between both operands.
342 static __inline__ __m128d __DEFAULT_FN_ATTRS
343 _mm_max_pd(__m128d __a, __m128d __b)
345 return __builtin_ia32_maxpd((__v2df)__a, (__v2df)__b);
348 /// Performs a bitwise AND of two 128-bit vectors of [2 x double].
350 /// \headerfile <x86intrin.h>
352 /// This intrinsic corresponds to the <c> VPAND / PAND </c> instruction.
355 /// A 128-bit vector of [2 x double] containing one of the source operands.
357 /// A 128-bit vector of [2 x double] containing one of the source operands.
358 /// \returns A 128-bit vector of [2 x double] containing the bitwise AND of the
359 /// values between both operands.
360 static __inline__ __m128d __DEFAULT_FN_ATTRS
361 _mm_and_pd(__m128d __a, __m128d __b)
363 return (__m128d)((__v2du)__a & (__v2du)__b);
366 /// Performs a bitwise AND of two 128-bit vectors of [2 x double], using
367 /// the one's complement of the values contained in the first source operand.
369 /// \headerfile <x86intrin.h>
371 /// This intrinsic corresponds to the <c> VPANDN / PANDN </c> instruction.
374 /// A 128-bit vector of [2 x double] containing the left source operand. The
375 /// one's complement of this value is used in the bitwise AND.
377 /// A 128-bit vector of [2 x double] containing the right source operand.
378 /// \returns A 128-bit vector of [2 x double] containing the bitwise AND of the
379 /// values in the second operand and the one's complement of the first
381 static __inline__ __m128d __DEFAULT_FN_ATTRS
382 _mm_andnot_pd(__m128d __a, __m128d __b)
384 return (__m128d)(~(__v2du)__a & (__v2du)__b);
387 /// Performs a bitwise OR of two 128-bit vectors of [2 x double].
389 /// \headerfile <x86intrin.h>
391 /// This intrinsic corresponds to the <c> VPOR / POR </c> instruction.
394 /// A 128-bit vector of [2 x double] containing one of the source operands.
396 /// A 128-bit vector of [2 x double] containing one of the source operands.
397 /// \returns A 128-bit vector of [2 x double] containing the bitwise OR of the
398 /// values between both operands.
399 static __inline__ __m128d __DEFAULT_FN_ATTRS
400 _mm_or_pd(__m128d __a, __m128d __b)
402 return (__m128d)((__v2du)__a | (__v2du)__b);
405 /// Performs a bitwise XOR of two 128-bit vectors of [2 x double].
407 /// \headerfile <x86intrin.h>
409 /// This intrinsic corresponds to the <c> VPXOR / PXOR </c> instruction.
412 /// A 128-bit vector of [2 x double] containing one of the source operands.
414 /// A 128-bit vector of [2 x double] containing one of the source operands.
415 /// \returns A 128-bit vector of [2 x double] containing the bitwise XOR of the
416 /// values between both operands.
417 static __inline__ __m128d __DEFAULT_FN_ATTRS
418 _mm_xor_pd(__m128d __a, __m128d __b)
420 return (__m128d)((__v2du)__a ^ (__v2du)__b);
423 /// Compares each of the corresponding double-precision values of the
424 /// 128-bit vectors of [2 x double] for equality. Each comparison yields 0x0
425 /// for false, 0xFFFFFFFFFFFFFFFF for true.
427 /// \headerfile <x86intrin.h>
429 /// This intrinsic corresponds to the <c> VCMPEQPD / CMPEQPD </c> instruction.
432 /// A 128-bit vector of [2 x double].
434 /// A 128-bit vector of [2 x double].
435 /// \returns A 128-bit vector containing the comparison results.
436 static __inline__ __m128d __DEFAULT_FN_ATTRS
437 _mm_cmpeq_pd(__m128d __a, __m128d __b)
439 return (__m128d)__builtin_ia32_cmpeqpd((__v2df)__a, (__v2df)__b);
442 /// Compares each of the corresponding double-precision values of the
443 /// 128-bit vectors of [2 x double] to determine if the values in the first
444 /// operand are less than those in the second operand. Each comparison
445 /// yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
447 /// \headerfile <x86intrin.h>
449 /// This intrinsic corresponds to the <c> VCMPLTPD / CMPLTPD </c> instruction.
452 /// A 128-bit vector of [2 x double].
454 /// A 128-bit vector of [2 x double].
455 /// \returns A 128-bit vector containing the comparison results.
456 static __inline__ __m128d __DEFAULT_FN_ATTRS
457 _mm_cmplt_pd(__m128d __a, __m128d __b)
459 return (__m128d)__builtin_ia32_cmpltpd((__v2df)__a, (__v2df)__b);
462 /// Compares each of the corresponding double-precision values of the
463 /// 128-bit vectors of [2 x double] to determine if the values in the first
464 /// operand are less than or equal to those in the second operand.
466 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
468 /// \headerfile <x86intrin.h>
470 /// This intrinsic corresponds to the <c> VCMPLEPD / CMPLEPD </c> instruction.
473 /// A 128-bit vector of [2 x double].
475 /// A 128-bit vector of [2 x double].
476 /// \returns A 128-bit vector containing the comparison results.
477 static __inline__ __m128d __DEFAULT_FN_ATTRS
478 _mm_cmple_pd(__m128d __a, __m128d __b)
480 return (__m128d)__builtin_ia32_cmplepd((__v2df)__a, (__v2df)__b);
483 /// Compares each of the corresponding double-precision values of the
484 /// 128-bit vectors of [2 x double] to determine if the values in the first
485 /// operand are greater than those in the second operand.
487 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
489 /// \headerfile <x86intrin.h>
491 /// This intrinsic corresponds to the <c> VCMPLTPD / CMPLTPD </c> instruction.
494 /// A 128-bit vector of [2 x double].
496 /// A 128-bit vector of [2 x double].
497 /// \returns A 128-bit vector containing the comparison results.
498 static __inline__ __m128d __DEFAULT_FN_ATTRS
499 _mm_cmpgt_pd(__m128d __a, __m128d __b)
501 return (__m128d)__builtin_ia32_cmpltpd((__v2df)__b, (__v2df)__a);
504 /// Compares each of the corresponding double-precision values of the
505 /// 128-bit vectors of [2 x double] to determine if the values in the first
506 /// operand are greater than or equal to those in the second operand.
508 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
510 /// \headerfile <x86intrin.h>
512 /// This intrinsic corresponds to the <c> VCMPLEPD / CMPLEPD </c> instruction.
515 /// A 128-bit vector of [2 x double].
517 /// A 128-bit vector of [2 x double].
518 /// \returns A 128-bit vector containing the comparison results.
519 static __inline__ __m128d __DEFAULT_FN_ATTRS
520 _mm_cmpge_pd(__m128d __a, __m128d __b)
522 return (__m128d)__builtin_ia32_cmplepd((__v2df)__b, (__v2df)__a);
525 /// Compares each of the corresponding double-precision values of the
526 /// 128-bit vectors of [2 x double] to determine if the values in the first
527 /// operand are ordered with respect to those in the second operand.
529 /// A pair of double-precision values are "ordered" with respect to each
530 /// other if neither value is a NaN. Each comparison yields 0x0 for false,
531 /// 0xFFFFFFFFFFFFFFFF for true.
533 /// \headerfile <x86intrin.h>
535 /// This intrinsic corresponds to the <c> VCMPORDPD / CMPORDPD </c> instruction.
538 /// A 128-bit vector of [2 x double].
540 /// A 128-bit vector of [2 x double].
541 /// \returns A 128-bit vector containing the comparison results.
542 static __inline__ __m128d __DEFAULT_FN_ATTRS
543 _mm_cmpord_pd(__m128d __a, __m128d __b)
545 return (__m128d)__builtin_ia32_cmpordpd((__v2df)__a, (__v2df)__b);
548 /// Compares each of the corresponding double-precision values of the
549 /// 128-bit vectors of [2 x double] to determine if the values in the first
550 /// operand are unordered with respect to those in the second operand.
552 /// A pair of double-precision values are "unordered" with respect to each
553 /// other if one or both values are NaN. Each comparison yields 0x0 for
554 /// false, 0xFFFFFFFFFFFFFFFF for true.
556 /// \headerfile <x86intrin.h>
558 /// This intrinsic corresponds to the <c> VCMPUNORDPD / CMPUNORDPD </c>
562 /// A 128-bit vector of [2 x double].
564 /// A 128-bit vector of [2 x double].
565 /// \returns A 128-bit vector containing the comparison results.
566 static __inline__ __m128d __DEFAULT_FN_ATTRS
567 _mm_cmpunord_pd(__m128d __a, __m128d __b)
569 return (__m128d)__builtin_ia32_cmpunordpd((__v2df)__a, (__v2df)__b);
572 /// Compares each of the corresponding double-precision values of the
573 /// 128-bit vectors of [2 x double] to determine if the values in the first
574 /// operand are unequal to those in the second operand.
576 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
578 /// \headerfile <x86intrin.h>
580 /// This intrinsic corresponds to the <c> VCMPNEQPD / CMPNEQPD </c> instruction.
583 /// A 128-bit vector of [2 x double].
585 /// A 128-bit vector of [2 x double].
586 /// \returns A 128-bit vector containing the comparison results.
587 static __inline__ __m128d __DEFAULT_FN_ATTRS
588 _mm_cmpneq_pd(__m128d __a, __m128d __b)
590 return (__m128d)__builtin_ia32_cmpneqpd((__v2df)__a, (__v2df)__b);
593 /// Compares each of the corresponding double-precision values of the
594 /// 128-bit vectors of [2 x double] to determine if the values in the first
595 /// operand are not less than those in the second operand.
597 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
599 /// \headerfile <x86intrin.h>
601 /// This intrinsic corresponds to the <c> VCMPNLTPD / CMPNLTPD </c> instruction.
604 /// A 128-bit vector of [2 x double].
606 /// A 128-bit vector of [2 x double].
607 /// \returns A 128-bit vector containing the comparison results.
608 static __inline__ __m128d __DEFAULT_FN_ATTRS
609 _mm_cmpnlt_pd(__m128d __a, __m128d __b)
611 return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__a, (__v2df)__b);
614 /// Compares each of the corresponding double-precision values of the
615 /// 128-bit vectors of [2 x double] to determine if the values in the first
616 /// operand are not less than or equal to those in the second operand.
618 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
620 /// \headerfile <x86intrin.h>
622 /// This intrinsic corresponds to the <c> VCMPNLEPD / CMPNLEPD </c> instruction.
625 /// A 128-bit vector of [2 x double].
627 /// A 128-bit vector of [2 x double].
628 /// \returns A 128-bit vector containing the comparison results.
629 static __inline__ __m128d __DEFAULT_FN_ATTRS
630 _mm_cmpnle_pd(__m128d __a, __m128d __b)
632 return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__a, (__v2df)__b);
635 /// Compares each of the corresponding double-precision values of the
636 /// 128-bit vectors of [2 x double] to determine if the values in the first
637 /// operand are not greater than those in the second operand.
639 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
641 /// \headerfile <x86intrin.h>
643 /// This intrinsic corresponds to the <c> VCMPNLTPD / CMPNLTPD </c> instruction.
646 /// A 128-bit vector of [2 x double].
648 /// A 128-bit vector of [2 x double].
649 /// \returns A 128-bit vector containing the comparison results.
650 static __inline__ __m128d __DEFAULT_FN_ATTRS
651 _mm_cmpngt_pd(__m128d __a, __m128d __b)
653 return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__b, (__v2df)__a);
656 /// Compares each of the corresponding double-precision values of the
657 /// 128-bit vectors of [2 x double] to determine if the values in the first
658 /// operand are not greater than or equal to those in the second operand.
660 /// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
662 /// \headerfile <x86intrin.h>
664 /// This intrinsic corresponds to the <c> VCMPNLEPD / CMPNLEPD </c> instruction.
667 /// A 128-bit vector of [2 x double].
669 /// A 128-bit vector of [2 x double].
670 /// \returns A 128-bit vector containing the comparison results.
671 static __inline__ __m128d __DEFAULT_FN_ATTRS
672 _mm_cmpnge_pd(__m128d __a, __m128d __b)
674 return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__b, (__v2df)__a);
677 /// Compares the lower double-precision floating-point values in each of
678 /// the two 128-bit floating-point vectors of [2 x double] for equality.
680 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
682 /// \headerfile <x86intrin.h>
684 /// This intrinsic corresponds to the <c> VCMPEQSD / CMPEQSD </c> instruction.
687 /// A 128-bit vector of [2 x double]. The lower double-precision value is
688 /// compared to the lower double-precision value of \a __b.
690 /// A 128-bit vector of [2 x double]. The lower double-precision value is
691 /// compared to the lower double-precision value of \a __a.
692 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
693 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
694 static __inline__ __m128d __DEFAULT_FN_ATTRS
695 _mm_cmpeq_sd(__m128d __a, __m128d __b)
697 return (__m128d)__builtin_ia32_cmpeqsd((__v2df)__a, (__v2df)__b);
700 /// Compares the lower double-precision floating-point values in each of
701 /// the two 128-bit floating-point vectors of [2 x double] to determine if
702 /// the value in the first parameter is less than the corresponding value in
703 /// the second parameter.
705 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
707 /// \headerfile <x86intrin.h>
709 /// This intrinsic corresponds to the <c> VCMPLTSD / CMPLTSD </c> instruction.
712 /// A 128-bit vector of [2 x double]. The lower double-precision value is
713 /// compared to the lower double-precision value of \a __b.
715 /// A 128-bit vector of [2 x double]. The lower double-precision value is
716 /// compared to the lower double-precision value of \a __a.
717 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
718 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
719 static __inline__ __m128d __DEFAULT_FN_ATTRS
720 _mm_cmplt_sd(__m128d __a, __m128d __b)
722 return (__m128d)__builtin_ia32_cmpltsd((__v2df)__a, (__v2df)__b);
725 /// Compares the lower double-precision floating-point values in each of
726 /// the two 128-bit floating-point vectors of [2 x double] to determine if
727 /// the value in the first parameter is less than or equal to the
728 /// corresponding value in the second parameter.
730 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
732 /// \headerfile <x86intrin.h>
734 /// This intrinsic corresponds to the <c> VCMPLESD / CMPLESD </c> instruction.
737 /// A 128-bit vector of [2 x double]. The lower double-precision value is
738 /// compared to the lower double-precision value of \a __b.
740 /// A 128-bit vector of [2 x double]. The lower double-precision value is
741 /// compared to the lower double-precision value of \a __a.
742 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
743 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
744 static __inline__ __m128d __DEFAULT_FN_ATTRS
745 _mm_cmple_sd(__m128d __a, __m128d __b)
747 return (__m128d)__builtin_ia32_cmplesd((__v2df)__a, (__v2df)__b);
750 /// Compares the lower double-precision floating-point values in each of
751 /// the two 128-bit floating-point vectors of [2 x double] to determine if
752 /// the value in the first parameter is greater than the corresponding value
753 /// in the second parameter.
755 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
757 /// \headerfile <x86intrin.h>
759 /// This intrinsic corresponds to the <c> VCMPLTSD / CMPLTSD </c> instruction.
762 /// A 128-bit vector of [2 x double]. The lower double-precision value is
763 /// compared to the lower double-precision value of \a __b.
765 /// A 128-bit vector of [2 x double]. The lower double-precision value is
766 /// compared to the lower double-precision value of \a __a.
767 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
768 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
769 static __inline__ __m128d __DEFAULT_FN_ATTRS
770 _mm_cmpgt_sd(__m128d __a, __m128d __b)
772 __m128d __c = __builtin_ia32_cmpltsd((__v2df)__b, (__v2df)__a);
773 return __extension__ (__m128d) { __c[0], __a[1] };
776 /// Compares the lower double-precision floating-point values in each of
777 /// the two 128-bit floating-point vectors of [2 x double] to determine if
778 /// the value in the first parameter is greater than or equal to the
779 /// corresponding value in the second parameter.
781 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
783 /// \headerfile <x86intrin.h>
785 /// This intrinsic corresponds to the <c> VCMPLESD / CMPLESD </c> instruction.
788 /// A 128-bit vector of [2 x double]. The lower double-precision value is
789 /// compared to the lower double-precision value of \a __b.
791 /// A 128-bit vector of [2 x double]. The lower double-precision value is
792 /// compared to the lower double-precision value of \a __a.
793 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
794 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
795 static __inline__ __m128d __DEFAULT_FN_ATTRS
796 _mm_cmpge_sd(__m128d __a, __m128d __b)
798 __m128d __c = __builtin_ia32_cmplesd((__v2df)__b, (__v2df)__a);
799 return __extension__ (__m128d) { __c[0], __a[1] };
802 /// Compares the lower double-precision floating-point values in each of
803 /// the two 128-bit floating-point vectors of [2 x double] to determine if
804 /// the value in the first parameter is "ordered" with respect to the
805 /// corresponding value in the second parameter.
807 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true. A pair
808 /// of double-precision values are "ordered" with respect to each other if
809 /// neither value is a NaN.
811 /// \headerfile <x86intrin.h>
813 /// This intrinsic corresponds to the <c> VCMPORDSD / CMPORDSD </c> instruction.
816 /// A 128-bit vector of [2 x double]. The lower double-precision value is
817 /// compared to the lower double-precision value of \a __b.
819 /// A 128-bit vector of [2 x double]. The lower double-precision value is
820 /// compared to the lower double-precision value of \a __a.
821 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
822 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
823 static __inline__ __m128d __DEFAULT_FN_ATTRS
824 _mm_cmpord_sd(__m128d __a, __m128d __b)
826 return (__m128d)__builtin_ia32_cmpordsd((__v2df)__a, (__v2df)__b);
829 /// Compares the lower double-precision floating-point values in each of
830 /// the two 128-bit floating-point vectors of [2 x double] to determine if
831 /// the value in the first parameter is "unordered" with respect to the
832 /// corresponding value in the second parameter.
834 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true. A pair
835 /// of double-precision values are "unordered" with respect to each other if
836 /// one or both values are NaN.
838 /// \headerfile <x86intrin.h>
840 /// This intrinsic corresponds to the <c> VCMPUNORDSD / CMPUNORDSD </c>
844 /// A 128-bit vector of [2 x double]. The lower double-precision value is
845 /// compared to the lower double-precision value of \a __b.
847 /// A 128-bit vector of [2 x double]. The lower double-precision value is
848 /// compared to the lower double-precision value of \a __a.
849 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
850 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
851 static __inline__ __m128d __DEFAULT_FN_ATTRS
852 _mm_cmpunord_sd(__m128d __a, __m128d __b)
854 return (__m128d)__builtin_ia32_cmpunordsd((__v2df)__a, (__v2df)__b);
857 /// Compares the lower double-precision floating-point values in each of
858 /// the two 128-bit floating-point vectors of [2 x double] to determine if
859 /// the value in the first parameter is unequal to the corresponding value in
860 /// the second parameter.
862 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
864 /// \headerfile <x86intrin.h>
866 /// This intrinsic corresponds to the <c> VCMPNEQSD / CMPNEQSD </c> instruction.
869 /// A 128-bit vector of [2 x double]. The lower double-precision value is
870 /// compared to the lower double-precision value of \a __b.
872 /// A 128-bit vector of [2 x double]. The lower double-precision value is
873 /// compared to the lower double-precision value of \a __a.
874 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
875 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
876 static __inline__ __m128d __DEFAULT_FN_ATTRS
877 _mm_cmpneq_sd(__m128d __a, __m128d __b)
879 return (__m128d)__builtin_ia32_cmpneqsd((__v2df)__a, (__v2df)__b);
882 /// Compares the lower double-precision floating-point values in each of
883 /// the two 128-bit floating-point vectors of [2 x double] to determine if
884 /// the value in the first parameter is not less than the corresponding
885 /// value in the second parameter.
887 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
889 /// \headerfile <x86intrin.h>
891 /// This intrinsic corresponds to the <c> VCMPNLTSD / CMPNLTSD </c> instruction.
894 /// A 128-bit vector of [2 x double]. The lower double-precision value is
895 /// compared to the lower double-precision value of \a __b.
897 /// A 128-bit vector of [2 x double]. The lower double-precision value is
898 /// compared to the lower double-precision value of \a __a.
899 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
900 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
901 static __inline__ __m128d __DEFAULT_FN_ATTRS
902 _mm_cmpnlt_sd(__m128d __a, __m128d __b)
904 return (__m128d)__builtin_ia32_cmpnltsd((__v2df)__a, (__v2df)__b);
907 /// Compares the lower double-precision floating-point values in each of
908 /// the two 128-bit floating-point vectors of [2 x double] to determine if
909 /// the value in the first parameter is not less than or equal to the
910 /// corresponding value in the second parameter.
912 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
914 /// \headerfile <x86intrin.h>
916 /// This intrinsic corresponds to the <c> VCMPNLESD / CMPNLESD </c> instruction.
919 /// A 128-bit vector of [2 x double]. The lower double-precision value is
920 /// compared to the lower double-precision value of \a __b.
922 /// A 128-bit vector of [2 x double]. The lower double-precision value is
923 /// compared to the lower double-precision value of \a __a.
924 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
925 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
926 static __inline__ __m128d __DEFAULT_FN_ATTRS
927 _mm_cmpnle_sd(__m128d __a, __m128d __b)
929 return (__m128d)__builtin_ia32_cmpnlesd((__v2df)__a, (__v2df)__b);
932 /// Compares the lower double-precision floating-point values in each of
933 /// the two 128-bit floating-point vectors of [2 x double] to determine if
934 /// the value in the first parameter is not greater than the corresponding
935 /// value in the second parameter.
937 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
939 /// \headerfile <x86intrin.h>
941 /// This intrinsic corresponds to the <c> VCMPNLTSD / CMPNLTSD </c> instruction.
944 /// A 128-bit vector of [2 x double]. The lower double-precision value is
945 /// compared to the lower double-precision value of \a __b.
947 /// A 128-bit vector of [2 x double]. The lower double-precision value is
948 /// compared to the lower double-precision value of \a __a.
949 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
950 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
951 static __inline__ __m128d __DEFAULT_FN_ATTRS
952 _mm_cmpngt_sd(__m128d __a, __m128d __b)
954 __m128d __c = __builtin_ia32_cmpnltsd((__v2df)__b, (__v2df)__a);
955 return __extension__ (__m128d) { __c[0], __a[1] };
958 /// Compares the lower double-precision floating-point values in each of
959 /// the two 128-bit floating-point vectors of [2 x double] to determine if
960 /// the value in the first parameter is not greater than or equal to the
961 /// corresponding value in the second parameter.
963 /// The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
965 /// \headerfile <x86intrin.h>
967 /// This intrinsic corresponds to the <c> VCMPNLESD / CMPNLESD </c> instruction.
970 /// A 128-bit vector of [2 x double]. The lower double-precision value is
971 /// compared to the lower double-precision value of \a __b.
973 /// A 128-bit vector of [2 x double]. The lower double-precision value is
974 /// compared to the lower double-precision value of \a __a.
975 /// \returns A 128-bit vector. The lower 64 bits contains the comparison
976 /// results. The upper 64 bits are copied from the upper 64 bits of \a __a.
977 static __inline__ __m128d __DEFAULT_FN_ATTRS
978 _mm_cmpnge_sd(__m128d __a, __m128d __b)
980 __m128d __c = __builtin_ia32_cmpnlesd((__v2df)__b, (__v2df)__a);
981 return __extension__ (__m128d) { __c[0], __a[1] };
984 /// Compares the lower double-precision floating-point values in each of
985 /// the two 128-bit floating-point vectors of [2 x double] for equality.
987 /// The comparison yields 0 for false, 1 for true. If either of the two
988 /// lower double-precision values is NaN, 0 is returned.
990 /// \headerfile <x86intrin.h>
992 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
995 /// A 128-bit vector of [2 x double]. The lower double-precision value is
996 /// compared to the lower double-precision value of \a __b.
998 /// A 128-bit vector of [2 x double]. The lower double-precision value is
999 /// compared to the lower double-precision value of \a __a.
1000 /// \returns An integer containing the comparison results. If either of the two
1001 /// lower double-precision values is NaN, 0 is returned.
1002 static __inline__ int __DEFAULT_FN_ATTRS
1003 _mm_comieq_sd(__m128d __a, __m128d __b)
1005 return __builtin_ia32_comisdeq((__v2df)__a, (__v2df)__b);
1008 /// Compares the lower double-precision floating-point values in each of
1009 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1010 /// the value in the first parameter is less than the corresponding value in
1011 /// the second parameter.
1013 /// The comparison yields 0 for false, 1 for true. If either of the two
1014 /// lower double-precision values is NaN, 0 is returned.
1016 /// \headerfile <x86intrin.h>
1018 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1021 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1022 /// compared to the lower double-precision value of \a __b.
1024 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1025 /// compared to the lower double-precision value of \a __a.
1026 /// \returns An integer containing the comparison results. If either of the two
1027 /// lower double-precision values is NaN, 0 is returned.
1028 static __inline__ int __DEFAULT_FN_ATTRS
1029 _mm_comilt_sd(__m128d __a, __m128d __b)
1031 return __builtin_ia32_comisdlt((__v2df)__a, (__v2df)__b);
1034 /// Compares the lower double-precision floating-point values in each of
1035 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1036 /// the value in the first parameter is less than or equal to the
1037 /// corresponding value in the second parameter.
1039 /// The comparison yields 0 for false, 1 for true. If either of the two
1040 /// lower double-precision values is NaN, 0 is returned.
1042 /// \headerfile <x86intrin.h>
1044 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1047 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1048 /// compared to the lower double-precision value of \a __b.
1050 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1051 /// compared to the lower double-precision value of \a __a.
1052 /// \returns An integer containing the comparison results. If either of the two
1053 /// lower double-precision values is NaN, 0 is returned.
1054 static __inline__ int __DEFAULT_FN_ATTRS
1055 _mm_comile_sd(__m128d __a, __m128d __b)
1057 return __builtin_ia32_comisdle((__v2df)__a, (__v2df)__b);
1060 /// Compares the lower double-precision floating-point values in each of
1061 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1062 /// the value in the first parameter is greater than the corresponding value
1063 /// in the second parameter.
1065 /// The comparison yields 0 for false, 1 for true. If either of the two
1066 /// lower double-precision values is NaN, 0 is returned.
1068 /// \headerfile <x86intrin.h>
1070 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1073 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1074 /// compared to the lower double-precision value of \a __b.
1076 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1077 /// compared to the lower double-precision value of \a __a.
1078 /// \returns An integer containing the comparison results. If either of the two
1079 /// lower double-precision values is NaN, 0 is returned.
1080 static __inline__ int __DEFAULT_FN_ATTRS
1081 _mm_comigt_sd(__m128d __a, __m128d __b)
1083 return __builtin_ia32_comisdgt((__v2df)__a, (__v2df)__b);
1086 /// Compares the lower double-precision floating-point values in each of
1087 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1088 /// the value in the first parameter is greater than or equal to the
1089 /// corresponding value in the second parameter.
1091 /// The comparison yields 0 for false, 1 for true. If either of the two
1092 /// lower double-precision values is NaN, 0 is returned.
1094 /// \headerfile <x86intrin.h>
1096 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1099 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1100 /// compared to the lower double-precision value of \a __b.
1102 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1103 /// compared to the lower double-precision value of \a __a.
1104 /// \returns An integer containing the comparison results. If either of the two
1105 /// lower double-precision values is NaN, 0 is returned.
1106 static __inline__ int __DEFAULT_FN_ATTRS
1107 _mm_comige_sd(__m128d __a, __m128d __b)
1109 return __builtin_ia32_comisdge((__v2df)__a, (__v2df)__b);
1112 /// Compares the lower double-precision floating-point values in each of
1113 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1114 /// the value in the first parameter is unequal to the corresponding value in
1115 /// the second parameter.
1117 /// The comparison yields 0 for false, 1 for true. If either of the two
1118 /// lower double-precision values is NaN, 1 is returned.
1120 /// \headerfile <x86intrin.h>
1122 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1125 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1126 /// compared to the lower double-precision value of \a __b.
1128 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1129 /// compared to the lower double-precision value of \a __a.
1130 /// \returns An integer containing the comparison results. If either of the two
1131 /// lower double-precision values is NaN, 1 is returned.
1132 static __inline__ int __DEFAULT_FN_ATTRS
1133 _mm_comineq_sd(__m128d __a, __m128d __b)
1135 return __builtin_ia32_comisdneq((__v2df)__a, (__v2df)__b);
1138 /// Compares the lower double-precision floating-point values in each of
1139 /// the two 128-bit floating-point vectors of [2 x double] for equality. The
1140 /// comparison yields 0 for false, 1 for true.
1142 /// If either of the two lower double-precision values is NaN, 0 is returned.
1144 /// \headerfile <x86intrin.h>
1146 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1149 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1150 /// compared to the lower double-precision value of \a __b.
1152 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1153 /// compared to the lower double-precision value of \a __a.
1154 /// \returns An integer containing the comparison results. If either of the two
1155 /// lower double-precision values is NaN, 0 is returned.
1156 static __inline__ int __DEFAULT_FN_ATTRS
1157 _mm_ucomieq_sd(__m128d __a, __m128d __b)
1159 return __builtin_ia32_ucomisdeq((__v2df)__a, (__v2df)__b);
1162 /// Compares the lower double-precision floating-point values in each of
1163 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1164 /// the value in the first parameter is less than the corresponding value in
1165 /// the second parameter.
1167 /// The comparison yields 0 for false, 1 for true. If either of the two lower
1168 /// double-precision values is NaN, 0 is returned.
1170 /// \headerfile <x86intrin.h>
1172 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1175 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1176 /// compared to the lower double-precision value of \a __b.
1178 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1179 /// compared to the lower double-precision value of \a __a.
1180 /// \returns An integer containing the comparison results. If either of the two
1181 /// lower double-precision values is NaN, 0 is returned.
1182 static __inline__ int __DEFAULT_FN_ATTRS
1183 _mm_ucomilt_sd(__m128d __a, __m128d __b)
1185 return __builtin_ia32_ucomisdlt((__v2df)__a, (__v2df)__b);
1188 /// Compares the lower double-precision floating-point values in each of
1189 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1190 /// the value in the first parameter is less than or equal to the
1191 /// corresponding value in the second parameter.
1193 /// The comparison yields 0 for false, 1 for true. If either of the two lower
1194 /// double-precision values is NaN, 0 is returned.
1196 /// \headerfile <x86intrin.h>
1198 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1201 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1202 /// compared to the lower double-precision value of \a __b.
1204 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1205 /// compared to the lower double-precision value of \a __a.
1206 /// \returns An integer containing the comparison results. If either of the two
1207 /// lower double-precision values is NaN, 0 is returned.
1208 static __inline__ int __DEFAULT_FN_ATTRS
1209 _mm_ucomile_sd(__m128d __a, __m128d __b)
1211 return __builtin_ia32_ucomisdle((__v2df)__a, (__v2df)__b);
1214 /// Compares the lower double-precision floating-point values in each of
1215 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1216 /// the value in the first parameter is greater than the corresponding value
1217 /// in the second parameter.
1219 /// The comparison yields 0 for false, 1 for true. If either of the two lower
1220 /// double-precision values is NaN, 0 is returned.
1222 /// \headerfile <x86intrin.h>
1224 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1227 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1228 /// compared to the lower double-precision value of \a __b.
1230 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1231 /// compared to the lower double-precision value of \a __a.
1232 /// \returns An integer containing the comparison results. If either of the two
1233 /// lower double-precision values is NaN, 0 is returned.
1234 static __inline__ int __DEFAULT_FN_ATTRS
1235 _mm_ucomigt_sd(__m128d __a, __m128d __b)
1237 return __builtin_ia32_ucomisdgt((__v2df)__a, (__v2df)__b);
1240 /// Compares the lower double-precision floating-point values in each of
1241 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1242 /// the value in the first parameter is greater than or equal to the
1243 /// corresponding value in the second parameter.
1245 /// The comparison yields 0 for false, 1 for true. If either of the two
1246 /// lower double-precision values is NaN, 0 is returned.
1248 /// \headerfile <x86intrin.h>
1250 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1253 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1254 /// compared to the lower double-precision value of \a __b.
1256 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1257 /// compared to the lower double-precision value of \a __a.
1258 /// \returns An integer containing the comparison results. If either of the two
1259 /// lower double-precision values is NaN, 0 is returned.
1260 static __inline__ int __DEFAULT_FN_ATTRS
1261 _mm_ucomige_sd(__m128d __a, __m128d __b)
1263 return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b);
1266 /// Compares the lower double-precision floating-point values in each of
1267 /// the two 128-bit floating-point vectors of [2 x double] to determine if
1268 /// the value in the first parameter is unequal to the corresponding value in
1269 /// the second parameter.
1271 /// The comparison yields 0 for false, 1 for true. If either of the two lower
1272 /// double-precision values is NaN, 1 is returned.
1274 /// \headerfile <x86intrin.h>
1276 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1279 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1280 /// compared to the lower double-precision value of \a __b.
1282 /// A 128-bit vector of [2 x double]. The lower double-precision value is
1283 /// compared to the lower double-precision value of \a __a.
1284 /// \returns An integer containing the comparison result. If either of the two
1285 /// lower double-precision values is NaN, 1 is returned.
1286 static __inline__ int __DEFAULT_FN_ATTRS
1287 _mm_ucomineq_sd(__m128d __a, __m128d __b)
1289 return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b);
1292 /// Converts the two double-precision floating-point elements of a
1293 /// 128-bit vector of [2 x double] into two single-precision floating-point
1294 /// values, returned in the lower 64 bits of a 128-bit vector of [4 x float].
1295 /// The upper 64 bits of the result vector are set to zero.
1297 /// \headerfile <x86intrin.h>
1299 /// This intrinsic corresponds to the <c> VCVTPD2PS / CVTPD2PS </c> instruction.
1302 /// A 128-bit vector of [2 x double].
1303 /// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
1304 /// converted values. The upper 64 bits are set to zero.
1305 static __inline__ __m128 __DEFAULT_FN_ATTRS
1306 _mm_cvtpd_ps(__m128d __a)
1308 return __builtin_ia32_cvtpd2ps((__v2df)__a);
1311 /// Converts the lower two single-precision floating-point elements of a
1312 /// 128-bit vector of [4 x float] into two double-precision floating-point
1313 /// values, returned in a 128-bit vector of [2 x double]. The upper two
1314 /// elements of the input vector are unused.
1316 /// \headerfile <x86intrin.h>
1318 /// This intrinsic corresponds to the <c> VCVTPS2PD / CVTPS2PD </c> instruction.
1321 /// A 128-bit vector of [4 x float]. The lower two single-precision
1322 /// floating-point elements are converted to double-precision values. The
1323 /// upper two elements are unused.
1324 /// \returns A 128-bit vector of [2 x double] containing the converted values.
1325 static __inline__ __m128d __DEFAULT_FN_ATTRS
1326 _mm_cvtps_pd(__m128 __a)
1328 return (__m128d) __builtin_convertvector(
1329 __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1), __v2df);
1332 /// Converts the lower two integer elements of a 128-bit vector of
1333 /// [4 x i32] into two double-precision floating-point values, returned in a
1334 /// 128-bit vector of [2 x double].
1336 /// The upper two elements of the input vector are unused.
1338 /// \headerfile <x86intrin.h>
1340 /// This intrinsic corresponds to the <c> VCVTDQ2PD / CVTDQ2PD </c> instruction.
1343 /// A 128-bit integer vector of [4 x i32]. The lower two integer elements are
1344 /// converted to double-precision values.
1346 /// The upper two elements are unused.
1347 /// \returns A 128-bit vector of [2 x double] containing the converted values.
1348 static __inline__ __m128d __DEFAULT_FN_ATTRS
1349 _mm_cvtepi32_pd(__m128i __a)
1351 return (__m128d) __builtin_convertvector(
1352 __builtin_shufflevector((__v4si)__a, (__v4si)__a, 0, 1), __v2df);
1355 /// Converts the two double-precision floating-point elements of a
1356 /// 128-bit vector of [2 x double] into two signed 32-bit integer values,
1357 /// returned in the lower 64 bits of a 128-bit vector of [4 x i32]. The upper
1358 /// 64 bits of the result vector are set to zero.
1360 /// \headerfile <x86intrin.h>
1362 /// This intrinsic corresponds to the <c> VCVTPD2DQ / CVTPD2DQ </c> instruction.
1365 /// A 128-bit vector of [2 x double].
1366 /// \returns A 128-bit vector of [4 x i32] whose lower 64 bits contain the
1367 /// converted values. The upper 64 bits are set to zero.
1368 static __inline__ __m128i __DEFAULT_FN_ATTRS
1369 _mm_cvtpd_epi32(__m128d __a)
1371 return __builtin_ia32_cvtpd2dq((__v2df)__a);
1374 /// Converts the low-order element of a 128-bit vector of [2 x double]
1375 /// into a 32-bit signed integer value.
1377 /// \headerfile <x86intrin.h>
1379 /// This intrinsic corresponds to the <c> VCVTSD2SI / CVTSD2SI </c> instruction.
1382 /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the
1384 /// \returns A 32-bit signed integer containing the converted value.
1385 static __inline__ int __DEFAULT_FN_ATTRS
1386 _mm_cvtsd_si32(__m128d __a)
1388 return __builtin_ia32_cvtsd2si((__v2df)__a);
1391 /// Converts the lower double-precision floating-point element of a
1392 /// 128-bit vector of [2 x double], in the second parameter, into a
1393 /// single-precision floating-point value, returned in the lower 32 bits of a
1394 /// 128-bit vector of [4 x float]. The upper 96 bits of the result vector are
1395 /// copied from the upper 96 bits of the first parameter.
1397 /// \headerfile <x86intrin.h>
1399 /// This intrinsic corresponds to the <c> VCVTSD2SS / CVTSD2SS </c> instruction.
1402 /// A 128-bit vector of [4 x float]. The upper 96 bits of this parameter are
1403 /// copied to the upper 96 bits of the result.
1405 /// A 128-bit vector of [2 x double]. The lower double-precision
1406 /// floating-point element is used in the conversion.
1407 /// \returns A 128-bit vector of [4 x float]. The lower 32 bits contain the
1408 /// converted value from the second parameter. The upper 96 bits are copied
1409 /// from the upper 96 bits of the first parameter.
1410 static __inline__ __m128 __DEFAULT_FN_ATTRS
1411 _mm_cvtsd_ss(__m128 __a, __m128d __b)
1413 return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__a, (__v2df)__b);
1416 /// Converts a 32-bit signed integer value, in the second parameter, into
1417 /// a double-precision floating-point value, returned in the lower 64 bits of
1418 /// a 128-bit vector of [2 x double]. The upper 64 bits of the result vector
1419 /// are copied from the upper 64 bits of the first parameter.
1421 /// \headerfile <x86intrin.h>
1423 /// This intrinsic corresponds to the <c> VCVTSI2SD / CVTSI2SD </c> instruction.
1426 /// A 128-bit vector of [2 x double]. The upper 64 bits of this parameter are
1427 /// copied to the upper 64 bits of the result.
1429 /// A 32-bit signed integer containing the value to be converted.
1430 /// \returns A 128-bit vector of [2 x double]. The lower 64 bits contain the
1431 /// converted value from the second parameter. The upper 64 bits are copied
1432 /// from the upper 64 bits of the first parameter.
1433 static __inline__ __m128d __DEFAULT_FN_ATTRS
1434 _mm_cvtsi32_sd(__m128d __a, int __b)
1440 /// Converts the lower single-precision floating-point element of a
1441 /// 128-bit vector of [4 x float], in the second parameter, into a
1442 /// double-precision floating-point value, returned in the lower 64 bits of
1443 /// a 128-bit vector of [2 x double]. The upper 64 bits of the result vector
1444 /// are copied from the upper 64 bits of the first parameter.
1446 /// \headerfile <x86intrin.h>
1448 /// This intrinsic corresponds to the <c> VCVTSS2SD / CVTSS2SD </c> instruction.
1451 /// A 128-bit vector of [2 x double]. The upper 64 bits of this parameter are
1452 /// copied to the upper 64 bits of the result.
1454 /// A 128-bit vector of [4 x float]. The lower single-precision
1455 /// floating-point element is used in the conversion.
1456 /// \returns A 128-bit vector of [2 x double]. The lower 64 bits contain the
1457 /// converted value from the second parameter. The upper 64 bits are copied
1458 /// from the upper 64 bits of the first parameter.
1459 static __inline__ __m128d __DEFAULT_FN_ATTRS
1460 _mm_cvtss_sd(__m128d __a, __m128 __b)
1466 /// Converts the two double-precision floating-point elements of a
1467 /// 128-bit vector of [2 x double] into two signed 32-bit integer values,
1468 /// returned in the lower 64 bits of a 128-bit vector of [4 x i32].
1470 /// If the result of either conversion is inexact, the result is truncated
1471 /// (rounded towards zero) regardless of the current MXCSR setting. The upper
1472 /// 64 bits of the result vector are set to zero.
1474 /// \headerfile <x86intrin.h>
1476 /// This intrinsic corresponds to the <c> VCVTTPD2DQ / CVTTPD2DQ </c>
1480 /// A 128-bit vector of [2 x double].
1481 /// \returns A 128-bit vector of [4 x i32] whose lower 64 bits contain the
1482 /// converted values. The upper 64 bits are set to zero.
1483 static __inline__ __m128i __DEFAULT_FN_ATTRS
1484 _mm_cvttpd_epi32(__m128d __a)
1486 return (__m128i)__builtin_ia32_cvttpd2dq((__v2df)__a);
1489 /// Converts the low-order element of a [2 x double] vector into a 32-bit
1490 /// signed integer value, truncating the result when it is inexact.
1492 /// \headerfile <x86intrin.h>
1494 /// This intrinsic corresponds to the <c> VCVTTSD2SI / CVTTSD2SI </c>
1498 /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the
1500 /// \returns A 32-bit signed integer containing the converted value.
1501 static __inline__ int __DEFAULT_FN_ATTRS
1502 _mm_cvttsd_si32(__m128d __a)
1504 return __builtin_ia32_cvttsd2si((__v2df)__a);
1507 /// Converts the two double-precision floating-point elements of a
1508 /// 128-bit vector of [2 x double] into two signed 32-bit integer values,
1509 /// returned in a 64-bit vector of [2 x i32].
1511 /// \headerfile <x86intrin.h>
1513 /// This intrinsic corresponds to the <c> CVTPD2PI </c> instruction.
1516 /// A 128-bit vector of [2 x double].
1517 /// \returns A 64-bit vector of [2 x i32] containing the converted values.
1518 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
1519 _mm_cvtpd_pi32(__m128d __a)
1521 return (__m64)__builtin_ia32_cvtpd2pi((__v2df)__a);
1524 /// Converts the two double-precision floating-point elements of a
1525 /// 128-bit vector of [2 x double] into two signed 32-bit integer values,
1526 /// returned in a 64-bit vector of [2 x i32].
1528 /// If the result of either conversion is inexact, the result is truncated
1529 /// (rounded towards zero) regardless of the current MXCSR setting.
1531 /// \headerfile <x86intrin.h>
1533 /// This intrinsic corresponds to the <c> CVTTPD2PI </c> instruction.
1536 /// A 128-bit vector of [2 x double].
1537 /// \returns A 64-bit vector of [2 x i32] containing the converted values.
1538 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
1539 _mm_cvttpd_pi32(__m128d __a)
1541 return (__m64)__builtin_ia32_cvttpd2pi((__v2df)__a);
1544 /// Converts the two signed 32-bit integer elements of a 64-bit vector of
1545 /// [2 x i32] into two double-precision floating-point values, returned in a
1546 /// 128-bit vector of [2 x double].
1548 /// \headerfile <x86intrin.h>
1550 /// This intrinsic corresponds to the <c> CVTPI2PD </c> instruction.
1553 /// A 64-bit vector of [2 x i32].
1554 /// \returns A 128-bit vector of [2 x double] containing the converted values.
1555 static __inline__ __m128d __DEFAULT_FN_ATTRS_MMX
1556 _mm_cvtpi32_pd(__m64 __a)
1558 return __builtin_ia32_cvtpi2pd((__v2si)__a);
1561 /// Returns the low-order element of a 128-bit vector of [2 x double] as
1562 /// a double-precision floating-point value.
1564 /// \headerfile <x86intrin.h>
1566 /// This intrinsic has no corresponding instruction.
1569 /// A 128-bit vector of [2 x double]. The lower 64 bits are returned.
1570 /// \returns A double-precision floating-point value copied from the lower 64
1572 static __inline__ double __DEFAULT_FN_ATTRS
1573 _mm_cvtsd_f64(__m128d __a)
1578 /// Loads a 128-bit floating-point vector of [2 x double] from an aligned
1579 /// memory location.
1581 /// \headerfile <x86intrin.h>
1583 /// This intrinsic corresponds to the <c> VMOVAPD / MOVAPD </c> instruction.
1586 /// A pointer to a 128-bit memory location. The address of the memory
1587 /// location has to be 16-byte aligned.
1588 /// \returns A 128-bit vector of [2 x double] containing the loaded values.
1589 static __inline__ __m128d __DEFAULT_FN_ATTRS
1590 _mm_load_pd(double const *__dp)
1592 return *(__m128d*)__dp;
1595 /// Loads a double-precision floating-point value from a specified memory
1596 /// location and duplicates it to both vector elements of a 128-bit vector of
1599 /// \headerfile <x86intrin.h>
1601 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVDDUP </c> instruction.
1604 /// A pointer to a memory location containing a double-precision value.
1605 /// \returns A 128-bit vector of [2 x double] containing the loaded and
1606 /// duplicated values.
1607 static __inline__ __m128d __DEFAULT_FN_ATTRS
1608 _mm_load1_pd(double const *__dp)
1610 struct __mm_load1_pd_struct {
1612 } __attribute__((__packed__, __may_alias__));
1613 double __u = ((struct __mm_load1_pd_struct*)__dp)->__u;
1614 return __extension__ (__m128d){ __u, __u };
1617 #define _mm_load_pd1(dp) _mm_load1_pd(dp)
1619 /// Loads two double-precision values, in reverse order, from an aligned
1620 /// memory location into a 128-bit vector of [2 x double].
1622 /// \headerfile <x86intrin.h>
1624 /// This intrinsic corresponds to the <c> VMOVAPD / MOVAPD </c> instruction +
1625 /// needed shuffling instructions. In AVX mode, the shuffling may be combined
1626 /// with the \c VMOVAPD, resulting in only a \c VPERMILPD instruction.
1629 /// A 16-byte aligned pointer to an array of double-precision values to be
1630 /// loaded in reverse order.
1631 /// \returns A 128-bit vector of [2 x double] containing the reversed loaded
1633 static __inline__ __m128d __DEFAULT_FN_ATTRS
1634 _mm_loadr_pd(double const *__dp)
1636 __m128d __u = *(__m128d*)__dp;
1637 return __builtin_shufflevector((__v2df)__u, (__v2df)__u, 1, 0);
1640 /// Loads a 128-bit floating-point vector of [2 x double] from an
1641 /// unaligned memory location.
1643 /// \headerfile <x86intrin.h>
1645 /// This intrinsic corresponds to the <c> VMOVUPD / MOVUPD </c> instruction.
1648 /// A pointer to a 128-bit memory location. The address of the memory
1649 /// location does not have to be aligned.
1650 /// \returns A 128-bit vector of [2 x double] containing the loaded values.
1651 static __inline__ __m128d __DEFAULT_FN_ATTRS
1652 _mm_loadu_pd(double const *__dp)
1656 } __attribute__((__packed__, __may_alias__));
1657 return ((struct __loadu_pd*)__dp)->__v;
1660 /// Loads a 64-bit integer value to the low element of a 128-bit integer
1661 /// vector and clears the upper element.
1663 /// \headerfile <x86intrin.h>
1665 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
1668 /// A pointer to a 64-bit memory location. The address of the memory
1669 /// location does not have to be aligned.
1670 /// \returns A 128-bit vector of [2 x i64] containing the loaded value.
1671 static __inline__ __m128i __DEFAULT_FN_ATTRS
1672 _mm_loadu_si64(void const *__a)
1674 struct __loadu_si64 {
1676 } __attribute__((__packed__, __may_alias__));
1677 long long __u = ((struct __loadu_si64*)__a)->__v;
1678 return __extension__ (__m128i)(__v2di){__u, 0L};
1681 /// Loads a 64-bit double-precision value to the low element of a
1682 /// 128-bit integer vector and clears the upper element.
1684 /// \headerfile <x86intrin.h>
1686 /// This intrinsic corresponds to the <c> VMOVSD / MOVSD </c> instruction.
1689 /// A pointer to a memory location containing a double-precision value.
1690 /// The address of the memory location does not have to be aligned.
1691 /// \returns A 128-bit vector of [2 x double] containing the loaded value.
1692 static __inline__ __m128d __DEFAULT_FN_ATTRS
1693 _mm_load_sd(double const *__dp)
1695 struct __mm_load_sd_struct {
1697 } __attribute__((__packed__, __may_alias__));
1698 double __u = ((struct __mm_load_sd_struct*)__dp)->__u;
1699 return __extension__ (__m128d){ __u, 0 };
1702 /// Loads a double-precision value into the high-order bits of a 128-bit
1703 /// vector of [2 x double]. The low-order bits are copied from the low-order
1704 /// bits of the first operand.
1706 /// \headerfile <x86intrin.h>
1708 /// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
1711 /// A 128-bit vector of [2 x double]. \n
1712 /// Bits [63:0] are written to bits [63:0] of the result.
1714 /// A pointer to a 64-bit memory location containing a double-precision
1715 /// floating-point value that is loaded. The loaded value is written to bits
1716 /// [127:64] of the result. The address of the memory location does not have
1718 /// \returns A 128-bit vector of [2 x double] containing the moved values.
1719 static __inline__ __m128d __DEFAULT_FN_ATTRS
1720 _mm_loadh_pd(__m128d __a, double const *__dp)
1722 struct __mm_loadh_pd_struct {
1724 } __attribute__((__packed__, __may_alias__));
1725 double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u;
1726 return __extension__ (__m128d){ __a[0], __u };
1729 /// Loads a double-precision value into the low-order bits of a 128-bit
1730 /// vector of [2 x double]. The high-order bits are copied from the
1731 /// high-order bits of the first operand.
1733 /// \headerfile <x86intrin.h>
1735 /// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
1738 /// A 128-bit vector of [2 x double]. \n
1739 /// Bits [127:64] are written to bits [127:64] of the result.
1741 /// A pointer to a 64-bit memory location containing a double-precision
1742 /// floating-point value that is loaded. The loaded value is written to bits
1743 /// [63:0] of the result. The address of the memory location does not have to
1745 /// \returns A 128-bit vector of [2 x double] containing the moved values.
1746 static __inline__ __m128d __DEFAULT_FN_ATTRS
1747 _mm_loadl_pd(__m128d __a, double const *__dp)
1749 struct __mm_loadl_pd_struct {
1751 } __attribute__((__packed__, __may_alias__));
1752 double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u;
1753 return __extension__ (__m128d){ __u, __a[1] };
1756 /// Constructs a 128-bit floating-point vector of [2 x double] with
1757 /// unspecified content. This could be used as an argument to another
1758 /// intrinsic function where the argument is required but the value is not
1761 /// \headerfile <x86intrin.h>
1763 /// This intrinsic has no corresponding instruction.
1765 /// \returns A 128-bit floating-point vector of [2 x double] with unspecified
1767 static __inline__ __m128d __DEFAULT_FN_ATTRS
1768 _mm_undefined_pd(void)
1770 return (__m128d)__builtin_ia32_undef128();
1773 /// Constructs a 128-bit floating-point vector of [2 x double]. The lower
1774 /// 64 bits of the vector are initialized with the specified double-precision
1775 /// floating-point value. The upper 64 bits are set to zero.
1777 /// \headerfile <x86intrin.h>
1779 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
1782 /// A double-precision floating-point value used to initialize the lower 64
1783 /// bits of the result.
1784 /// \returns An initialized 128-bit floating-point vector of [2 x double]. The
1785 /// lower 64 bits contain the value of the parameter. The upper 64 bits are
1787 static __inline__ __m128d __DEFAULT_FN_ATTRS
1788 _mm_set_sd(double __w)
1790 return __extension__ (__m128d){ __w, 0 };
1793 /// Constructs a 128-bit floating-point vector of [2 x double], with each
1794 /// of the two double-precision floating-point vector elements set to the
1795 /// specified double-precision floating-point value.
1797 /// \headerfile <x86intrin.h>
1799 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVLHPS </c> instruction.
1802 /// A double-precision floating-point value used to initialize each vector
1803 /// element of the result.
1804 /// \returns An initialized 128-bit floating-point vector of [2 x double].
1805 static __inline__ __m128d __DEFAULT_FN_ATTRS
1806 _mm_set1_pd(double __w)
1808 return __extension__ (__m128d){ __w, __w };
1811 /// Constructs a 128-bit floating-point vector of [2 x double], with each
1812 /// of the two double-precision floating-point vector elements set to the
1813 /// specified double-precision floating-point value.
1815 /// \headerfile <x86intrin.h>
1817 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVLHPS </c> instruction.
1820 /// A double-precision floating-point value used to initialize each vector
1821 /// element of the result.
1822 /// \returns An initialized 128-bit floating-point vector of [2 x double].
1823 static __inline__ __m128d __DEFAULT_FN_ATTRS
1824 _mm_set_pd1(double __w)
1826 return _mm_set1_pd(__w);
1829 /// Constructs a 128-bit floating-point vector of [2 x double]
1830 /// initialized with the specified double-precision floating-point values.
1832 /// \headerfile <x86intrin.h>
1834 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
1837 /// A double-precision floating-point value used to initialize the upper 64
1838 /// bits of the result.
1840 /// A double-precision floating-point value used to initialize the lower 64
1841 /// bits of the result.
1842 /// \returns An initialized 128-bit floating-point vector of [2 x double].
1843 static __inline__ __m128d __DEFAULT_FN_ATTRS
1844 _mm_set_pd(double __w, double __x)
1846 return __extension__ (__m128d){ __x, __w };
1849 /// Constructs a 128-bit floating-point vector of [2 x double],
1850 /// initialized in reverse order with the specified double-precision
1851 /// floating-point values.
1853 /// \headerfile <x86intrin.h>
1855 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
1858 /// A double-precision floating-point value used to initialize the lower 64
1859 /// bits of the result.
1861 /// A double-precision floating-point value used to initialize the upper 64
1862 /// bits of the result.
1863 /// \returns An initialized 128-bit floating-point vector of [2 x double].
1864 static __inline__ __m128d __DEFAULT_FN_ATTRS
1865 _mm_setr_pd(double __w, double __x)
1867 return __extension__ (__m128d){ __w, __x };
1870 /// Constructs a 128-bit floating-point vector of [2 x double]
1871 /// initialized to zero.
1873 /// \headerfile <x86intrin.h>
1875 /// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
1877 /// \returns An initialized 128-bit floating-point vector of [2 x double] with
1878 /// all elements set to zero.
1879 static __inline__ __m128d __DEFAULT_FN_ATTRS
1880 _mm_setzero_pd(void)
1882 return __extension__ (__m128d){ 0, 0 };
1885 /// Constructs a 128-bit floating-point vector of [2 x double]. The lower
1886 /// 64 bits are set to the lower 64 bits of the second parameter. The upper
1887 /// 64 bits are set to the upper 64 bits of the first parameter.
1889 /// \headerfile <x86intrin.h>
1891 /// This intrinsic corresponds to the <c> VBLENDPD / BLENDPD </c> instruction.
1894 /// A 128-bit vector of [2 x double]. The upper 64 bits are written to the
1895 /// upper 64 bits of the result.
1897 /// A 128-bit vector of [2 x double]. The lower 64 bits are written to the
1898 /// lower 64 bits of the result.
1899 /// \returns A 128-bit vector of [2 x double] containing the moved values.
1900 static __inline__ __m128d __DEFAULT_FN_ATTRS
1901 _mm_move_sd(__m128d __a, __m128d __b)
1907 /// Stores the lower 64 bits of a 128-bit vector of [2 x double] to a
1908 /// memory location.
1910 /// \headerfile <x86intrin.h>
1912 /// This intrinsic corresponds to the <c> VMOVSD / MOVSD </c> instruction.
1915 /// A pointer to a 64-bit memory location.
1917 /// A 128-bit vector of [2 x double] containing the value to be stored.
1918 static __inline__ void __DEFAULT_FN_ATTRS
1919 _mm_store_sd(double *__dp, __m128d __a)
1921 struct __mm_store_sd_struct {
1923 } __attribute__((__packed__, __may_alias__));
1924 ((struct __mm_store_sd_struct*)__dp)->__u = __a[0];
1927 /// Moves packed double-precision values from a 128-bit vector of
1928 /// [2 x double] to a memory location.
1930 /// \headerfile <x86intrin.h>
1932 /// This intrinsic corresponds to the <c>VMOVAPD / MOVAPS</c> instruction.
1935 /// A pointer to an aligned memory location that can store two
1936 /// double-precision values.
1938 /// A packed 128-bit vector of [2 x double] containing the values to be
1940 static __inline__ void __DEFAULT_FN_ATTRS
1941 _mm_store_pd(double *__dp, __m128d __a)
1943 *(__m128d*)__dp = __a;
1946 /// Moves the lower 64 bits of a 128-bit vector of [2 x double] twice to
1947 /// the upper and lower 64 bits of a memory location.
1949 /// \headerfile <x86intrin.h>
1951 /// This intrinsic corresponds to the
1952 /// <c> VMOVDDUP + VMOVAPD / MOVLHPS + MOVAPS </c> instruction.
1955 /// A pointer to a memory location that can store two double-precision
1958 /// A 128-bit vector of [2 x double] whose lower 64 bits are copied to each
1959 /// of the values in \a __dp.
1960 static __inline__ void __DEFAULT_FN_ATTRS
1961 _mm_store1_pd(double *__dp, __m128d __a)
1963 __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0);
1964 _mm_store_pd(__dp, __a);
1967 /// Moves the lower 64 bits of a 128-bit vector of [2 x double] twice to
1968 /// the upper and lower 64 bits of a memory location.
1970 /// \headerfile <x86intrin.h>
1972 /// This intrinsic corresponds to the
1973 /// <c> VMOVDDUP + VMOVAPD / MOVLHPS + MOVAPS </c> instruction.
1976 /// A pointer to a memory location that can store two double-precision
1979 /// A 128-bit vector of [2 x double] whose lower 64 bits are copied to each
1980 /// of the values in \a __dp.
1981 static __inline__ void __DEFAULT_FN_ATTRS
1982 _mm_store_pd1(double *__dp, __m128d __a)
1984 _mm_store1_pd(__dp, __a);
1987 /// Stores a 128-bit vector of [2 x double] into an unaligned memory
1990 /// \headerfile <x86intrin.h>
1992 /// This intrinsic corresponds to the <c> VMOVUPD / MOVUPD </c> instruction.
1995 /// A pointer to a 128-bit memory location. The address of the memory
1996 /// location does not have to be aligned.
1998 /// A 128-bit vector of [2 x double] containing the values to be stored.
1999 static __inline__ void __DEFAULT_FN_ATTRS
2000 _mm_storeu_pd(double *__dp, __m128d __a)
2002 struct __storeu_pd {
2004 } __attribute__((__packed__, __may_alias__));
2005 ((struct __storeu_pd*)__dp)->__v = __a;
2008 /// Stores two double-precision values, in reverse order, from a 128-bit
2009 /// vector of [2 x double] to a 16-byte aligned memory location.
2011 /// \headerfile <x86intrin.h>
2013 /// This intrinsic corresponds to a shuffling instruction followed by a
2014 /// <c> VMOVAPD / MOVAPD </c> instruction.
2017 /// A pointer to a 16-byte aligned memory location that can store two
2018 /// double-precision values.
2020 /// A 128-bit vector of [2 x double] containing the values to be reversed and
2022 static __inline__ void __DEFAULT_FN_ATTRS
2023 _mm_storer_pd(double *__dp, __m128d __a)
2025 __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 1, 0);
2026 *(__m128d *)__dp = __a;
2029 /// Stores the upper 64 bits of a 128-bit vector of [2 x double] to a
2030 /// memory location.
2032 /// \headerfile <x86intrin.h>
2034 /// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
2037 /// A pointer to a 64-bit memory location.
2039 /// A 128-bit vector of [2 x double] containing the value to be stored.
2040 static __inline__ void __DEFAULT_FN_ATTRS
2041 _mm_storeh_pd(double *__dp, __m128d __a)
2043 struct __mm_storeh_pd_struct {
2045 } __attribute__((__packed__, __may_alias__));
2046 ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1];
2049 /// Stores the lower 64 bits of a 128-bit vector of [2 x double] to a
2050 /// memory location.
2052 /// \headerfile <x86intrin.h>
2054 /// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
2057 /// A pointer to a 64-bit memory location.
2059 /// A 128-bit vector of [2 x double] containing the value to be stored.
2060 static __inline__ void __DEFAULT_FN_ATTRS
2061 _mm_storel_pd(double *__dp, __m128d __a)
2063 struct __mm_storeh_pd_struct {
2065 } __attribute__((__packed__, __may_alias__));
2066 ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0];
2069 /// Adds the corresponding elements of two 128-bit vectors of [16 x i8],
2070 /// saving the lower 8 bits of each sum in the corresponding element of a
2071 /// 128-bit result vector of [16 x i8].
2073 /// The integer elements of both parameters can be either signed or unsigned.
2075 /// \headerfile <x86intrin.h>
2077 /// This intrinsic corresponds to the <c> VPADDB / PADDB </c> instruction.
2080 /// A 128-bit vector of [16 x i8].
2082 /// A 128-bit vector of [16 x i8].
2083 /// \returns A 128-bit vector of [16 x i8] containing the sums of both
2085 static __inline__ __m128i __DEFAULT_FN_ATTRS
2086 _mm_add_epi8(__m128i __a, __m128i __b)
2088 return (__m128i)((__v16qu)__a + (__v16qu)__b);
2091 /// Adds the corresponding elements of two 128-bit vectors of [8 x i16],
2092 /// saving the lower 16 bits of each sum in the corresponding element of a
2093 /// 128-bit result vector of [8 x i16].
2095 /// The integer elements of both parameters can be either signed or unsigned.
2097 /// \headerfile <x86intrin.h>
2099 /// This intrinsic corresponds to the <c> VPADDW / PADDW </c> instruction.
2102 /// A 128-bit vector of [8 x i16].
2104 /// A 128-bit vector of [8 x i16].
2105 /// \returns A 128-bit vector of [8 x i16] containing the sums of both
2107 static __inline__ __m128i __DEFAULT_FN_ATTRS
2108 _mm_add_epi16(__m128i __a, __m128i __b)
2110 return (__m128i)((__v8hu)__a + (__v8hu)__b);
2113 /// Adds the corresponding elements of two 128-bit vectors of [4 x i32],
2114 /// saving the lower 32 bits of each sum in the corresponding element of a
2115 /// 128-bit result vector of [4 x i32].
2117 /// The integer elements of both parameters can be either signed or unsigned.
2119 /// \headerfile <x86intrin.h>
2121 /// This intrinsic corresponds to the <c> VPADDD / PADDD </c> instruction.
2124 /// A 128-bit vector of [4 x i32].
2126 /// A 128-bit vector of [4 x i32].
2127 /// \returns A 128-bit vector of [4 x i32] containing the sums of both
2129 static __inline__ __m128i __DEFAULT_FN_ATTRS
2130 _mm_add_epi32(__m128i __a, __m128i __b)
2132 return (__m128i)((__v4su)__a + (__v4su)__b);
2135 /// Adds two signed or unsigned 64-bit integer values, returning the
2136 /// lower 64 bits of the sum.
2138 /// \headerfile <x86intrin.h>
2140 /// This intrinsic corresponds to the <c> PADDQ </c> instruction.
2143 /// A 64-bit integer.
2145 /// A 64-bit integer.
2146 /// \returns A 64-bit integer containing the sum of both parameters.
2147 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
2148 _mm_add_si64(__m64 __a, __m64 __b)
2150 return (__m64)__builtin_ia32_paddq((__v1di)__a, (__v1di)__b);
2153 /// Adds the corresponding elements of two 128-bit vectors of [2 x i64],
2154 /// saving the lower 64 bits of each sum in the corresponding element of a
2155 /// 128-bit result vector of [2 x i64].
2157 /// The integer elements of both parameters can be either signed or unsigned.
2159 /// \headerfile <x86intrin.h>
2161 /// This intrinsic corresponds to the <c> VPADDQ / PADDQ </c> instruction.
2164 /// A 128-bit vector of [2 x i64].
2166 /// A 128-bit vector of [2 x i64].
2167 /// \returns A 128-bit vector of [2 x i64] containing the sums of both
2169 static __inline__ __m128i __DEFAULT_FN_ATTRS
2170 _mm_add_epi64(__m128i __a, __m128i __b)
2172 return (__m128i)((__v2du)__a + (__v2du)__b);
2175 /// Adds, with saturation, the corresponding elements of two 128-bit
2176 /// signed [16 x i8] vectors, saving each sum in the corresponding element of
2177 /// a 128-bit result vector of [16 x i8]. Positive sums greater than 0x7F are
2178 /// saturated to 0x7F. Negative sums less than 0x80 are saturated to 0x80.
2180 /// \headerfile <x86intrin.h>
2182 /// This intrinsic corresponds to the <c> VPADDSB / PADDSB </c> instruction.
2185 /// A 128-bit signed [16 x i8] vector.
2187 /// A 128-bit signed [16 x i8] vector.
2188 /// \returns A 128-bit signed [16 x i8] vector containing the saturated sums of
2189 /// both parameters.
2190 static __inline__ __m128i __DEFAULT_FN_ATTRS
2191 _mm_adds_epi8(__m128i __a, __m128i __b)
2193 return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b);
2196 /// Adds, with saturation, the corresponding elements of two 128-bit
2197 /// signed [8 x i16] vectors, saving each sum in the corresponding element of
2198 /// a 128-bit result vector of [8 x i16]. Positive sums greater than 0x7FFF
2199 /// are saturated to 0x7FFF. Negative sums less than 0x8000 are saturated to
2202 /// \headerfile <x86intrin.h>
2204 /// This intrinsic corresponds to the <c> VPADDSW / PADDSW </c> instruction.
2207 /// A 128-bit signed [8 x i16] vector.
2209 /// A 128-bit signed [8 x i16] vector.
2210 /// \returns A 128-bit signed [8 x i16] vector containing the saturated sums of
2211 /// both parameters.
2212 static __inline__ __m128i __DEFAULT_FN_ATTRS
2213 _mm_adds_epi16(__m128i __a, __m128i __b)
2215 return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b);
2218 /// Adds, with saturation, the corresponding elements of two 128-bit
2219 /// unsigned [16 x i8] vectors, saving each sum in the corresponding element
2220 /// of a 128-bit result vector of [16 x i8]. Positive sums greater than 0xFF
2221 /// are saturated to 0xFF. Negative sums are saturated to 0x00.
2223 /// \headerfile <x86intrin.h>
2225 /// This intrinsic corresponds to the <c> VPADDUSB / PADDUSB </c> instruction.
2228 /// A 128-bit unsigned [16 x i8] vector.
2230 /// A 128-bit unsigned [16 x i8] vector.
2231 /// \returns A 128-bit unsigned [16 x i8] vector containing the saturated sums
2232 /// of both parameters.
2233 static __inline__ __m128i __DEFAULT_FN_ATTRS
2234 _mm_adds_epu8(__m128i __a, __m128i __b)
2236 return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b);
2239 /// Adds, with saturation, the corresponding elements of two 128-bit
2240 /// unsigned [8 x i16] vectors, saving each sum in the corresponding element
2241 /// of a 128-bit result vector of [8 x i16]. Positive sums greater than
2242 /// 0xFFFF are saturated to 0xFFFF. Negative sums are saturated to 0x0000.
2244 /// \headerfile <x86intrin.h>
2246 /// This intrinsic corresponds to the <c> VPADDUSB / PADDUSB </c> instruction.
2249 /// A 128-bit unsigned [8 x i16] vector.
2251 /// A 128-bit unsigned [8 x i16] vector.
2252 /// \returns A 128-bit unsigned [8 x i16] vector containing the saturated sums
2253 /// of both parameters.
2254 static __inline__ __m128i __DEFAULT_FN_ATTRS
2255 _mm_adds_epu16(__m128i __a, __m128i __b)
2257 return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b);
2260 /// Computes the rounded avarages of corresponding elements of two
2261 /// 128-bit unsigned [16 x i8] vectors, saving each result in the
2262 /// corresponding element of a 128-bit result vector of [16 x i8].
2264 /// \headerfile <x86intrin.h>
2266 /// This intrinsic corresponds to the <c> VPAVGB / PAVGB </c> instruction.
2269 /// A 128-bit unsigned [16 x i8] vector.
2271 /// A 128-bit unsigned [16 x i8] vector.
2272 /// \returns A 128-bit unsigned [16 x i8] vector containing the rounded
2273 /// averages of both parameters.
2274 static __inline__ __m128i __DEFAULT_FN_ATTRS
2275 _mm_avg_epu8(__m128i __a, __m128i __b)
2277 typedef unsigned short __v16hu __attribute__ ((__vector_size__ (32)));
2278 return (__m128i)__builtin_convertvector(
2279 ((__builtin_convertvector((__v16qu)__a, __v16hu) +
2280 __builtin_convertvector((__v16qu)__b, __v16hu)) + 1)
2284 /// Computes the rounded avarages of corresponding elements of two
2285 /// 128-bit unsigned [8 x i16] vectors, saving each result in the
2286 /// corresponding element of a 128-bit result vector of [8 x i16].
2288 /// \headerfile <x86intrin.h>
2290 /// This intrinsic corresponds to the <c> VPAVGW / PAVGW </c> instruction.
2293 /// A 128-bit unsigned [8 x i16] vector.
2295 /// A 128-bit unsigned [8 x i16] vector.
2296 /// \returns A 128-bit unsigned [8 x i16] vector containing the rounded
2297 /// averages of both parameters.
2298 static __inline__ __m128i __DEFAULT_FN_ATTRS
2299 _mm_avg_epu16(__m128i __a, __m128i __b)
2301 typedef unsigned int __v8su __attribute__ ((__vector_size__ (32)));
2302 return (__m128i)__builtin_convertvector(
2303 ((__builtin_convertvector((__v8hu)__a, __v8su) +
2304 __builtin_convertvector((__v8hu)__b, __v8su)) + 1)
2308 /// Multiplies the corresponding elements of two 128-bit signed [8 x i16]
2309 /// vectors, producing eight intermediate 32-bit signed integer products, and
2310 /// adds the consecutive pairs of 32-bit products to form a 128-bit signed
2311 /// [4 x i32] vector.
2313 /// For example, bits [15:0] of both parameters are multiplied producing a
2314 /// 32-bit product, bits [31:16] of both parameters are multiplied producing
2315 /// a 32-bit product, and the sum of those two products becomes bits [31:0]
2318 /// \headerfile <x86intrin.h>
2320 /// This intrinsic corresponds to the <c> VPMADDWD / PMADDWD </c> instruction.
2323 /// A 128-bit signed [8 x i16] vector.
2325 /// A 128-bit signed [8 x i16] vector.
2326 /// \returns A 128-bit signed [4 x i32] vector containing the sums of products
2327 /// of both parameters.
2328 static __inline__ __m128i __DEFAULT_FN_ATTRS
2329 _mm_madd_epi16(__m128i __a, __m128i __b)
2331 return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b);
2334 /// Compares corresponding elements of two 128-bit signed [8 x i16]
2335 /// vectors, saving the greater value from each comparison in the
2336 /// corresponding element of a 128-bit result vector of [8 x i16].
2338 /// \headerfile <x86intrin.h>
2340 /// This intrinsic corresponds to the <c> VPMAXSW / PMAXSW </c> instruction.
2343 /// A 128-bit signed [8 x i16] vector.
2345 /// A 128-bit signed [8 x i16] vector.
2346 /// \returns A 128-bit signed [8 x i16] vector containing the greater value of
2347 /// each comparison.
2348 static __inline__ __m128i __DEFAULT_FN_ATTRS
2349 _mm_max_epi16(__m128i __a, __m128i __b)
2351 return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b);
2354 /// Compares corresponding elements of two 128-bit unsigned [16 x i8]
2355 /// vectors, saving the greater value from each comparison in the
2356 /// corresponding element of a 128-bit result vector of [16 x i8].
2358 /// \headerfile <x86intrin.h>
2360 /// This intrinsic corresponds to the <c> VPMAXUB / PMAXUB </c> instruction.
2363 /// A 128-bit unsigned [16 x i8] vector.
2365 /// A 128-bit unsigned [16 x i8] vector.
2366 /// \returns A 128-bit unsigned [16 x i8] vector containing the greater value of
2367 /// each comparison.
2368 static __inline__ __m128i __DEFAULT_FN_ATTRS
2369 _mm_max_epu8(__m128i __a, __m128i __b)
2371 return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b);
2374 /// Compares corresponding elements of two 128-bit signed [8 x i16]
2375 /// vectors, saving the smaller value from each comparison in the
2376 /// corresponding element of a 128-bit result vector of [8 x i16].
2378 /// \headerfile <x86intrin.h>
2380 /// This intrinsic corresponds to the <c> VPMINSW / PMINSW </c> instruction.
2383 /// A 128-bit signed [8 x i16] vector.
2385 /// A 128-bit signed [8 x i16] vector.
2386 /// \returns A 128-bit signed [8 x i16] vector containing the smaller value of
2387 /// each comparison.
2388 static __inline__ __m128i __DEFAULT_FN_ATTRS
2389 _mm_min_epi16(__m128i __a, __m128i __b)
2391 return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b);
2394 /// Compares corresponding elements of two 128-bit unsigned [16 x i8]
2395 /// vectors, saving the smaller value from each comparison in the
2396 /// corresponding element of a 128-bit result vector of [16 x i8].
2398 /// \headerfile <x86intrin.h>
2400 /// This intrinsic corresponds to the <c> VPMINUB / PMINUB </c> instruction.
2403 /// A 128-bit unsigned [16 x i8] vector.
2405 /// A 128-bit unsigned [16 x i8] vector.
2406 /// \returns A 128-bit unsigned [16 x i8] vector containing the smaller value of
2407 /// each comparison.
2408 static __inline__ __m128i __DEFAULT_FN_ATTRS
2409 _mm_min_epu8(__m128i __a, __m128i __b)
2411 return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b);
2414 /// Multiplies the corresponding elements of two signed [8 x i16]
2415 /// vectors, saving the upper 16 bits of each 32-bit product in the
2416 /// corresponding element of a 128-bit signed [8 x i16] result vector.
2418 /// \headerfile <x86intrin.h>
2420 /// This intrinsic corresponds to the <c> VPMULHW / PMULHW </c> instruction.
2423 /// A 128-bit signed [8 x i16] vector.
2425 /// A 128-bit signed [8 x i16] vector.
2426 /// \returns A 128-bit signed [8 x i16] vector containing the upper 16 bits of
2427 /// each of the eight 32-bit products.
2428 static __inline__ __m128i __DEFAULT_FN_ATTRS
2429 _mm_mulhi_epi16(__m128i __a, __m128i __b)
2431 return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b);
2434 /// Multiplies the corresponding elements of two unsigned [8 x i16]
2435 /// vectors, saving the upper 16 bits of each 32-bit product in the
2436 /// corresponding element of a 128-bit unsigned [8 x i16] result vector.
2438 /// \headerfile <x86intrin.h>
2440 /// This intrinsic corresponds to the <c> VPMULHUW / PMULHUW </c> instruction.
2443 /// A 128-bit unsigned [8 x i16] vector.
2445 /// A 128-bit unsigned [8 x i16] vector.
2446 /// \returns A 128-bit unsigned [8 x i16] vector containing the upper 16 bits
2447 /// of each of the eight 32-bit products.
2448 static __inline__ __m128i __DEFAULT_FN_ATTRS
2449 _mm_mulhi_epu16(__m128i __a, __m128i __b)
2451 return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
2454 /// Multiplies the corresponding elements of two signed [8 x i16]
2455 /// vectors, saving the lower 16 bits of each 32-bit product in the
2456 /// corresponding element of a 128-bit signed [8 x i16] result vector.
2458 /// \headerfile <x86intrin.h>
2460 /// This intrinsic corresponds to the <c> VPMULLW / PMULLW </c> instruction.
2463 /// A 128-bit signed [8 x i16] vector.
2465 /// A 128-bit signed [8 x i16] vector.
2466 /// \returns A 128-bit signed [8 x i16] vector containing the lower 16 bits of
2467 /// each of the eight 32-bit products.
2468 static __inline__ __m128i __DEFAULT_FN_ATTRS
2469 _mm_mullo_epi16(__m128i __a, __m128i __b)
2471 return (__m128i)((__v8hu)__a * (__v8hu)__b);
2474 /// Multiplies 32-bit unsigned integer values contained in the lower bits
2475 /// of the two 64-bit integer vectors and returns the 64-bit unsigned
2478 /// \headerfile <x86intrin.h>
2480 /// This intrinsic corresponds to the <c> PMULUDQ </c> instruction.
2483 /// A 64-bit integer containing one of the source operands.
2485 /// A 64-bit integer containing one of the source operands.
2486 /// \returns A 64-bit integer vector containing the product of both operands.
2487 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
2488 _mm_mul_su32(__m64 __a, __m64 __b)
2490 return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b);
2493 /// Multiplies 32-bit unsigned integer values contained in the lower
2494 /// bits of the corresponding elements of two [2 x i64] vectors, and returns
2495 /// the 64-bit products in the corresponding elements of a [2 x i64] vector.
2497 /// \headerfile <x86intrin.h>
2499 /// This intrinsic corresponds to the <c> VPMULUDQ / PMULUDQ </c> instruction.
2502 /// A [2 x i64] vector containing one of the source operands.
2504 /// A [2 x i64] vector containing one of the source operands.
2505 /// \returns A [2 x i64] vector containing the product of both operands.
2506 static __inline__ __m128i __DEFAULT_FN_ATTRS
2507 _mm_mul_epu32(__m128i __a, __m128i __b)
2509 return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b);
2512 /// Computes the absolute differences of corresponding 8-bit integer
2513 /// values in two 128-bit vectors. Sums the first 8 absolute differences, and
2514 /// separately sums the second 8 absolute differences. Packs these two
2515 /// unsigned 16-bit integer sums into the upper and lower elements of a
2516 /// [2 x i64] vector.
2518 /// \headerfile <x86intrin.h>
2520 /// This intrinsic corresponds to the <c> VPSADBW / PSADBW </c> instruction.
2523 /// A 128-bit integer vector containing one of the source operands.
2525 /// A 128-bit integer vector containing one of the source operands.
2526 /// \returns A [2 x i64] vector containing the sums of the sets of absolute
2527 /// differences between both operands.
2528 static __inline__ __m128i __DEFAULT_FN_ATTRS
2529 _mm_sad_epu8(__m128i __a, __m128i __b)
2531 return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b);
2534 /// Subtracts the corresponding 8-bit integer values in the operands.
2536 /// \headerfile <x86intrin.h>
2538 /// This intrinsic corresponds to the <c> VPSUBB / PSUBB </c> instruction.
2541 /// A 128-bit integer vector containing the minuends.
2543 /// A 128-bit integer vector containing the subtrahends.
2544 /// \returns A 128-bit integer vector containing the differences of the values
2545 /// in the operands.
2546 static __inline__ __m128i __DEFAULT_FN_ATTRS
2547 _mm_sub_epi8(__m128i __a, __m128i __b)
2549 return (__m128i)((__v16qu)__a - (__v16qu)__b);
2552 /// Subtracts the corresponding 16-bit integer values in the operands.
2554 /// \headerfile <x86intrin.h>
2556 /// This intrinsic corresponds to the <c> VPSUBW / PSUBW </c> instruction.
2559 /// A 128-bit integer vector containing the minuends.
2561 /// A 128-bit integer vector containing the subtrahends.
2562 /// \returns A 128-bit integer vector containing the differences of the values
2563 /// in the operands.
2564 static __inline__ __m128i __DEFAULT_FN_ATTRS
2565 _mm_sub_epi16(__m128i __a, __m128i __b)
2567 return (__m128i)((__v8hu)__a - (__v8hu)__b);
2570 /// Subtracts the corresponding 32-bit integer values in the operands.
2572 /// \headerfile <x86intrin.h>
2574 /// This intrinsic corresponds to the <c> VPSUBD / PSUBD </c> instruction.
2577 /// A 128-bit integer vector containing the minuends.
2579 /// A 128-bit integer vector containing the subtrahends.
2580 /// \returns A 128-bit integer vector containing the differences of the values
2581 /// in the operands.
2582 static __inline__ __m128i __DEFAULT_FN_ATTRS
2583 _mm_sub_epi32(__m128i __a, __m128i __b)
2585 return (__m128i)((__v4su)__a - (__v4su)__b);
2588 /// Subtracts signed or unsigned 64-bit integer values and writes the
2589 /// difference to the corresponding bits in the destination.
2591 /// \headerfile <x86intrin.h>
2593 /// This intrinsic corresponds to the <c> PSUBQ </c> instruction.
2596 /// A 64-bit integer vector containing the minuend.
2598 /// A 64-bit integer vector containing the subtrahend.
2599 /// \returns A 64-bit integer vector containing the difference of the values in
2601 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
2602 _mm_sub_si64(__m64 __a, __m64 __b)
2604 return (__m64)__builtin_ia32_psubq((__v1di)__a, (__v1di)__b);
2607 /// Subtracts the corresponding elements of two [2 x i64] vectors.
2609 /// \headerfile <x86intrin.h>
2611 /// This intrinsic corresponds to the <c> VPSUBQ / PSUBQ </c> instruction.
2614 /// A 128-bit integer vector containing the minuends.
2616 /// A 128-bit integer vector containing the subtrahends.
2617 /// \returns A 128-bit integer vector containing the differences of the values
2618 /// in the operands.
2619 static __inline__ __m128i __DEFAULT_FN_ATTRS
2620 _mm_sub_epi64(__m128i __a, __m128i __b)
2622 return (__m128i)((__v2du)__a - (__v2du)__b);
2625 /// Subtracts corresponding 8-bit signed integer values in the input and
2626 /// returns the differences in the corresponding bytes in the destination.
2627 /// Differences greater than 0x7F are saturated to 0x7F, and differences less
2628 /// than 0x80 are saturated to 0x80.
2630 /// \headerfile <x86intrin.h>
2632 /// This intrinsic corresponds to the <c> VPSUBSB / PSUBSB </c> instruction.
2635 /// A 128-bit integer vector containing the minuends.
2637 /// A 128-bit integer vector containing the subtrahends.
2638 /// \returns A 128-bit integer vector containing the differences of the values
2639 /// in the operands.
2640 static __inline__ __m128i __DEFAULT_FN_ATTRS
2641 _mm_subs_epi8(__m128i __a, __m128i __b)
2643 return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b);
2646 /// Subtracts corresponding 16-bit signed integer values in the input and
2647 /// returns the differences in the corresponding bytes in the destination.
2648 /// Differences greater than 0x7FFF are saturated to 0x7FFF, and values less
2649 /// than 0x8000 are saturated to 0x8000.
2651 /// \headerfile <x86intrin.h>
2653 /// This intrinsic corresponds to the <c> VPSUBSW / PSUBSW </c> instruction.
2656 /// A 128-bit integer vector containing the minuends.
2658 /// A 128-bit integer vector containing the subtrahends.
2659 /// \returns A 128-bit integer vector containing the differences of the values
2660 /// in the operands.
2661 static __inline__ __m128i __DEFAULT_FN_ATTRS
2662 _mm_subs_epi16(__m128i __a, __m128i __b)
2664 return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b);
2667 /// Subtracts corresponding 8-bit unsigned integer values in the input
2668 /// and returns the differences in the corresponding bytes in the
2669 /// destination. Differences less than 0x00 are saturated to 0x00.
2671 /// \headerfile <x86intrin.h>
2673 /// This intrinsic corresponds to the <c> VPSUBUSB / PSUBUSB </c> instruction.
2676 /// A 128-bit integer vector containing the minuends.
2678 /// A 128-bit integer vector containing the subtrahends.
2679 /// \returns A 128-bit integer vector containing the unsigned integer
2680 /// differences of the values in the operands.
2681 static __inline__ __m128i __DEFAULT_FN_ATTRS
2682 _mm_subs_epu8(__m128i __a, __m128i __b)
2684 return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b);
2687 /// Subtracts corresponding 16-bit unsigned integer values in the input
2688 /// and returns the differences in the corresponding bytes in the
2689 /// destination. Differences less than 0x0000 are saturated to 0x0000.
2691 /// \headerfile <x86intrin.h>
2693 /// This intrinsic corresponds to the <c> VPSUBUSW / PSUBUSW </c> instruction.
2696 /// A 128-bit integer vector containing the minuends.
2698 /// A 128-bit integer vector containing the subtrahends.
2699 /// \returns A 128-bit integer vector containing the unsigned integer
2700 /// differences of the values in the operands.
2701 static __inline__ __m128i __DEFAULT_FN_ATTRS
2702 _mm_subs_epu16(__m128i __a, __m128i __b)
2704 return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b);
2707 /// Performs a bitwise AND of two 128-bit integer vectors.
2709 /// \headerfile <x86intrin.h>
2711 /// This intrinsic corresponds to the <c> VPAND / PAND </c> instruction.
2714 /// A 128-bit integer vector containing one of the source operands.
2716 /// A 128-bit integer vector containing one of the source operands.
2717 /// \returns A 128-bit integer vector containing the bitwise AND of the values
2718 /// in both operands.
2719 static __inline__ __m128i __DEFAULT_FN_ATTRS
2720 _mm_and_si128(__m128i __a, __m128i __b)
2722 return (__m128i)((__v2du)__a & (__v2du)__b);
2725 /// Performs a bitwise AND of two 128-bit integer vectors, using the
2726 /// one's complement of the values contained in the first source operand.
2728 /// \headerfile <x86intrin.h>
2730 /// This intrinsic corresponds to the <c> VPANDN / PANDN </c> instruction.
2733 /// A 128-bit vector containing the left source operand. The one's complement
2734 /// of this value is used in the bitwise AND.
2736 /// A 128-bit vector containing the right source operand.
2737 /// \returns A 128-bit integer vector containing the bitwise AND of the one's
2738 /// complement of the first operand and the values in the second operand.
2739 static __inline__ __m128i __DEFAULT_FN_ATTRS
2740 _mm_andnot_si128(__m128i __a, __m128i __b)
2742 return (__m128i)(~(__v2du)__a & (__v2du)__b);
2744 /// Performs a bitwise OR of two 128-bit integer vectors.
2746 /// \headerfile <x86intrin.h>
2748 /// This intrinsic corresponds to the <c> VPOR / POR </c> instruction.
2751 /// A 128-bit integer vector containing one of the source operands.
2753 /// A 128-bit integer vector containing one of the source operands.
2754 /// \returns A 128-bit integer vector containing the bitwise OR of the values
2755 /// in both operands.
2756 static __inline__ __m128i __DEFAULT_FN_ATTRS
2757 _mm_or_si128(__m128i __a, __m128i __b)
2759 return (__m128i)((__v2du)__a | (__v2du)__b);
2762 /// Performs a bitwise exclusive OR of two 128-bit integer vectors.
2764 /// \headerfile <x86intrin.h>
2766 /// This intrinsic corresponds to the <c> VPXOR / PXOR </c> instruction.
2769 /// A 128-bit integer vector containing one of the source operands.
2771 /// A 128-bit integer vector containing one of the source operands.
2772 /// \returns A 128-bit integer vector containing the bitwise exclusive OR of the
2773 /// values in both operands.
2774 static __inline__ __m128i __DEFAULT_FN_ATTRS
2775 _mm_xor_si128(__m128i __a, __m128i __b)
2777 return (__m128i)((__v2du)__a ^ (__v2du)__b);
2780 /// Left-shifts the 128-bit integer vector operand by the specified
2781 /// number of bytes. Low-order bits are cleared.
2783 /// \headerfile <x86intrin.h>
2786 /// __m128i _mm_slli_si128(__m128i a, const int imm);
2789 /// This intrinsic corresponds to the <c> VPSLLDQ / PSLLDQ </c> instruction.
2792 /// A 128-bit integer vector containing the source operand.
2794 /// An immediate value specifying the number of bytes to left-shift operand
2796 /// \returns A 128-bit integer vector containing the left-shifted value.
2797 #define _mm_slli_si128(a, imm) \
2798 (__m128i)__builtin_ia32_pslldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
2800 #define _mm_bslli_si128(a, imm) \
2801 (__m128i)__builtin_ia32_pslldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
2803 /// Left-shifts each 16-bit value in the 128-bit integer vector operand
2804 /// by the specified number of bits. Low-order bits are cleared.
2806 /// \headerfile <x86intrin.h>
2808 /// This intrinsic corresponds to the <c> VPSLLW / PSLLW </c> instruction.
2811 /// A 128-bit integer vector containing the source operand.
2813 /// An integer value specifying the number of bits to left-shift each value
2814 /// in operand \a __a.
2815 /// \returns A 128-bit integer vector containing the left-shifted values.
2816 static __inline__ __m128i __DEFAULT_FN_ATTRS
2817 _mm_slli_epi16(__m128i __a, int __count)
2819 return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count);
2822 /// Left-shifts each 16-bit value in the 128-bit integer vector operand
2823 /// by the specified number of bits. Low-order bits are cleared.
2825 /// \headerfile <x86intrin.h>
2827 /// This intrinsic corresponds to the <c> VPSLLW / PSLLW </c> instruction.
2830 /// A 128-bit integer vector containing the source operand.
2832 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
2833 /// to left-shift each value in operand \a __a.
2834 /// \returns A 128-bit integer vector containing the left-shifted values.
2835 static __inline__ __m128i __DEFAULT_FN_ATTRS
2836 _mm_sll_epi16(__m128i __a, __m128i __count)
2838 return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count);
2841 /// Left-shifts each 32-bit value in the 128-bit integer vector operand
2842 /// by the specified number of bits. Low-order bits are cleared.
2844 /// \headerfile <x86intrin.h>
2846 /// This intrinsic corresponds to the <c> VPSLLD / PSLLD </c> instruction.
2849 /// A 128-bit integer vector containing the source operand.
2851 /// An integer value specifying the number of bits to left-shift each value
2852 /// in operand \a __a.
2853 /// \returns A 128-bit integer vector containing the left-shifted values.
2854 static __inline__ __m128i __DEFAULT_FN_ATTRS
2855 _mm_slli_epi32(__m128i __a, int __count)
2857 return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count);
2860 /// Left-shifts each 32-bit value in the 128-bit integer vector operand
2861 /// by the specified number of bits. Low-order bits are cleared.
2863 /// \headerfile <x86intrin.h>
2865 /// This intrinsic corresponds to the <c> VPSLLD / PSLLD </c> instruction.
2868 /// A 128-bit integer vector containing the source operand.
2870 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
2871 /// to left-shift each value in operand \a __a.
2872 /// \returns A 128-bit integer vector containing the left-shifted values.
2873 static __inline__ __m128i __DEFAULT_FN_ATTRS
2874 _mm_sll_epi32(__m128i __a, __m128i __count)
2876 return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count);
2879 /// Left-shifts each 64-bit value in the 128-bit integer vector operand
2880 /// by the specified number of bits. Low-order bits are cleared.
2882 /// \headerfile <x86intrin.h>
2884 /// This intrinsic corresponds to the <c> VPSLLQ / PSLLQ </c> instruction.
2887 /// A 128-bit integer vector containing the source operand.
2889 /// An integer value specifying the number of bits to left-shift each value
2890 /// in operand \a __a.
2891 /// \returns A 128-bit integer vector containing the left-shifted values.
2892 static __inline__ __m128i __DEFAULT_FN_ATTRS
2893 _mm_slli_epi64(__m128i __a, int __count)
2895 return __builtin_ia32_psllqi128((__v2di)__a, __count);
2898 /// Left-shifts each 64-bit value in the 128-bit integer vector operand
2899 /// by the specified number of bits. Low-order bits are cleared.
2901 /// \headerfile <x86intrin.h>
2903 /// This intrinsic corresponds to the <c> VPSLLQ / PSLLQ </c> instruction.
2906 /// A 128-bit integer vector containing the source operand.
2908 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
2909 /// to left-shift each value in operand \a __a.
2910 /// \returns A 128-bit integer vector containing the left-shifted values.
2911 static __inline__ __m128i __DEFAULT_FN_ATTRS
2912 _mm_sll_epi64(__m128i __a, __m128i __count)
2914 return __builtin_ia32_psllq128((__v2di)__a, (__v2di)__count);
2917 /// Right-shifts each 16-bit value in the 128-bit integer vector operand
2918 /// by the specified number of bits. High-order bits are filled with the sign
2919 /// bit of the initial value.
2921 /// \headerfile <x86intrin.h>
2923 /// This intrinsic corresponds to the <c> VPSRAW / PSRAW </c> instruction.
2926 /// A 128-bit integer vector containing the source operand.
2928 /// An integer value specifying the number of bits to right-shift each value
2929 /// in operand \a __a.
2930 /// \returns A 128-bit integer vector containing the right-shifted values.
2931 static __inline__ __m128i __DEFAULT_FN_ATTRS
2932 _mm_srai_epi16(__m128i __a, int __count)
2934 return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count);
2937 /// Right-shifts each 16-bit value in the 128-bit integer vector operand
2938 /// by the specified number of bits. High-order bits are filled with the sign
2939 /// bit of the initial value.
2941 /// \headerfile <x86intrin.h>
2943 /// This intrinsic corresponds to the <c> VPSRAW / PSRAW </c> instruction.
2946 /// A 128-bit integer vector containing the source operand.
2948 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
2949 /// to right-shift each value in operand \a __a.
2950 /// \returns A 128-bit integer vector containing the right-shifted values.
2951 static __inline__ __m128i __DEFAULT_FN_ATTRS
2952 _mm_sra_epi16(__m128i __a, __m128i __count)
2954 return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count);
2957 /// Right-shifts each 32-bit value in the 128-bit integer vector operand
2958 /// by the specified number of bits. High-order bits are filled with the sign
2959 /// bit of the initial value.
2961 /// \headerfile <x86intrin.h>
2963 /// This intrinsic corresponds to the <c> VPSRAD / PSRAD </c> instruction.
2966 /// A 128-bit integer vector containing the source operand.
2968 /// An integer value specifying the number of bits to right-shift each value
2969 /// in operand \a __a.
2970 /// \returns A 128-bit integer vector containing the right-shifted values.
2971 static __inline__ __m128i __DEFAULT_FN_ATTRS
2972 _mm_srai_epi32(__m128i __a, int __count)
2974 return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count);
2977 /// Right-shifts each 32-bit value in the 128-bit integer vector operand
2978 /// by the specified number of bits. High-order bits are filled with the sign
2979 /// bit of the initial value.
2981 /// \headerfile <x86intrin.h>
2983 /// This intrinsic corresponds to the <c> VPSRAD / PSRAD </c> instruction.
2986 /// A 128-bit integer vector containing the source operand.
2988 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
2989 /// to right-shift each value in operand \a __a.
2990 /// \returns A 128-bit integer vector containing the right-shifted values.
2991 static __inline__ __m128i __DEFAULT_FN_ATTRS
2992 _mm_sra_epi32(__m128i __a, __m128i __count)
2994 return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count);
2997 /// Right-shifts the 128-bit integer vector operand by the specified
2998 /// number of bytes. High-order bits are cleared.
3000 /// \headerfile <x86intrin.h>
3003 /// __m128i _mm_srli_si128(__m128i a, const int imm);
3006 /// This intrinsic corresponds to the <c> VPSRLDQ / PSRLDQ </c> instruction.
3009 /// A 128-bit integer vector containing the source operand.
3011 /// An immediate value specifying the number of bytes to right-shift operand
3013 /// \returns A 128-bit integer vector containing the right-shifted value.
3014 #define _mm_srli_si128(a, imm) \
3015 (__m128i)__builtin_ia32_psrldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
3017 #define _mm_bsrli_si128(a, imm) \
3018 (__m128i)__builtin_ia32_psrldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
3020 /// Right-shifts each of 16-bit values in the 128-bit integer vector
3021 /// operand by the specified number of bits. High-order bits are cleared.
3023 /// \headerfile <x86intrin.h>
3025 /// This intrinsic corresponds to the <c> VPSRLW / PSRLW </c> instruction.
3028 /// A 128-bit integer vector containing the source operand.
3030 /// An integer value specifying the number of bits to right-shift each value
3031 /// in operand \a __a.
3032 /// \returns A 128-bit integer vector containing the right-shifted values.
3033 static __inline__ __m128i __DEFAULT_FN_ATTRS
3034 _mm_srli_epi16(__m128i __a, int __count)
3036 return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count);
3039 /// Right-shifts each of 16-bit values in the 128-bit integer vector
3040 /// operand by the specified number of bits. High-order bits are cleared.
3042 /// \headerfile <x86intrin.h>
3044 /// This intrinsic corresponds to the <c> VPSRLW / PSRLW </c> instruction.
3047 /// A 128-bit integer vector containing the source operand.
3049 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
3050 /// to right-shift each value in operand \a __a.
3051 /// \returns A 128-bit integer vector containing the right-shifted values.
3052 static __inline__ __m128i __DEFAULT_FN_ATTRS
3053 _mm_srl_epi16(__m128i __a, __m128i __count)
3055 return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count);
3058 /// Right-shifts each of 32-bit values in the 128-bit integer vector
3059 /// operand by the specified number of bits. High-order bits are cleared.
3061 /// \headerfile <x86intrin.h>
3063 /// This intrinsic corresponds to the <c> VPSRLD / PSRLD </c> instruction.
3066 /// A 128-bit integer vector containing the source operand.
3068 /// An integer value specifying the number of bits to right-shift each value
3069 /// in operand \a __a.
3070 /// \returns A 128-bit integer vector containing the right-shifted values.
3071 static __inline__ __m128i __DEFAULT_FN_ATTRS
3072 _mm_srli_epi32(__m128i __a, int __count)
3074 return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count);
3077 /// Right-shifts each of 32-bit values in the 128-bit integer vector
3078 /// operand by the specified number of bits. High-order bits are cleared.
3080 /// \headerfile <x86intrin.h>
3082 /// This intrinsic corresponds to the <c> VPSRLD / PSRLD </c> instruction.
3085 /// A 128-bit integer vector containing the source operand.
3087 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
3088 /// to right-shift each value in operand \a __a.
3089 /// \returns A 128-bit integer vector containing the right-shifted values.
3090 static __inline__ __m128i __DEFAULT_FN_ATTRS
3091 _mm_srl_epi32(__m128i __a, __m128i __count)
3093 return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count);
3096 /// Right-shifts each of 64-bit values in the 128-bit integer vector
3097 /// operand by the specified number of bits. High-order bits are cleared.
3099 /// \headerfile <x86intrin.h>
3101 /// This intrinsic corresponds to the <c> VPSRLQ / PSRLQ </c> instruction.
3104 /// A 128-bit integer vector containing the source operand.
3106 /// An integer value specifying the number of bits to right-shift each value
3107 /// in operand \a __a.
3108 /// \returns A 128-bit integer vector containing the right-shifted values.
3109 static __inline__ __m128i __DEFAULT_FN_ATTRS
3110 _mm_srli_epi64(__m128i __a, int __count)
3112 return __builtin_ia32_psrlqi128((__v2di)__a, __count);
3115 /// Right-shifts each of 64-bit values in the 128-bit integer vector
3116 /// operand by the specified number of bits. High-order bits are cleared.
3118 /// \headerfile <x86intrin.h>
3120 /// This intrinsic corresponds to the <c> VPSRLQ / PSRLQ </c> instruction.
3123 /// A 128-bit integer vector containing the source operand.
3125 /// A 128-bit integer vector in which bits [63:0] specify the number of bits
3126 /// to right-shift each value in operand \a __a.
3127 /// \returns A 128-bit integer vector containing the right-shifted values.
3128 static __inline__ __m128i __DEFAULT_FN_ATTRS
3129 _mm_srl_epi64(__m128i __a, __m128i __count)
3131 return __builtin_ia32_psrlq128((__v2di)__a, (__v2di)__count);
3134 /// Compares each of the corresponding 8-bit values of the 128-bit
3135 /// integer vectors for equality. Each comparison yields 0x0 for false, 0xFF
3138 /// \headerfile <x86intrin.h>
3140 /// This intrinsic corresponds to the <c> VPCMPEQB / PCMPEQB </c> instruction.
3143 /// A 128-bit integer vector.
3145 /// A 128-bit integer vector.
3146 /// \returns A 128-bit integer vector containing the comparison results.
3147 static __inline__ __m128i __DEFAULT_FN_ATTRS
3148 _mm_cmpeq_epi8(__m128i __a, __m128i __b)
3150 return (__m128i)((__v16qi)__a == (__v16qi)__b);
3153 /// Compares each of the corresponding 16-bit values of the 128-bit
3154 /// integer vectors for equality. Each comparison yields 0x0 for false,
3155 /// 0xFFFF for true.
3157 /// \headerfile <x86intrin.h>
3159 /// This intrinsic corresponds to the <c> VPCMPEQW / PCMPEQW </c> instruction.
3162 /// A 128-bit integer vector.
3164 /// A 128-bit integer vector.
3165 /// \returns A 128-bit integer vector containing the comparison results.
3166 static __inline__ __m128i __DEFAULT_FN_ATTRS
3167 _mm_cmpeq_epi16(__m128i __a, __m128i __b)
3169 return (__m128i)((__v8hi)__a == (__v8hi)__b);
3172 /// Compares each of the corresponding 32-bit values of the 128-bit
3173 /// integer vectors for equality. Each comparison yields 0x0 for false,
3174 /// 0xFFFFFFFF for true.
3176 /// \headerfile <x86intrin.h>
3178 /// This intrinsic corresponds to the <c> VPCMPEQD / PCMPEQD </c> instruction.
3181 /// A 128-bit integer vector.
3183 /// A 128-bit integer vector.
3184 /// \returns A 128-bit integer vector containing the comparison results.
3185 static __inline__ __m128i __DEFAULT_FN_ATTRS
3186 _mm_cmpeq_epi32(__m128i __a, __m128i __b)
3188 return (__m128i)((__v4si)__a == (__v4si)__b);
3191 /// Compares each of the corresponding signed 8-bit values of the 128-bit
3192 /// integer vectors to determine if the values in the first operand are
3193 /// greater than those in the second operand. Each comparison yields 0x0 for
3194 /// false, 0xFF for true.
3196 /// \headerfile <x86intrin.h>
3198 /// This intrinsic corresponds to the <c> VPCMPGTB / PCMPGTB </c> instruction.
3201 /// A 128-bit integer vector.
3203 /// A 128-bit integer vector.
3204 /// \returns A 128-bit integer vector containing the comparison results.
3205 static __inline__ __m128i __DEFAULT_FN_ATTRS
3206 _mm_cmpgt_epi8(__m128i __a, __m128i __b)
3208 /* This function always performs a signed comparison, but __v16qi is a char
3209 which may be signed or unsigned, so use __v16qs. */
3210 return (__m128i)((__v16qs)__a > (__v16qs)__b);
3213 /// Compares each of the corresponding signed 16-bit values of the
3214 /// 128-bit integer vectors to determine if the values in the first operand
3215 /// are greater than those in the second operand.
3217 /// Each comparison yields 0x0 for false, 0xFFFF for true.
3219 /// \headerfile <x86intrin.h>
3221 /// This intrinsic corresponds to the <c> VPCMPGTW / PCMPGTW </c> instruction.
3224 /// A 128-bit integer vector.
3226 /// A 128-bit integer vector.
3227 /// \returns A 128-bit integer vector containing the comparison results.
3228 static __inline__ __m128i __DEFAULT_FN_ATTRS
3229 _mm_cmpgt_epi16(__m128i __a, __m128i __b)
3231 return (__m128i)((__v8hi)__a > (__v8hi)__b);
3234 /// Compares each of the corresponding signed 32-bit values of the
3235 /// 128-bit integer vectors to determine if the values in the first operand
3236 /// are greater than those in the second operand.
3238 /// Each comparison yields 0x0 for false, 0xFFFFFFFF for true.
3240 /// \headerfile <x86intrin.h>
3242 /// This intrinsic corresponds to the <c> VPCMPGTD / PCMPGTD </c> instruction.
3245 /// A 128-bit integer vector.
3247 /// A 128-bit integer vector.
3248 /// \returns A 128-bit integer vector containing the comparison results.
3249 static __inline__ __m128i __DEFAULT_FN_ATTRS
3250 _mm_cmpgt_epi32(__m128i __a, __m128i __b)
3252 return (__m128i)((__v4si)__a > (__v4si)__b);
3255 /// Compares each of the corresponding signed 8-bit values of the 128-bit
3256 /// integer vectors to determine if the values in the first operand are less
3257 /// than those in the second operand.
3259 /// Each comparison yields 0x0 for false, 0xFF for true.
3261 /// \headerfile <x86intrin.h>
3263 /// This intrinsic corresponds to the <c> VPCMPGTB / PCMPGTB </c> instruction.
3266 /// A 128-bit integer vector.
3268 /// A 128-bit integer vector.
3269 /// \returns A 128-bit integer vector containing the comparison results.
3270 static __inline__ __m128i __DEFAULT_FN_ATTRS
3271 _mm_cmplt_epi8(__m128i __a, __m128i __b)
3273 return _mm_cmpgt_epi8(__b, __a);
3276 /// Compares each of the corresponding signed 16-bit values of the
3277 /// 128-bit integer vectors to determine if the values in the first operand
3278 /// are less than those in the second operand.
3280 /// Each comparison yields 0x0 for false, 0xFFFF for true.
3282 /// \headerfile <x86intrin.h>
3284 /// This intrinsic corresponds to the <c> VPCMPGTW / PCMPGTW </c> instruction.
3287 /// A 128-bit integer vector.
3289 /// A 128-bit integer vector.
3290 /// \returns A 128-bit integer vector containing the comparison results.
3291 static __inline__ __m128i __DEFAULT_FN_ATTRS
3292 _mm_cmplt_epi16(__m128i __a, __m128i __b)
3294 return _mm_cmpgt_epi16(__b, __a);
3297 /// Compares each of the corresponding signed 32-bit values of the
3298 /// 128-bit integer vectors to determine if the values in the first operand
3299 /// are less than those in the second operand.
3301 /// Each comparison yields 0x0 for false, 0xFFFFFFFF for true.
3303 /// \headerfile <x86intrin.h>
3305 /// This intrinsic corresponds to the <c> VPCMPGTD / PCMPGTD </c> instruction.
3308 /// A 128-bit integer vector.
3310 /// A 128-bit integer vector.
3311 /// \returns A 128-bit integer vector containing the comparison results.
3312 static __inline__ __m128i __DEFAULT_FN_ATTRS
3313 _mm_cmplt_epi32(__m128i __a, __m128i __b)
3315 return _mm_cmpgt_epi32(__b, __a);
3319 /// Converts a 64-bit signed integer value from the second operand into a
3320 /// double-precision value and returns it in the lower element of a [2 x
3321 /// double] vector; the upper element of the returned vector is copied from
3322 /// the upper element of the first operand.
3324 /// \headerfile <x86intrin.h>
3326 /// This intrinsic corresponds to the <c> VCVTSI2SD / CVTSI2SD </c> instruction.
3329 /// A 128-bit vector of [2 x double]. The upper 64 bits of this operand are
3330 /// copied to the upper 64 bits of the destination.
3332 /// A 64-bit signed integer operand containing the value to be converted.
3333 /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
3334 /// converted value of the second operand. The upper 64 bits are copied from
3335 /// the upper 64 bits of the first operand.
3336 static __inline__ __m128d __DEFAULT_FN_ATTRS
3337 _mm_cvtsi64_sd(__m128d __a, long long __b)
3343 /// Converts the first (lower) element of a vector of [2 x double] into a
3344 /// 64-bit signed integer value, according to the current rounding mode.
3346 /// \headerfile <x86intrin.h>
3348 /// This intrinsic corresponds to the <c> VCVTSD2SI / CVTSD2SI </c> instruction.
3351 /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the
3353 /// \returns A 64-bit signed integer containing the converted value.
3354 static __inline__ long long __DEFAULT_FN_ATTRS
3355 _mm_cvtsd_si64(__m128d __a)
3357 return __builtin_ia32_cvtsd2si64((__v2df)__a);
3360 /// Converts the first (lower) element of a vector of [2 x double] into a
3361 /// 64-bit signed integer value, truncating the result when it is inexact.
3363 /// \headerfile <x86intrin.h>
3365 /// This intrinsic corresponds to the <c> VCVTTSD2SI / CVTTSD2SI </c>
3369 /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the
3371 /// \returns A 64-bit signed integer containing the converted value.
3372 static __inline__ long long __DEFAULT_FN_ATTRS
3373 _mm_cvttsd_si64(__m128d __a)
3375 return __builtin_ia32_cvttsd2si64((__v2df)__a);
3379 /// Converts a vector of [4 x i32] into a vector of [4 x float].
3381 /// \headerfile <x86intrin.h>
3383 /// This intrinsic corresponds to the <c> VCVTDQ2PS / CVTDQ2PS </c> instruction.
3386 /// A 128-bit integer vector.
3387 /// \returns A 128-bit vector of [4 x float] containing the converted values.
3388 static __inline__ __m128 __DEFAULT_FN_ATTRS
3389 _mm_cvtepi32_ps(__m128i __a)
3391 return (__m128)__builtin_convertvector((__v4si)__a, __v4sf);
3394 /// Converts a vector of [4 x float] into a vector of [4 x i32].
3396 /// \headerfile <x86intrin.h>
3398 /// This intrinsic corresponds to the <c> VCVTPS2DQ / CVTPS2DQ </c> instruction.
3401 /// A 128-bit vector of [4 x float].
3402 /// \returns A 128-bit integer vector of [4 x i32] containing the converted
3404 static __inline__ __m128i __DEFAULT_FN_ATTRS
3405 _mm_cvtps_epi32(__m128 __a)
3407 return (__m128i)__builtin_ia32_cvtps2dq((__v4sf)__a);
3410 /// Converts a vector of [4 x float] into a vector of [4 x i32],
3411 /// truncating the result when it is inexact.
3413 /// \headerfile <x86intrin.h>
3415 /// This intrinsic corresponds to the <c> VCVTTPS2DQ / CVTTPS2DQ </c>
3419 /// A 128-bit vector of [4 x float].
3420 /// \returns A 128-bit vector of [4 x i32] containing the converted values.
3421 static __inline__ __m128i __DEFAULT_FN_ATTRS
3422 _mm_cvttps_epi32(__m128 __a)
3424 return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a);
3427 /// Returns a vector of [4 x i32] where the lowest element is the input
3428 /// operand and the remaining elements are zero.
3430 /// \headerfile <x86intrin.h>
3432 /// This intrinsic corresponds to the <c> VMOVD / MOVD </c> instruction.
3435 /// A 32-bit signed integer operand.
3436 /// \returns A 128-bit vector of [4 x i32].
3437 static __inline__ __m128i __DEFAULT_FN_ATTRS
3438 _mm_cvtsi32_si128(int __a)
3440 return __extension__ (__m128i)(__v4si){ __a, 0, 0, 0 };
3444 /// Returns a vector of [2 x i64] where the lower element is the input
3445 /// operand and the upper element is zero.
3447 /// \headerfile <x86intrin.h>
3449 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3452 /// A 64-bit signed integer operand containing the value to be converted.
3453 /// \returns A 128-bit vector of [2 x i64] containing the converted value.
3454 static __inline__ __m128i __DEFAULT_FN_ATTRS
3455 _mm_cvtsi64_si128(long long __a)
3457 return __extension__ (__m128i)(__v2di){ __a, 0 };
3461 /// Moves the least significant 32 bits of a vector of [4 x i32] to a
3462 /// 32-bit signed integer value.
3464 /// \headerfile <x86intrin.h>
3466 /// This intrinsic corresponds to the <c> VMOVD / MOVD </c> instruction.
3469 /// A vector of [4 x i32]. The least significant 32 bits are moved to the
3471 /// \returns A 32-bit signed integer containing the moved value.
3472 static __inline__ int __DEFAULT_FN_ATTRS
3473 _mm_cvtsi128_si32(__m128i __a)
3475 __v4si __b = (__v4si)__a;
3480 /// Moves the least significant 64 bits of a vector of [2 x i64] to a
3481 /// 64-bit signed integer value.
3483 /// \headerfile <x86intrin.h>
3485 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3488 /// A vector of [2 x i64]. The least significant 64 bits are moved to the
3490 /// \returns A 64-bit signed integer containing the moved value.
3491 static __inline__ long long __DEFAULT_FN_ATTRS
3492 _mm_cvtsi128_si64(__m128i __a)
3498 /// Moves packed integer values from an aligned 128-bit memory location
3499 /// to elements in a 128-bit integer vector.
3501 /// \headerfile <x86intrin.h>
3503 /// This intrinsic corresponds to the <c> VMOVDQA / MOVDQA </c> instruction.
3506 /// An aligned pointer to a memory location containing integer values.
3507 /// \returns A 128-bit integer vector containing the moved values.
3508 static __inline__ __m128i __DEFAULT_FN_ATTRS
3509 _mm_load_si128(__m128i const *__p)
3514 /// Moves packed integer values from an unaligned 128-bit memory location
3515 /// to elements in a 128-bit integer vector.
3517 /// \headerfile <x86intrin.h>
3519 /// This intrinsic corresponds to the <c> VMOVDQU / MOVDQU </c> instruction.
3522 /// A pointer to a memory location containing integer values.
3523 /// \returns A 128-bit integer vector containing the moved values.
3524 static __inline__ __m128i __DEFAULT_FN_ATTRS
3525 _mm_loadu_si128(__m128i const *__p)
3527 struct __loadu_si128 {
3529 } __attribute__((__packed__, __may_alias__));
3530 return ((struct __loadu_si128*)__p)->__v;
3533 /// Returns a vector of [2 x i64] where the lower element is taken from
3534 /// the lower element of the operand, and the upper element is zero.
3536 /// \headerfile <x86intrin.h>
3538 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3541 /// A 128-bit vector of [2 x i64]. Bits [63:0] are written to bits [63:0] of
3542 /// the destination.
3543 /// \returns A 128-bit vector of [2 x i64]. The lower order bits contain the
3544 /// moved value. The higher order bits are cleared.
3545 static __inline__ __m128i __DEFAULT_FN_ATTRS
3546 _mm_loadl_epi64(__m128i const *__p)
3548 struct __mm_loadl_epi64_struct {
3550 } __attribute__((__packed__, __may_alias__));
3551 return __extension__ (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0};
3554 /// Generates a 128-bit vector of [4 x i32] with unspecified content.
3555 /// This could be used as an argument to another intrinsic function where the
3556 /// argument is required but the value is not actually used.
3558 /// \headerfile <x86intrin.h>
3560 /// This intrinsic has no corresponding instruction.
3562 /// \returns A 128-bit vector of [4 x i32] with unspecified content.
3563 static __inline__ __m128i __DEFAULT_FN_ATTRS
3564 _mm_undefined_si128(void)
3566 return (__m128i)__builtin_ia32_undef128();
3569 /// Initializes both 64-bit values in a 128-bit vector of [2 x i64] with
3570 /// the specified 64-bit integer values.
3572 /// \headerfile <x86intrin.h>
3574 /// This intrinsic is a utility function and does not correspond to a specific
3578 /// A 64-bit integer value used to initialize the upper 64 bits of the
3579 /// destination vector of [2 x i64].
3581 /// A 64-bit integer value used to initialize the lower 64 bits of the
3582 /// destination vector of [2 x i64].
3583 /// \returns An initialized 128-bit vector of [2 x i64] containing the values
3584 /// provided in the operands.
3585 static __inline__ __m128i __DEFAULT_FN_ATTRS
3586 _mm_set_epi64x(long long __q1, long long __q0)
3588 return __extension__ (__m128i)(__v2di){ __q0, __q1 };
3591 /// Initializes both 64-bit values in a 128-bit vector of [2 x i64] with
3592 /// the specified 64-bit integer values.
3594 /// \headerfile <x86intrin.h>
3596 /// This intrinsic is a utility function and does not correspond to a specific
3600 /// A 64-bit integer value used to initialize the upper 64 bits of the
3601 /// destination vector of [2 x i64].
3603 /// A 64-bit integer value used to initialize the lower 64 bits of the
3604 /// destination vector of [2 x i64].
3605 /// \returns An initialized 128-bit vector of [2 x i64] containing the values
3606 /// provided in the operands.
3607 static __inline__ __m128i __DEFAULT_FN_ATTRS
3608 _mm_set_epi64(__m64 __q1, __m64 __q0)
3610 return _mm_set_epi64x((long long)__q1, (long long)__q0);
3613 /// Initializes the 32-bit values in a 128-bit vector of [4 x i32] with
3614 /// the specified 32-bit integer values.
3616 /// \headerfile <x86intrin.h>
3618 /// This intrinsic is a utility function and does not correspond to a specific
3622 /// A 32-bit integer value used to initialize bits [127:96] of the
3623 /// destination vector.
3625 /// A 32-bit integer value used to initialize bits [95:64] of the destination
3628 /// A 32-bit integer value used to initialize bits [63:32] of the destination
3631 /// A 32-bit integer value used to initialize bits [31:0] of the destination
3633 /// \returns An initialized 128-bit vector of [4 x i32] containing the values
3634 /// provided in the operands.
3635 static __inline__ __m128i __DEFAULT_FN_ATTRS
3636 _mm_set_epi32(int __i3, int __i2, int __i1, int __i0)
3638 return __extension__ (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
3641 /// Initializes the 16-bit values in a 128-bit vector of [8 x i16] with
3642 /// the specified 16-bit integer values.
3644 /// \headerfile <x86intrin.h>
3646 /// This intrinsic is a utility function and does not correspond to a specific
3650 /// A 16-bit integer value used to initialize bits [127:112] of the
3651 /// destination vector.
3653 /// A 16-bit integer value used to initialize bits [111:96] of the
3654 /// destination vector.
3656 /// A 16-bit integer value used to initialize bits [95:80] of the destination
3659 /// A 16-bit integer value used to initialize bits [79:64] of the destination
3662 /// A 16-bit integer value used to initialize bits [63:48] of the destination
3665 /// A 16-bit integer value used to initialize bits [47:32] of the destination
3668 /// A 16-bit integer value used to initialize bits [31:16] of the destination
3671 /// A 16-bit integer value used to initialize bits [15:0] of the destination
3673 /// \returns An initialized 128-bit vector of [8 x i16] containing the values
3674 /// provided in the operands.
3675 static __inline__ __m128i __DEFAULT_FN_ATTRS
3676 _mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, short __w2, short __w1, short __w0)
3678 return __extension__ (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
3681 /// Initializes the 8-bit values in a 128-bit vector of [16 x i8] with
3682 /// the specified 8-bit integer values.
3684 /// \headerfile <x86intrin.h>
3686 /// This intrinsic is a utility function and does not correspond to a specific
3690 /// Initializes bits [127:120] of the destination vector.
3692 /// Initializes bits [119:112] of the destination vector.
3694 /// Initializes bits [111:104] of the destination vector.
3696 /// Initializes bits [103:96] of the destination vector.
3698 /// Initializes bits [95:88] of the destination vector.
3700 /// Initializes bits [87:80] of the destination vector.
3702 /// Initializes bits [79:72] of the destination vector.
3704 /// Initializes bits [71:64] of the destination vector.
3706 /// Initializes bits [63:56] of the destination vector.
3708 /// Initializes bits [55:48] of the destination vector.
3710 /// Initializes bits [47:40] of the destination vector.
3712 /// Initializes bits [39:32] of the destination vector.
3714 /// Initializes bits [31:24] of the destination vector.
3716 /// Initializes bits [23:16] of the destination vector.
3718 /// Initializes bits [15:8] of the destination vector.
3720 /// Initializes bits [7:0] of the destination vector.
3721 /// \returns An initialized 128-bit vector of [16 x i8] containing the values
3722 /// provided in the operands.
3723 static __inline__ __m128i __DEFAULT_FN_ATTRS
3724 _mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0)
3726 return __extension__ (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
3729 /// Initializes both values in a 128-bit integer vector with the
3730 /// specified 64-bit integer value.
3732 /// \headerfile <x86intrin.h>
3734 /// This intrinsic is a utility function and does not correspond to a specific
3738 /// Integer value used to initialize the elements of the destination integer
3740 /// \returns An initialized 128-bit integer vector of [2 x i64] with both
3741 /// elements containing the value provided in the operand.
3742 static __inline__ __m128i __DEFAULT_FN_ATTRS
3743 _mm_set1_epi64x(long long __q)
3745 return _mm_set_epi64x(__q, __q);
3748 /// Initializes both values in a 128-bit vector of [2 x i64] with the
3749 /// specified 64-bit value.
3751 /// \headerfile <x86intrin.h>
3753 /// This intrinsic is a utility function and does not correspond to a specific
3757 /// A 64-bit value used to initialize the elements of the destination integer
3759 /// \returns An initialized 128-bit vector of [2 x i64] with all elements
3760 /// containing the value provided in the operand.
3761 static __inline__ __m128i __DEFAULT_FN_ATTRS
3762 _mm_set1_epi64(__m64 __q)
3764 return _mm_set_epi64(__q, __q);
3767 /// Initializes all values in a 128-bit vector of [4 x i32] with the
3768 /// specified 32-bit value.
3770 /// \headerfile <x86intrin.h>
3772 /// This intrinsic is a utility function and does not correspond to a specific
3776 /// A 32-bit value used to initialize the elements of the destination integer
3778 /// \returns An initialized 128-bit vector of [4 x i32] with all elements
3779 /// containing the value provided in the operand.
3780 static __inline__ __m128i __DEFAULT_FN_ATTRS
3781 _mm_set1_epi32(int __i)
3783 return _mm_set_epi32(__i, __i, __i, __i);
3786 /// Initializes all values in a 128-bit vector of [8 x i16] with the
3787 /// specified 16-bit value.
3789 /// \headerfile <x86intrin.h>
3791 /// This intrinsic is a utility function and does not correspond to a specific
3795 /// A 16-bit value used to initialize the elements of the destination integer
3797 /// \returns An initialized 128-bit vector of [8 x i16] with all elements
3798 /// containing the value provided in the operand.
3799 static __inline__ __m128i __DEFAULT_FN_ATTRS
3800 _mm_set1_epi16(short __w)
3802 return _mm_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w);
3805 /// Initializes all values in a 128-bit vector of [16 x i8] with the
3806 /// specified 8-bit value.
3808 /// \headerfile <x86intrin.h>
3810 /// This intrinsic is a utility function and does not correspond to a specific
3814 /// An 8-bit value used to initialize the elements of the destination integer
3816 /// \returns An initialized 128-bit vector of [16 x i8] with all elements
3817 /// containing the value provided in the operand.
3818 static __inline__ __m128i __DEFAULT_FN_ATTRS
3819 _mm_set1_epi8(char __b)
3821 return _mm_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b);
3824 /// Constructs a 128-bit integer vector, initialized in reverse order
3825 /// with the specified 64-bit integral values.
3827 /// \headerfile <x86intrin.h>
3829 /// This intrinsic does not correspond to a specific instruction.
3832 /// A 64-bit integral value used to initialize the lower 64 bits of the
3835 /// A 64-bit integral value used to initialize the upper 64 bits of the
3837 /// \returns An initialized 128-bit integer vector.
3838 static __inline__ __m128i __DEFAULT_FN_ATTRS
3839 _mm_setr_epi64(__m64 __q0, __m64 __q1)
3841 return _mm_set_epi64(__q1, __q0);
3844 /// Constructs a 128-bit integer vector, initialized in reverse order
3845 /// with the specified 32-bit integral values.
3847 /// \headerfile <x86intrin.h>
3849 /// This intrinsic is a utility function and does not correspond to a specific
3853 /// A 32-bit integral value used to initialize bits [31:0] of the result.
3855 /// A 32-bit integral value used to initialize bits [63:32] of the result.
3857 /// A 32-bit integral value used to initialize bits [95:64] of the result.
3859 /// A 32-bit integral value used to initialize bits [127:96] of the result.
3860 /// \returns An initialized 128-bit integer vector.
3861 static __inline__ __m128i __DEFAULT_FN_ATTRS
3862 _mm_setr_epi32(int __i0, int __i1, int __i2, int __i3)
3864 return _mm_set_epi32(__i3, __i2, __i1, __i0);
3867 /// Constructs a 128-bit integer vector, initialized in reverse order
3868 /// with the specified 16-bit integral values.
3870 /// \headerfile <x86intrin.h>
3872 /// This intrinsic is a utility function and does not correspond to a specific
3876 /// A 16-bit integral value used to initialize bits [15:0] of the result.
3878 /// A 16-bit integral value used to initialize bits [31:16] of the result.
3880 /// A 16-bit integral value used to initialize bits [47:32] of the result.
3882 /// A 16-bit integral value used to initialize bits [63:48] of the result.
3884 /// A 16-bit integral value used to initialize bits [79:64] of the result.
3886 /// A 16-bit integral value used to initialize bits [95:80] of the result.
3888 /// A 16-bit integral value used to initialize bits [111:96] of the result.
3890 /// A 16-bit integral value used to initialize bits [127:112] of the result.
3891 /// \returns An initialized 128-bit integer vector.
3892 static __inline__ __m128i __DEFAULT_FN_ATTRS
3893 _mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, short __w5, short __w6, short __w7)
3895 return _mm_set_epi16(__w7, __w6, __w5, __w4, __w3, __w2, __w1, __w0);
3898 /// Constructs a 128-bit integer vector, initialized in reverse order
3899 /// with the specified 8-bit integral values.
3901 /// \headerfile <x86intrin.h>
3903 /// This intrinsic is a utility function and does not correspond to a specific
3907 /// An 8-bit integral value used to initialize bits [7:0] of the result.
3909 /// An 8-bit integral value used to initialize bits [15:8] of the result.
3911 /// An 8-bit integral value used to initialize bits [23:16] of the result.
3913 /// An 8-bit integral value used to initialize bits [31:24] of the result.
3915 /// An 8-bit integral value used to initialize bits [39:32] of the result.
3917 /// An 8-bit integral value used to initialize bits [47:40] of the result.
3919 /// An 8-bit integral value used to initialize bits [55:48] of the result.
3921 /// An 8-bit integral value used to initialize bits [63:56] of the result.
3923 /// An 8-bit integral value used to initialize bits [71:64] of the result.
3925 /// An 8-bit integral value used to initialize bits [79:72] of the result.
3927 /// An 8-bit integral value used to initialize bits [87:80] of the result.
3929 /// An 8-bit integral value used to initialize bits [95:88] of the result.
3931 /// An 8-bit integral value used to initialize bits [103:96] of the result.
3933 /// An 8-bit integral value used to initialize bits [111:104] of the result.
3935 /// An 8-bit integral value used to initialize bits [119:112] of the result.
3937 /// An 8-bit integral value used to initialize bits [127:120] of the result.
3938 /// \returns An initialized 128-bit integer vector.
3939 static __inline__ __m128i __DEFAULT_FN_ATTRS
3940 _mm_setr_epi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7, char __b8, char __b9, char __b10, char __b11, char __b12, char __b13, char __b14, char __b15)
3942 return _mm_set_epi8(__b15, __b14, __b13, __b12, __b11, __b10, __b9, __b8, __b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
3945 /// Creates a 128-bit integer vector initialized to zero.
3947 /// \headerfile <x86intrin.h>
3949 /// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
3951 /// \returns An initialized 128-bit integer vector with all elements set to
3953 static __inline__ __m128i __DEFAULT_FN_ATTRS
3954 _mm_setzero_si128(void)
3956 return __extension__ (__m128i)(__v2di){ 0LL, 0LL };
3959 /// Stores a 128-bit integer vector to a memory location aligned on a
3960 /// 128-bit boundary.
3962 /// \headerfile <x86intrin.h>
3964 /// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
3967 /// A pointer to an aligned memory location that will receive the integer
3970 /// A 128-bit integer vector containing the values to be moved.
3971 static __inline__ void __DEFAULT_FN_ATTRS
3972 _mm_store_si128(__m128i *__p, __m128i __b)
3977 /// Stores a 128-bit integer vector to an unaligned memory location.
3979 /// \headerfile <x86intrin.h>
3981 /// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
3984 /// A pointer to a memory location that will receive the integer values.
3986 /// A 128-bit integer vector containing the values to be moved.
3987 static __inline__ void __DEFAULT_FN_ATTRS
3988 _mm_storeu_si128(__m128i *__p, __m128i __b)
3990 struct __storeu_si128 {
3992 } __attribute__((__packed__, __may_alias__));
3993 ((struct __storeu_si128*)__p)->__v = __b;
3996 /// Moves bytes selected by the mask from the first operand to the
3997 /// specified unaligned memory location. When a mask bit is 1, the
3998 /// corresponding byte is written, otherwise it is not written.
4000 /// To minimize caching, the data is flagged as non-temporal (unlikely to be
4001 /// used again soon). Exception and trap behavior for elements not selected
4002 /// for storage to memory are implementation dependent.
4004 /// \headerfile <x86intrin.h>
4006 /// This intrinsic corresponds to the <c> VMASKMOVDQU / MASKMOVDQU </c>
4010 /// A 128-bit integer vector containing the values to be moved.
4012 /// A 128-bit integer vector containing the mask. The most significant bit of
4013 /// each byte represents the mask bits.
4015 /// A pointer to an unaligned 128-bit memory location where the specified
4016 /// values are moved.
4017 static __inline__ void __DEFAULT_FN_ATTRS
4018 _mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p)
4020 __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p);
4023 /// Stores the lower 64 bits of a 128-bit integer vector of [2 x i64] to
4024 /// a memory location.
4026 /// \headerfile <x86intrin.h>
4028 /// This intrinsic corresponds to the <c> VMOVLPS / MOVLPS </c> instruction.
4031 /// A pointer to a 64-bit memory location that will receive the lower 64 bits
4032 /// of the integer vector parameter.
4034 /// A 128-bit integer vector of [2 x i64]. The lower 64 bits contain the
4035 /// value to be stored.
4036 static __inline__ void __DEFAULT_FN_ATTRS
4037 _mm_storel_epi64(__m128i *__p, __m128i __a)
4039 struct __mm_storel_epi64_struct {
4041 } __attribute__((__packed__, __may_alias__));
4042 ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0];
4045 /// Stores a 128-bit floating point vector of [2 x double] to a 128-bit
4046 /// aligned memory location.
4048 /// To minimize caching, the data is flagged as non-temporal (unlikely to be
4049 /// used again soon).
4051 /// \headerfile <x86intrin.h>
4053 /// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
4056 /// A pointer to the 128-bit aligned memory location used to store the value.
4058 /// A vector of [2 x double] containing the 64-bit values to be stored.
4059 static __inline__ void __DEFAULT_FN_ATTRS
4060 _mm_stream_pd(double *__p, __m128d __a)
4062 __builtin_nontemporal_store((__v2df)__a, (__v2df*)__p);
4065 /// Stores a 128-bit integer vector to a 128-bit aligned memory location.
4067 /// To minimize caching, the data is flagged as non-temporal (unlikely to be
4068 /// used again soon).
4070 /// \headerfile <x86intrin.h>
4072 /// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
4075 /// A pointer to the 128-bit aligned memory location used to store the value.
4077 /// A 128-bit integer vector containing the values to be stored.
4078 static __inline__ void __DEFAULT_FN_ATTRS
4079 _mm_stream_si128(__m128i *__p, __m128i __a)
4081 __builtin_nontemporal_store((__v2di)__a, (__v2di*)__p);
4084 /// Stores a 32-bit integer value in the specified memory location.
4086 /// To minimize caching, the data is flagged as non-temporal (unlikely to be
4087 /// used again soon).
4089 /// \headerfile <x86intrin.h>
4091 /// This intrinsic corresponds to the <c> MOVNTI </c> instruction.
4094 /// A pointer to the 32-bit memory location used to store the value.
4096 /// A 32-bit integer containing the value to be stored.
4097 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
4098 _mm_stream_si32(int *__p, int __a)
4100 __builtin_ia32_movnti(__p, __a);
4104 /// Stores a 64-bit integer value in the specified memory location.
4106 /// To minimize caching, the data is flagged as non-temporal (unlikely to be
4107 /// used again soon).
4109 /// \headerfile <x86intrin.h>
4111 /// This intrinsic corresponds to the <c> MOVNTIQ </c> instruction.
4114 /// A pointer to the 64-bit memory location used to store the value.
4116 /// A 64-bit integer containing the value to be stored.
4117 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
4118 _mm_stream_si64(long long *__p, long long __a)
4120 __builtin_ia32_movnti64(__p, __a);
4124 #if defined(__cplusplus)
4128 /// The cache line containing \a __p is flushed and invalidated from all
4129 /// caches in the coherency domain.
4131 /// \headerfile <x86intrin.h>
4133 /// This intrinsic corresponds to the <c> CLFLUSH </c> instruction.
4136 /// A pointer to the memory location used to identify the cache line to be
4138 void _mm_clflush(void const * __p);
4140 /// Forces strong memory ordering (serialization) between load
4141 /// instructions preceding this instruction and load instructions following
4142 /// this instruction, ensuring the system completes all previous loads before
4143 /// executing subsequent loads.
4145 /// \headerfile <x86intrin.h>
4147 /// This intrinsic corresponds to the <c> LFENCE </c> instruction.
4149 void _mm_lfence(void);
4151 /// Forces strong memory ordering (serialization) between load and store
4152 /// instructions preceding this instruction and load and store instructions
4153 /// following this instruction, ensuring that the system completes all
4154 /// previous memory accesses before executing subsequent memory accesses.
4156 /// \headerfile <x86intrin.h>
4158 /// This intrinsic corresponds to the <c> MFENCE </c> instruction.
4160 void _mm_mfence(void);
4162 #if defined(__cplusplus)
4166 /// Converts 16-bit signed integers from both 128-bit integer vector
4167 /// operands into 8-bit signed integers, and packs the results into the
4168 /// destination. Positive values greater than 0x7F are saturated to 0x7F.
4169 /// Negative values less than 0x80 are saturated to 0x80.
4171 /// \headerfile <x86intrin.h>
4173 /// This intrinsic corresponds to the <c> VPACKSSWB / PACKSSWB </c> instruction.
4176 /// A 128-bit integer vector of [8 x i16]. Each 16-bit element is treated as
4177 /// a signed integer and is converted to a 8-bit signed integer with
4178 /// saturation. Values greater than 0x7F are saturated to 0x7F. Values less
4179 /// than 0x80 are saturated to 0x80. The converted [8 x i8] values are
4180 /// written to the lower 64 bits of the result.
4182 /// A 128-bit integer vector of [8 x i16]. Each 16-bit element is treated as
4183 /// a signed integer and is converted to a 8-bit signed integer with
4184 /// saturation. Values greater than 0x7F are saturated to 0x7F. Values less
4185 /// than 0x80 are saturated to 0x80. The converted [8 x i8] values are
4186 /// written to the higher 64 bits of the result.
4187 /// \returns A 128-bit vector of [16 x i8] containing the converted values.
4188 static __inline__ __m128i __DEFAULT_FN_ATTRS
4189 _mm_packs_epi16(__m128i __a, __m128i __b)
4191 return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b);
4194 /// Converts 32-bit signed integers from both 128-bit integer vector
4195 /// operands into 16-bit signed integers, and packs the results into the
4196 /// destination. Positive values greater than 0x7FFF are saturated to 0x7FFF.
4197 /// Negative values less than 0x8000 are saturated to 0x8000.
4199 /// \headerfile <x86intrin.h>
4201 /// This intrinsic corresponds to the <c> VPACKSSDW / PACKSSDW </c> instruction.
4204 /// A 128-bit integer vector of [4 x i32]. Each 32-bit element is treated as
4205 /// a signed integer and is converted to a 16-bit signed integer with
4206 /// saturation. Values greater than 0x7FFF are saturated to 0x7FFF. Values
4207 /// less than 0x8000 are saturated to 0x8000. The converted [4 x i16] values
4208 /// are written to the lower 64 bits of the result.
4210 /// A 128-bit integer vector of [4 x i32]. Each 32-bit element is treated as
4211 /// a signed integer and is converted to a 16-bit signed integer with
4212 /// saturation. Values greater than 0x7FFF are saturated to 0x7FFF. Values
4213 /// less than 0x8000 are saturated to 0x8000. The converted [4 x i16] values
4214 /// are written to the higher 64 bits of the result.
4215 /// \returns A 128-bit vector of [8 x i16] containing the converted values.
4216 static __inline__ __m128i __DEFAULT_FN_ATTRS
4217 _mm_packs_epi32(__m128i __a, __m128i __b)
4219 return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b);
4222 /// Converts 16-bit signed integers from both 128-bit integer vector
4223 /// operands into 8-bit unsigned integers, and packs the results into the
4224 /// destination. Values greater than 0xFF are saturated to 0xFF. Values less
4225 /// than 0x00 are saturated to 0x00.
4227 /// \headerfile <x86intrin.h>
4229 /// This intrinsic corresponds to the <c> VPACKUSWB / PACKUSWB </c> instruction.
4232 /// A 128-bit integer vector of [8 x i16]. Each 16-bit element is treated as
4233 /// a signed integer and is converted to an 8-bit unsigned integer with
4234 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
4235 /// than 0x00 are saturated to 0x00. The converted [8 x i8] values are
4236 /// written to the lower 64 bits of the result.
4238 /// A 128-bit integer vector of [8 x i16]. Each 16-bit element is treated as
4239 /// a signed integer and is converted to an 8-bit unsigned integer with
4240 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
4241 /// than 0x00 are saturated to 0x00. The converted [8 x i8] values are
4242 /// written to the higher 64 bits of the result.
4243 /// \returns A 128-bit vector of [16 x i8] containing the converted values.
4244 static __inline__ __m128i __DEFAULT_FN_ATTRS
4245 _mm_packus_epi16(__m128i __a, __m128i __b)
4247 return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b);
4250 /// Extracts 16 bits from a 128-bit integer vector of [8 x i16], using
4251 /// the immediate-value parameter as a selector.
4253 /// \headerfile <x86intrin.h>
4255 /// This intrinsic corresponds to the <c> VPEXTRW / PEXTRW </c> instruction.
4258 /// A 128-bit integer vector.
4260 /// An immediate value. Bits [2:0] selects values from \a __a to be assigned
4261 /// to bits[15:0] of the result. \n
4262 /// 000: assign values from bits [15:0] of \a __a. \n
4263 /// 001: assign values from bits [31:16] of \a __a. \n
4264 /// 010: assign values from bits [47:32] of \a __a. \n
4265 /// 011: assign values from bits [63:48] of \a __a. \n
4266 /// 100: assign values from bits [79:64] of \a __a. \n
4267 /// 101: assign values from bits [95:80] of \a __a. \n
4268 /// 110: assign values from bits [111:96] of \a __a. \n
4269 /// 111: assign values from bits [127:112] of \a __a.
4270 /// \returns An integer, whose lower 16 bits are selected from the 128-bit
4271 /// integer vector parameter and the remaining bits are assigned zeros.
4272 #define _mm_extract_epi16(a, imm) \
4273 (int)(unsigned short)__builtin_ia32_vec_ext_v8hi((__v8hi)(__m128i)(a), \
4276 /// Constructs a 128-bit integer vector by first making a copy of the
4277 /// 128-bit integer vector parameter, and then inserting the lower 16 bits
4278 /// of an integer parameter into an offset specified by the immediate-value
4281 /// \headerfile <x86intrin.h>
4283 /// This intrinsic corresponds to the <c> VPINSRW / PINSRW </c> instruction.
4286 /// A 128-bit integer vector of [8 x i16]. This vector is copied to the
4287 /// result and then one of the eight elements in the result is replaced by
4288 /// the lower 16 bits of \a __b.
4290 /// An integer. The lower 16 bits of this parameter are written to the
4291 /// result beginning at an offset specified by \a __imm.
4293 /// An immediate value specifying the bit offset in the result at which the
4294 /// lower 16 bits of \a __b are written.
4295 /// \returns A 128-bit integer vector containing the constructed values.
4296 #define _mm_insert_epi16(a, b, imm) \
4297 (__m128i)__builtin_ia32_vec_set_v8hi((__v8hi)(__m128i)(a), (int)(b), \
4300 /// Copies the values of the most significant bits from each 8-bit
4301 /// element in a 128-bit integer vector of [16 x i8] to create a 16-bit mask
4302 /// value, zero-extends the value, and writes it to the destination.
4304 /// \headerfile <x86intrin.h>
4306 /// This intrinsic corresponds to the <c> VPMOVMSKB / PMOVMSKB </c> instruction.
4309 /// A 128-bit integer vector containing the values with bits to be extracted.
4310 /// \returns The most significant bits from each 8-bit element in \a __a,
4311 /// written to bits [15:0]. The other bits are assigned zeros.
4312 static __inline__ int __DEFAULT_FN_ATTRS
4313 _mm_movemask_epi8(__m128i __a)
4315 return __builtin_ia32_pmovmskb128((__v16qi)__a);
4318 /// Constructs a 128-bit integer vector by shuffling four 32-bit
4319 /// elements of a 128-bit integer vector parameter, using the immediate-value
4320 /// parameter as a specifier.
4322 /// \headerfile <x86intrin.h>
4325 /// __m128i _mm_shuffle_epi32(__m128i a, const int imm);
4328 /// This intrinsic corresponds to the <c> VPSHUFD / PSHUFD </c> instruction.
4331 /// A 128-bit integer vector containing the values to be copied.
4333 /// An immediate value containing an 8-bit value specifying which elements to
4334 /// copy from a. The destinations within the 128-bit destination are assigned
4335 /// values as follows: \n
4336 /// Bits [1:0] are used to assign values to bits [31:0] of the result. \n
4337 /// Bits [3:2] are used to assign values to bits [63:32] of the result. \n
4338 /// Bits [5:4] are used to assign values to bits [95:64] of the result. \n
4339 /// Bits [7:6] are used to assign values to bits [127:96] of the result. \n
4340 /// Bit value assignments: \n
4341 /// 00: assign values from bits [31:0] of \a a. \n
4342 /// 01: assign values from bits [63:32] of \a a. \n
4343 /// 10: assign values from bits [95:64] of \a a. \n
4344 /// 11: assign values from bits [127:96] of \a a.
4345 /// \returns A 128-bit integer vector containing the shuffled values.
4346 #define _mm_shuffle_epi32(a, imm) \
4347 (__m128i)__builtin_ia32_pshufd((__v4si)(__m128i)(a), (int)(imm))
4349 /// Constructs a 128-bit integer vector by shuffling four lower 16-bit
4350 /// elements of a 128-bit integer vector of [8 x i16], using the immediate
4351 /// value parameter as a specifier.
4353 /// \headerfile <x86intrin.h>
4356 /// __m128i _mm_shufflelo_epi16(__m128i a, const int imm);
4359 /// This intrinsic corresponds to the <c> VPSHUFLW / PSHUFLW </c> instruction.
4362 /// A 128-bit integer vector of [8 x i16]. Bits [127:64] are copied to bits
4363 /// [127:64] of the result.
4365 /// An 8-bit immediate value specifying which elements to copy from \a a. \n
4366 /// Bits[1:0] are used to assign values to bits [15:0] of the result. \n
4367 /// Bits[3:2] are used to assign values to bits [31:16] of the result. \n
4368 /// Bits[5:4] are used to assign values to bits [47:32] of the result. \n
4369 /// Bits[7:6] are used to assign values to bits [63:48] of the result. \n
4370 /// Bit value assignments: \n
4371 /// 00: assign values from bits [15:0] of \a a. \n
4372 /// 01: assign values from bits [31:16] of \a a. \n
4373 /// 10: assign values from bits [47:32] of \a a. \n
4374 /// 11: assign values from bits [63:48] of \a a. \n
4375 /// \returns A 128-bit integer vector containing the shuffled values.
4376 #define _mm_shufflelo_epi16(a, imm) \
4377 (__m128i)__builtin_ia32_pshuflw((__v8hi)(__m128i)(a), (int)(imm))
4379 /// Constructs a 128-bit integer vector by shuffling four upper 16-bit
4380 /// elements of a 128-bit integer vector of [8 x i16], using the immediate
4381 /// value parameter as a specifier.
4383 /// \headerfile <x86intrin.h>
4386 /// __m128i _mm_shufflehi_epi16(__m128i a, const int imm);
4389 /// This intrinsic corresponds to the <c> VPSHUFHW / PSHUFHW </c> instruction.
4392 /// A 128-bit integer vector of [8 x i16]. Bits [63:0] are copied to bits
4393 /// [63:0] of the result.
4395 /// An 8-bit immediate value specifying which elements to copy from \a a. \n
4396 /// Bits[1:0] are used to assign values to bits [79:64] of the result. \n
4397 /// Bits[3:2] are used to assign values to bits [95:80] of the result. \n
4398 /// Bits[5:4] are used to assign values to bits [111:96] of the result. \n
4399 /// Bits[7:6] are used to assign values to bits [127:112] of the result. \n
4400 /// Bit value assignments: \n
4401 /// 00: assign values from bits [79:64] of \a a. \n
4402 /// 01: assign values from bits [95:80] of \a a. \n
4403 /// 10: assign values from bits [111:96] of \a a. \n
4404 /// 11: assign values from bits [127:112] of \a a. \n
4405 /// \returns A 128-bit integer vector containing the shuffled values.
4406 #define _mm_shufflehi_epi16(a, imm) \
4407 (__m128i)__builtin_ia32_pshufhw((__v8hi)(__m128i)(a), (int)(imm))
4409 /// Unpacks the high-order (index 8-15) values from two 128-bit vectors
4410 /// of [16 x i8] and interleaves them into a 128-bit vector of [16 x i8].
4412 /// \headerfile <x86intrin.h>
4414 /// This intrinsic corresponds to the <c> VPUNPCKHBW / PUNPCKHBW </c>
4418 /// A 128-bit vector of [16 x i8].
4419 /// Bits [71:64] are written to bits [7:0] of the result. \n
4420 /// Bits [79:72] are written to bits [23:16] of the result. \n
4421 /// Bits [87:80] are written to bits [39:32] of the result. \n
4422 /// Bits [95:88] are written to bits [55:48] of the result. \n
4423 /// Bits [103:96] are written to bits [71:64] of the result. \n
4424 /// Bits [111:104] are written to bits [87:80] of the result. \n
4425 /// Bits [119:112] are written to bits [103:96] of the result. \n
4426 /// Bits [127:120] are written to bits [119:112] of the result.
4428 /// A 128-bit vector of [16 x i8]. \n
4429 /// Bits [71:64] are written to bits [15:8] of the result. \n
4430 /// Bits [79:72] are written to bits [31:24] of the result. \n
4431 /// Bits [87:80] are written to bits [47:40] of the result. \n
4432 /// Bits [95:88] are written to bits [63:56] of the result. \n
4433 /// Bits [103:96] are written to bits [79:72] of the result. \n
4434 /// Bits [111:104] are written to bits [95:88] of the result. \n
4435 /// Bits [119:112] are written to bits [111:104] of the result. \n
4436 /// Bits [127:120] are written to bits [127:120] of the result.
4437 /// \returns A 128-bit vector of [16 x i8] containing the interleaved values.
4438 static __inline__ __m128i __DEFAULT_FN_ATTRS
4439 _mm_unpackhi_epi8(__m128i __a, __m128i __b)
4441 return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
4444 /// Unpacks the high-order (index 4-7) values from two 128-bit vectors of
4445 /// [8 x i16] and interleaves them into a 128-bit vector of [8 x i16].
4447 /// \headerfile <x86intrin.h>
4449 /// This intrinsic corresponds to the <c> VPUNPCKHWD / PUNPCKHWD </c>
4453 /// A 128-bit vector of [8 x i16].
4454 /// Bits [79:64] are written to bits [15:0] of the result. \n
4455 /// Bits [95:80] are written to bits [47:32] of the result. \n
4456 /// Bits [111:96] are written to bits [79:64] of the result. \n
4457 /// Bits [127:112] are written to bits [111:96] of the result.
4459 /// A 128-bit vector of [8 x i16].
4460 /// Bits [79:64] are written to bits [31:16] of the result. \n
4461 /// Bits [95:80] are written to bits [63:48] of the result. \n
4462 /// Bits [111:96] are written to bits [95:80] of the result. \n
4463 /// Bits [127:112] are written to bits [127:112] of the result.
4464 /// \returns A 128-bit vector of [8 x i16] containing the interleaved values.
4465 static __inline__ __m128i __DEFAULT_FN_ATTRS
4466 _mm_unpackhi_epi16(__m128i __a, __m128i __b)
4468 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
4471 /// Unpacks the high-order (index 2,3) values from two 128-bit vectors of
4472 /// [4 x i32] and interleaves them into a 128-bit vector of [4 x i32].
4474 /// \headerfile <x86intrin.h>
4476 /// This intrinsic corresponds to the <c> VPUNPCKHDQ / PUNPCKHDQ </c>
4480 /// A 128-bit vector of [4 x i32]. \n
4481 /// Bits [95:64] are written to bits [31:0] of the destination. \n
4482 /// Bits [127:96] are written to bits [95:64] of the destination.
4484 /// A 128-bit vector of [4 x i32]. \n
4485 /// Bits [95:64] are written to bits [64:32] of the destination. \n
4486 /// Bits [127:96] are written to bits [127:96] of the destination.
4487 /// \returns A 128-bit vector of [4 x i32] containing the interleaved values.
4488 static __inline__ __m128i __DEFAULT_FN_ATTRS
4489 _mm_unpackhi_epi32(__m128i __a, __m128i __b)
4491 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3);
4494 /// Unpacks the high-order 64-bit elements from two 128-bit vectors of
4495 /// [2 x i64] and interleaves them into a 128-bit vector of [2 x i64].
4497 /// \headerfile <x86intrin.h>
4499 /// This intrinsic corresponds to the <c> VPUNPCKHQDQ / PUNPCKHQDQ </c>
4503 /// A 128-bit vector of [2 x i64]. \n
4504 /// Bits [127:64] are written to bits [63:0] of the destination.
4506 /// A 128-bit vector of [2 x i64]. \n
4507 /// Bits [127:64] are written to bits [127:64] of the destination.
4508 /// \returns A 128-bit vector of [2 x i64] containing the interleaved values.
4509 static __inline__ __m128i __DEFAULT_FN_ATTRS
4510 _mm_unpackhi_epi64(__m128i __a, __m128i __b)
4512 return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 1, 2+1);
4515 /// Unpacks the low-order (index 0-7) values from two 128-bit vectors of
4516 /// [16 x i8] and interleaves them into a 128-bit vector of [16 x i8].
4518 /// \headerfile <x86intrin.h>
4520 /// This intrinsic corresponds to the <c> VPUNPCKLBW / PUNPCKLBW </c>
4524 /// A 128-bit vector of [16 x i8]. \n
4525 /// Bits [7:0] are written to bits [7:0] of the result. \n
4526 /// Bits [15:8] are written to bits [23:16] of the result. \n
4527 /// Bits [23:16] are written to bits [39:32] of the result. \n
4528 /// Bits [31:24] are written to bits [55:48] of the result. \n
4529 /// Bits [39:32] are written to bits [71:64] of the result. \n
4530 /// Bits [47:40] are written to bits [87:80] of the result. \n
4531 /// Bits [55:48] are written to bits [103:96] of the result. \n
4532 /// Bits [63:56] are written to bits [119:112] of the result.
4534 /// A 128-bit vector of [16 x i8].
4535 /// Bits [7:0] are written to bits [15:8] of the result. \n
4536 /// Bits [15:8] are written to bits [31:24] of the result. \n
4537 /// Bits [23:16] are written to bits [47:40] of the result. \n
4538 /// Bits [31:24] are written to bits [63:56] of the result. \n
4539 /// Bits [39:32] are written to bits [79:72] of the result. \n
4540 /// Bits [47:40] are written to bits [95:88] of the result. \n
4541 /// Bits [55:48] are written to bits [111:104] of the result. \n
4542 /// Bits [63:56] are written to bits [127:120] of the result.
4543 /// \returns A 128-bit vector of [16 x i8] containing the interleaved values.
4544 static __inline__ __m128i __DEFAULT_FN_ATTRS
4545 _mm_unpacklo_epi8(__m128i __a, __m128i __b)
4547 return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7);
4550 /// Unpacks the low-order (index 0-3) values from each of the two 128-bit
4551 /// vectors of [8 x i16] and interleaves them into a 128-bit vector of
4554 /// \headerfile <x86intrin.h>
4556 /// This intrinsic corresponds to the <c> VPUNPCKLWD / PUNPCKLWD </c>
4560 /// A 128-bit vector of [8 x i16].
4561 /// Bits [15:0] are written to bits [15:0] of the result. \n
4562 /// Bits [31:16] are written to bits [47:32] of the result. \n
4563 /// Bits [47:32] are written to bits [79:64] of the result. \n
4564 /// Bits [63:48] are written to bits [111:96] of the result.
4566 /// A 128-bit vector of [8 x i16].
4567 /// Bits [15:0] are written to bits [31:16] of the result. \n
4568 /// Bits [31:16] are written to bits [63:48] of the result. \n
4569 /// Bits [47:32] are written to bits [95:80] of the result. \n
4570 /// Bits [63:48] are written to bits [127:112] of the result.
4571 /// \returns A 128-bit vector of [8 x i16] containing the interleaved values.
4572 static __inline__ __m128i __DEFAULT_FN_ATTRS
4573 _mm_unpacklo_epi16(__m128i __a, __m128i __b)
4575 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
4578 /// Unpacks the low-order (index 0,1) values from two 128-bit vectors of
4579 /// [4 x i32] and interleaves them into a 128-bit vector of [4 x i32].
4581 /// \headerfile <x86intrin.h>
4583 /// This intrinsic corresponds to the <c> VPUNPCKLDQ / PUNPCKLDQ </c>
4587 /// A 128-bit vector of [4 x i32]. \n
4588 /// Bits [31:0] are written to bits [31:0] of the destination. \n
4589 /// Bits [63:32] are written to bits [95:64] of the destination.
4591 /// A 128-bit vector of [4 x i32]. \n
4592 /// Bits [31:0] are written to bits [64:32] of the destination. \n
4593 /// Bits [63:32] are written to bits [127:96] of the destination.
4594 /// \returns A 128-bit vector of [4 x i32] containing the interleaved values.
4595 static __inline__ __m128i __DEFAULT_FN_ATTRS
4596 _mm_unpacklo_epi32(__m128i __a, __m128i __b)
4598 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1);
4601 /// Unpacks the low-order 64-bit elements from two 128-bit vectors of
4602 /// [2 x i64] and interleaves them into a 128-bit vector of [2 x i64].
4604 /// \headerfile <x86intrin.h>
4606 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ / PUNPCKLQDQ </c>
4610 /// A 128-bit vector of [2 x i64]. \n
4611 /// Bits [63:0] are written to bits [63:0] of the destination. \n
4613 /// A 128-bit vector of [2 x i64]. \n
4614 /// Bits [63:0] are written to bits [127:64] of the destination. \n
4615 /// \returns A 128-bit vector of [2 x i64] containing the interleaved values.
4616 static __inline__ __m128i __DEFAULT_FN_ATTRS
4617 _mm_unpacklo_epi64(__m128i __a, __m128i __b)
4619 return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 0, 2+0);
4622 /// Returns the lower 64 bits of a 128-bit integer vector as a 64-bit
4625 /// \headerfile <x86intrin.h>
4627 /// This intrinsic corresponds to the <c> MOVDQ2Q </c> instruction.
4630 /// A 128-bit integer vector operand. The lower 64 bits are moved to the
4632 /// \returns A 64-bit integer containing the lower 64 bits of the parameter.
4633 static __inline__ __m64 __DEFAULT_FN_ATTRS
4634 _mm_movepi64_pi64(__m128i __a)
4636 return (__m64)__a[0];
4639 /// Moves the 64-bit operand to a 128-bit integer vector, zeroing the
4642 /// \headerfile <x86intrin.h>
4644 /// This intrinsic corresponds to the <c> MOVD+VMOVQ </c> instruction.
4648 /// \returns A 128-bit integer vector. The lower 64 bits contain the value from
4649 /// the operand. The upper 64 bits are assigned zeros.
4650 static __inline__ __m128i __DEFAULT_FN_ATTRS
4651 _mm_movpi64_epi64(__m64 __a)
4653 return __extension__ (__m128i)(__v2di){ (long long)__a, 0 };
4656 /// Moves the lower 64 bits of a 128-bit integer vector to a 128-bit
4657 /// integer vector, zeroing the upper bits.
4659 /// \headerfile <x86intrin.h>
4661 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
4664 /// A 128-bit integer vector operand. The lower 64 bits are moved to the
4666 /// \returns A 128-bit integer vector. The lower 64 bits contain the value from
4667 /// the operand. The upper 64 bits are assigned zeros.
4668 static __inline__ __m128i __DEFAULT_FN_ATTRS
4669 _mm_move_epi64(__m128i __a)
4671 return __builtin_shufflevector((__v2di)__a, _mm_setzero_si128(), 0, 2);
4674 /// Unpacks the high-order 64-bit elements from two 128-bit vectors of
4675 /// [2 x double] and interleaves them into a 128-bit vector of [2 x
4678 /// \headerfile <x86intrin.h>
4680 /// This intrinsic corresponds to the <c> VUNPCKHPD / UNPCKHPD </c> instruction.
4683 /// A 128-bit vector of [2 x double]. \n
4684 /// Bits [127:64] are written to bits [63:0] of the destination.
4686 /// A 128-bit vector of [2 x double]. \n
4687 /// Bits [127:64] are written to bits [127:64] of the destination.
4688 /// \returns A 128-bit vector of [2 x double] containing the interleaved values.
4689 static __inline__ __m128d __DEFAULT_FN_ATTRS
4690 _mm_unpackhi_pd(__m128d __a, __m128d __b)
4692 return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 1, 2+1);
4695 /// Unpacks the low-order 64-bit elements from two 128-bit vectors
4696 /// of [2 x double] and interleaves them into a 128-bit vector of [2 x
4699 /// \headerfile <x86intrin.h>
4701 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
4704 /// A 128-bit vector of [2 x double]. \n
4705 /// Bits [63:0] are written to bits [63:0] of the destination.
4707 /// A 128-bit vector of [2 x double]. \n
4708 /// Bits [63:0] are written to bits [127:64] of the destination.
4709 /// \returns A 128-bit vector of [2 x double] containing the interleaved values.
4710 static __inline__ __m128d __DEFAULT_FN_ATTRS
4711 _mm_unpacklo_pd(__m128d __a, __m128d __b)
4713 return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 0, 2+0);
4716 /// Extracts the sign bits of the double-precision values in the 128-bit
4717 /// vector of [2 x double], zero-extends the value, and writes it to the
4718 /// low-order bits of the destination.
4720 /// \headerfile <x86intrin.h>
4722 /// This intrinsic corresponds to the <c> VMOVMSKPD / MOVMSKPD </c> instruction.
4725 /// A 128-bit vector of [2 x double] containing the values with sign bits to
4727 /// \returns The sign bits from each of the double-precision elements in \a __a,
4728 /// written to bits [1:0]. The remaining bits are assigned values of zero.
4729 static __inline__ int __DEFAULT_FN_ATTRS
4730 _mm_movemask_pd(__m128d __a)
4732 return __builtin_ia32_movmskpd((__v2df)__a);
4736 /// Constructs a 128-bit floating-point vector of [2 x double] from two
4737 /// 128-bit vector parameters of [2 x double], using the immediate-value
4738 /// parameter as a specifier.
4740 /// \headerfile <x86intrin.h>
4743 /// __m128d _mm_shuffle_pd(__m128d a, __m128d b, const int i);
4746 /// This intrinsic corresponds to the <c> VSHUFPD / SHUFPD </c> instruction.
4749 /// A 128-bit vector of [2 x double].
4751 /// A 128-bit vector of [2 x double].
4753 /// An 8-bit immediate value. The least significant two bits specify which
4754 /// elements to copy from \a a and \a b: \n
4755 /// Bit[0] = 0: lower element of \a a copied to lower element of result. \n
4756 /// Bit[0] = 1: upper element of \a a copied to lower element of result. \n
4757 /// Bit[1] = 0: lower element of \a b copied to upper element of result. \n
4758 /// Bit[1] = 1: upper element of \a b copied to upper element of result. \n
4759 /// \returns A 128-bit vector of [2 x double] containing the shuffled values.
4760 #define _mm_shuffle_pd(a, b, i) \
4761 (__m128d)__builtin_ia32_shufpd((__v2df)(__m128d)(a), (__v2df)(__m128d)(b), \
4764 /// Casts a 128-bit floating-point vector of [2 x double] into a 128-bit
4765 /// floating-point vector of [4 x float].
4767 /// \headerfile <x86intrin.h>
4769 /// This intrinsic has no corresponding instruction.
4772 /// A 128-bit floating-point vector of [2 x double].
4773 /// \returns A 128-bit floating-point vector of [4 x float] containing the same
4774 /// bitwise pattern as the parameter.
4775 static __inline__ __m128 __DEFAULT_FN_ATTRS
4776 _mm_castpd_ps(__m128d __a)
4781 /// Casts a 128-bit floating-point vector of [2 x double] into a 128-bit
4784 /// \headerfile <x86intrin.h>
4786 /// This intrinsic has no corresponding instruction.
4789 /// A 128-bit floating-point vector of [2 x double].
4790 /// \returns A 128-bit integer vector containing the same bitwise pattern as the
4792 static __inline__ __m128i __DEFAULT_FN_ATTRS
4793 _mm_castpd_si128(__m128d __a)
4795 return (__m128i)__a;
4798 /// Casts a 128-bit floating-point vector of [4 x float] into a 128-bit
4799 /// floating-point vector of [2 x double].
4801 /// \headerfile <x86intrin.h>
4803 /// This intrinsic has no corresponding instruction.
4806 /// A 128-bit floating-point vector of [4 x float].
4807 /// \returns A 128-bit floating-point vector of [2 x double] containing the same
4808 /// bitwise pattern as the parameter.
4809 static __inline__ __m128d __DEFAULT_FN_ATTRS
4810 _mm_castps_pd(__m128 __a)
4812 return (__m128d)__a;
4815 /// Casts a 128-bit floating-point vector of [4 x float] into a 128-bit
4818 /// \headerfile <x86intrin.h>
4820 /// This intrinsic has no corresponding instruction.
4823 /// A 128-bit floating-point vector of [4 x float].
4824 /// \returns A 128-bit integer vector containing the same bitwise pattern as the
4826 static __inline__ __m128i __DEFAULT_FN_ATTRS
4827 _mm_castps_si128(__m128 __a)
4829 return (__m128i)__a;
4832 /// Casts a 128-bit integer vector into a 128-bit floating-point vector
4835 /// \headerfile <x86intrin.h>
4837 /// This intrinsic has no corresponding instruction.
4840 /// A 128-bit integer vector.
4841 /// \returns A 128-bit floating-point vector of [4 x float] containing the same
4842 /// bitwise pattern as the parameter.
4843 static __inline__ __m128 __DEFAULT_FN_ATTRS
4844 _mm_castsi128_ps(__m128i __a)
4849 /// Casts a 128-bit integer vector into a 128-bit floating-point vector
4850 /// of [2 x double].
4852 /// \headerfile <x86intrin.h>
4854 /// This intrinsic has no corresponding instruction.
4857 /// A 128-bit integer vector.
4858 /// \returns A 128-bit floating-point vector of [2 x double] containing the same
4859 /// bitwise pattern as the parameter.
4860 static __inline__ __m128d __DEFAULT_FN_ATTRS
4861 _mm_castsi128_pd(__m128i __a)
4863 return (__m128d)__a;
4866 #if defined(__cplusplus)
4870 /// Indicates that a spin loop is being executed for the purposes of
4871 /// optimizing power consumption during the loop.
4873 /// \headerfile <x86intrin.h>
4875 /// This intrinsic corresponds to the <c> PAUSE </c> instruction.
4877 void _mm_pause(void);
4879 #if defined(__cplusplus)
4882 #undef __DEFAULT_FN_ATTRS
4883 #undef __DEFAULT_FN_ATTRS_MMX
4885 #define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))
4887 #define _MM_DENORMALS_ZERO_ON (0x0040)
4888 #define _MM_DENORMALS_ZERO_OFF (0x0000)
4890 #define _MM_DENORMALS_ZERO_MASK (0x0040)
4892 #define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
4893 #define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
4895 #endif /* __EMMINTRIN_H */