]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/emmintrin.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Headers / emmintrin.h
1 /*===---- emmintrin.h - SSE2 intrinsics ------------------------------------===
2  *
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:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
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
19  * THE SOFTWARE.
20  *
21  *===-----------------------------------------------------------------------===
22  */
23
24 #ifndef __EMMINTRIN_H
25 #define __EMMINTRIN_H
26
27 #include <xmmintrin.h>
28
29 typedef double __m128d __attribute__((__vector_size__(16)));
30 typedef long long __m128i __attribute__((__vector_size__(16)));
31
32 /* Type defines.  */
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)));
37
38 /* Unsigned types */
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)));
42
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)));
46
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)))
50
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.
54 ///
55 /// \headerfile <x86intrin.h>
56 ///
57 /// This intrinsic corresponds to the <c> VADDSD / ADDSD </c> instruction.
58 ///
59 /// \param __a
60 ///    A 128-bit vector of [2 x double] containing one of the source operands.
61 /// \param __b
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)
68 {
69   __a[0] += __b[0];
70   return __a;
71 }
72
73 /// Adds two 128-bit vectors of [2 x double].
74 ///
75 /// \headerfile <x86intrin.h>
76 ///
77 /// This intrinsic corresponds to the <c> VADDPD / ADDPD </c> instruction.
78 ///
79 /// \param __a
80 ///    A 128-bit vector of [2 x double] containing one of the source operands.
81 /// \param __b
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
84 ///    operands.
85 static __inline__ __m128d __DEFAULT_FN_ATTRS
86 _mm_add_pd(__m128d __a, __m128d __b)
87 {
88   return (__m128d)((__v2df)__a + (__v2df)__b);
89 }
90
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
95 ///    operand.
96 ///
97 /// \headerfile <x86intrin.h>
98 ///
99 /// This intrinsic corresponds to the <c> VSUBSD / SUBSD </c> instruction.
100 ///
101 /// \param __a
102 ///    A 128-bit vector of [2 x double] containing the minuend.
103 /// \param __b
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)
110 {
111   __a[0] -= __b[0];
112   return __a;
113 }
114
115 /// Subtracts two 128-bit vectors of [2 x double].
116 ///
117 /// \headerfile <x86intrin.h>
118 ///
119 /// This intrinsic corresponds to the <c> VSUBPD / SUBPD </c> instruction.
120 ///
121 /// \param __a
122 ///    A 128-bit vector of [2 x double] containing the minuend.
123 /// \param __b
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
126 ///    both operands.
127 static __inline__ __m128d __DEFAULT_FN_ATTRS
128 _mm_sub_pd(__m128d __a, __m128d __b)
129 {
130   return (__m128d)((__v2df)__a - (__v2df)__b);
131 }
132
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
136 ///    operand.
137 ///
138 /// \headerfile <x86intrin.h>
139 ///
140 /// This intrinsic corresponds to the <c> VMULSD / MULSD </c> instruction.
141 ///
142 /// \param __a
143 ///    A 128-bit vector of [2 x double] containing one of the source operands.
144 /// \param __b
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)
151 {
152   __a[0] *= __b[0];
153   return __a;
154 }
155
156 /// Multiplies two 128-bit vectors of [2 x double].
157 ///
158 /// \headerfile <x86intrin.h>
159 ///
160 /// This intrinsic corresponds to the <c> VMULPD / MULPD </c> instruction.
161 ///
162 /// \param __a
163 ///    A 128-bit vector of [2 x double] containing one of the operands.
164 /// \param __b
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
167 ///    operands.
168 static __inline__ __m128d __DEFAULT_FN_ATTRS
169 _mm_mul_pd(__m128d __a, __m128d __b)
170 {
171   return (__m128d)((__v2df)__a * (__v2df)__b);
172 }
173
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
178 ///    operand.
179 ///
180 /// \headerfile <x86intrin.h>
181 ///
182 /// This intrinsic corresponds to the <c> VDIVSD / DIVSD </c> instruction.
183 ///
184 /// \param __a
185 ///    A 128-bit vector of [2 x double] containing the dividend.
186 /// \param __b
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)
193 {
194   __a[0] /= __b[0];
195   return __a;
196 }
197
198 /// Performs an element-by-element division of two 128-bit vectors of
199 ///    [2 x double].
200 ///
201 /// \headerfile <x86intrin.h>
202 ///
203 /// This intrinsic corresponds to the <c> VDIVPD / DIVPD </c> instruction.
204 ///
205 /// \param __a
206 ///    A 128-bit vector of [2 x double] containing the dividend.
207 /// \param __b
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
210 ///    operands.
211 static __inline__ __m128d __DEFAULT_FN_ATTRS
212 _mm_div_pd(__m128d __a, __m128d __b)
213 {
214   return (__m128d)((__v2df)__a / (__v2df)__b);
215 }
216
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.
221 ///
222 /// \headerfile <x86intrin.h>
223 ///
224 /// This intrinsic corresponds to the <c> VSQRTSD / SQRTSD </c> instruction.
225 ///
226 /// \param __a
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
229 ///    result.
230 /// \param __b
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)
238 {
239   __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b);
240   return __extension__ (__m128d) { __c[0], __a[1] };
241 }
242
243 /// Calculates the square root of the each of two values stored in a
244 ///    128-bit vector of [2 x double].
245 ///
246 /// \headerfile <x86intrin.h>
247 ///
248 /// This intrinsic corresponds to the <c> VSQRTPD / SQRTPD </c> instruction.
249 ///
250 /// \param __a
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)
256 {
257   return __builtin_ia32_sqrtpd((__v2df)__a);
258 }
259
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.
264 ///
265 /// \headerfile <x86intrin.h>
266 ///
267 /// This intrinsic corresponds to the <c> VMINSD / MINSD </c> instruction.
268 ///
269 /// \param __a
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.
272 /// \param __b
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)
280 {
281   return __builtin_ia32_minsd((__v2df)__a, (__v2df)__b);
282 }
283
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
286 ///    values.
287 ///
288 /// \headerfile <x86intrin.h>
289 ///
290 /// This intrinsic corresponds to the <c> VMINPD / MINPD </c> instruction.
291 ///
292 /// \param __a
293 ///    A 128-bit vector of [2 x double] containing one of the operands.
294 /// \param __b
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)
300 {
301   return __builtin_ia32_minpd((__v2df)__a, (__v2df)__b);
302 }
303
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.
308 ///
309 /// \headerfile <x86intrin.h>
310 ///
311 /// This intrinsic corresponds to the <c> VMAXSD / MAXSD </c> instruction.
312 ///
313 /// \param __a
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.
316 /// \param __b
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)
324 {
325   return __builtin_ia32_maxsd((__v2df)__a, (__v2df)__b);
326 }
327
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
330 ///    of values.
331 ///
332 /// \headerfile <x86intrin.h>
333 ///
334 /// This intrinsic corresponds to the <c> VMAXPD / MAXPD </c> instruction.
335 ///
336 /// \param __a
337 ///    A 128-bit vector of [2 x double] containing one of the operands.
338 /// \param __b
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)
344 {
345   return __builtin_ia32_maxpd((__v2df)__a, (__v2df)__b);
346 }
347
348 /// Performs a bitwise AND of two 128-bit vectors of [2 x double].
349 ///
350 /// \headerfile <x86intrin.h>
351 ///
352 /// This intrinsic corresponds to the <c> VPAND / PAND </c> instruction.
353 ///
354 /// \param __a
355 ///    A 128-bit vector of [2 x double] containing one of the source operands.
356 /// \param __b
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)
362 {
363   return (__m128d)((__v2du)__a & (__v2du)__b);
364 }
365
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.
368 ///
369 /// \headerfile <x86intrin.h>
370 ///
371 /// This intrinsic corresponds to the <c> VPANDN / PANDN </c> instruction.
372 ///
373 /// \param __a
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.
376 /// \param __b
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
380 ///    operand.
381 static __inline__ __m128d __DEFAULT_FN_ATTRS
382 _mm_andnot_pd(__m128d __a, __m128d __b)
383 {
384   return (__m128d)(~(__v2du)__a & (__v2du)__b);
385 }
386
387 /// Performs a bitwise OR of two 128-bit vectors of [2 x double].
388 ///
389 /// \headerfile <x86intrin.h>
390 ///
391 /// This intrinsic corresponds to the <c> VPOR / POR </c> instruction.
392 ///
393 /// \param __a
394 ///    A 128-bit vector of [2 x double] containing one of the source operands.
395 /// \param __b
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)
401 {
402   return (__m128d)((__v2du)__a | (__v2du)__b);
403 }
404
405 /// Performs a bitwise XOR of two 128-bit vectors of [2 x double].
406 ///
407 /// \headerfile <x86intrin.h>
408 ///
409 /// This intrinsic corresponds to the <c> VPXOR / PXOR </c> instruction.
410 ///
411 /// \param __a
412 ///    A 128-bit vector of [2 x double] containing one of the source operands.
413 /// \param __b
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)
419 {
420   return (__m128d)((__v2du)__a ^ (__v2du)__b);
421 }
422
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.
426 ///
427 /// \headerfile <x86intrin.h>
428 ///
429 /// This intrinsic corresponds to the <c> VCMPEQPD / CMPEQPD </c> instruction.
430 ///
431 /// \param __a
432 ///    A 128-bit vector of [2 x double].
433 /// \param __b
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)
438 {
439   return (__m128d)__builtin_ia32_cmpeqpd((__v2df)__a, (__v2df)__b);
440 }
441
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.
446 ///
447 /// \headerfile <x86intrin.h>
448 ///
449 /// This intrinsic corresponds to the <c> VCMPLTPD / CMPLTPD </c> instruction.
450 ///
451 /// \param __a
452 ///    A 128-bit vector of [2 x double].
453 /// \param __b
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)
458 {
459   return (__m128d)__builtin_ia32_cmpltpd((__v2df)__a, (__v2df)__b);
460 }
461
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.
465 ///
466 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
467 ///
468 /// \headerfile <x86intrin.h>
469 ///
470 /// This intrinsic corresponds to the <c> VCMPLEPD / CMPLEPD </c> instruction.
471 ///
472 /// \param __a
473 ///    A 128-bit vector of [2 x double].
474 /// \param __b
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)
479 {
480   return (__m128d)__builtin_ia32_cmplepd((__v2df)__a, (__v2df)__b);
481 }
482
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.
486 ///
487 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
488 ///
489 /// \headerfile <x86intrin.h>
490 ///
491 /// This intrinsic corresponds to the <c> VCMPLTPD / CMPLTPD </c> instruction.
492 ///
493 /// \param __a
494 ///    A 128-bit vector of [2 x double].
495 /// \param __b
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)
500 {
501   return (__m128d)__builtin_ia32_cmpltpd((__v2df)__b, (__v2df)__a);
502 }
503
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.
507 ///
508 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
509 ///
510 /// \headerfile <x86intrin.h>
511 ///
512 /// This intrinsic corresponds to the <c> VCMPLEPD / CMPLEPD </c> instruction.
513 ///
514 /// \param __a
515 ///    A 128-bit vector of [2 x double].
516 /// \param __b
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)
521 {
522   return (__m128d)__builtin_ia32_cmplepd((__v2df)__b, (__v2df)__a);
523 }
524
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.
528 ///
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.
532 ///
533 /// \headerfile <x86intrin.h>
534 ///
535 /// This intrinsic corresponds to the <c> VCMPORDPD / CMPORDPD </c> instruction.
536 ///
537 /// \param __a
538 ///    A 128-bit vector of [2 x double].
539 /// \param __b
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)
544 {
545   return (__m128d)__builtin_ia32_cmpordpd((__v2df)__a, (__v2df)__b);
546 }
547
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.
551 ///
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.
555 ///
556 /// \headerfile <x86intrin.h>
557 ///
558 /// This intrinsic corresponds to the <c> VCMPUNORDPD / CMPUNORDPD </c>
559 ///   instruction.
560 ///
561 /// \param __a
562 ///    A 128-bit vector of [2 x double].
563 /// \param __b
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)
568 {
569   return (__m128d)__builtin_ia32_cmpunordpd((__v2df)__a, (__v2df)__b);
570 }
571
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.
575 ///
576 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
577 ///
578 /// \headerfile <x86intrin.h>
579 ///
580 /// This intrinsic corresponds to the <c> VCMPNEQPD / CMPNEQPD </c> instruction.
581 ///
582 /// \param __a
583 ///    A 128-bit vector of [2 x double].
584 /// \param __b
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)
589 {
590   return (__m128d)__builtin_ia32_cmpneqpd((__v2df)__a, (__v2df)__b);
591 }
592
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.
596 ///
597 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
598 ///
599 /// \headerfile <x86intrin.h>
600 ///
601 /// This intrinsic corresponds to the <c> VCMPNLTPD / CMPNLTPD </c> instruction.
602 ///
603 /// \param __a
604 ///    A 128-bit vector of [2 x double].
605 /// \param __b
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)
610 {
611   return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__a, (__v2df)__b);
612 }
613
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.
617 ///
618 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
619 ///
620 /// \headerfile <x86intrin.h>
621 ///
622 /// This intrinsic corresponds to the <c> VCMPNLEPD / CMPNLEPD </c> instruction.
623 ///
624 /// \param __a
625 ///    A 128-bit vector of [2 x double].
626 /// \param __b
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)
631 {
632   return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__a, (__v2df)__b);
633 }
634
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.
638 ///
639 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
640 ///
641 /// \headerfile <x86intrin.h>
642 ///
643 /// This intrinsic corresponds to the <c> VCMPNLTPD / CMPNLTPD </c> instruction.
644 ///
645 /// \param __a
646 ///    A 128-bit vector of [2 x double].
647 /// \param __b
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)
652 {
653   return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__b, (__v2df)__a);
654 }
655
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.
659 ///
660 ///    Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
661 ///
662 /// \headerfile <x86intrin.h>
663 ///
664 /// This intrinsic corresponds to the <c> VCMPNLEPD / CMPNLEPD </c> instruction.
665 ///
666 /// \param __a
667 ///    A 128-bit vector of [2 x double].
668 /// \param __b
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)
673 {
674   return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__b, (__v2df)__a);
675 }
676
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.
679 ///
680 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
681 ///
682 /// \headerfile <x86intrin.h>
683 ///
684 /// This intrinsic corresponds to the <c> VCMPEQSD / CMPEQSD </c> instruction.
685 ///
686 /// \param __a
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.
689 /// \param __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)
696 {
697   return (__m128d)__builtin_ia32_cmpeqsd((__v2df)__a, (__v2df)__b);
698 }
699
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.
704 ///
705 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
706 ///
707 /// \headerfile <x86intrin.h>
708 ///
709 /// This intrinsic corresponds to the <c> VCMPLTSD / CMPLTSD </c> instruction.
710 ///
711 /// \param __a
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.
714 /// \param __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)
721 {
722   return (__m128d)__builtin_ia32_cmpltsd((__v2df)__a, (__v2df)__b);
723 }
724
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.
729 ///
730 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
731 ///
732 /// \headerfile <x86intrin.h>
733 ///
734 /// This intrinsic corresponds to the <c> VCMPLESD / CMPLESD </c> instruction.
735 ///
736 /// \param __a
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.
739 /// \param __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)
746 {
747   return (__m128d)__builtin_ia32_cmplesd((__v2df)__a, (__v2df)__b);
748 }
749
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.
754 ///
755 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
756 ///
757 /// \headerfile <x86intrin.h>
758 ///
759 /// This intrinsic corresponds to the <c> VCMPLTSD / CMPLTSD </c> instruction.
760 ///
761 /// \param __a
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.
764 /// \param __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)
771 {
772   __m128d __c = __builtin_ia32_cmpltsd((__v2df)__b, (__v2df)__a);
773   return __extension__ (__m128d) { __c[0], __a[1] };
774 }
775
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.
780 ///
781 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
782 ///
783 /// \headerfile <x86intrin.h>
784 ///
785 /// This intrinsic corresponds to the <c> VCMPLESD / CMPLESD </c> instruction.
786 ///
787 /// \param __a
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.
790 /// \param __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)
797 {
798   __m128d __c = __builtin_ia32_cmplesd((__v2df)__b, (__v2df)__a);
799   return __extension__ (__m128d) { __c[0], __a[1] };
800 }
801
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.
806 ///
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.
810 ///
811 /// \headerfile <x86intrin.h>
812 ///
813 /// This intrinsic corresponds to the <c> VCMPORDSD / CMPORDSD </c> instruction.
814 ///
815 /// \param __a
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.
818 /// \param __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)
825 {
826   return (__m128d)__builtin_ia32_cmpordsd((__v2df)__a, (__v2df)__b);
827 }
828
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.
833 ///
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.
837 ///
838 /// \headerfile <x86intrin.h>
839 ///
840 /// This intrinsic corresponds to the <c> VCMPUNORDSD / CMPUNORDSD </c>
841 ///   instruction.
842 ///
843 /// \param __a
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.
846 /// \param __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)
853 {
854   return (__m128d)__builtin_ia32_cmpunordsd((__v2df)__a, (__v2df)__b);
855 }
856
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.
861 ///
862 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
863 ///
864 /// \headerfile <x86intrin.h>
865 ///
866 /// This intrinsic corresponds to the <c> VCMPNEQSD / CMPNEQSD </c> instruction.
867 ///
868 /// \param __a
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.
871 /// \param __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)
878 {
879   return (__m128d)__builtin_ia32_cmpneqsd((__v2df)__a, (__v2df)__b);
880 }
881
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.
886 ///
887 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
888 ///
889 /// \headerfile <x86intrin.h>
890 ///
891 /// This intrinsic corresponds to the <c> VCMPNLTSD / CMPNLTSD </c> instruction.
892 ///
893 /// \param __a
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.
896 /// \param __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)
903 {
904   return (__m128d)__builtin_ia32_cmpnltsd((__v2df)__a, (__v2df)__b);
905 }
906
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.
911 ///
912 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
913 ///
914 /// \headerfile <x86intrin.h>
915 ///
916 /// This intrinsic corresponds to the <c> VCMPNLESD / CMPNLESD </c> instruction.
917 ///
918 /// \param __a
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.
921 /// \param __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)
928 {
929   return (__m128d)__builtin_ia32_cmpnlesd((__v2df)__a, (__v2df)__b);
930 }
931
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.
936 ///
937 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
938 ///
939 /// \headerfile <x86intrin.h>
940 ///
941 /// This intrinsic corresponds to the <c> VCMPNLTSD / CMPNLTSD </c> instruction.
942 ///
943 /// \param __a
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.
946 /// \param __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)
953 {
954   __m128d __c = __builtin_ia32_cmpnltsd((__v2df)__b, (__v2df)__a);
955   return __extension__ (__m128d) { __c[0], __a[1] };
956 }
957
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.
962 ///
963 ///    The comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
964 ///
965 /// \headerfile <x86intrin.h>
966 ///
967 /// This intrinsic corresponds to the <c> VCMPNLESD / CMPNLESD </c> instruction.
968 ///
969 /// \param __a
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.
972 /// \param __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)
979 {
980   __m128d __c = __builtin_ia32_cmpnlesd((__v2df)__b, (__v2df)__a);
981   return __extension__ (__m128d) { __c[0], __a[1] };
982 }
983
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.
986 ///
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.
989 ///
990 /// \headerfile <x86intrin.h>
991 ///
992 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
993 ///
994 /// \param __a
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.
997 /// \param __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)
1004 {
1005   return __builtin_ia32_comisdeq((__v2df)__a, (__v2df)__b);
1006 }
1007
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.
1012 ///
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.
1015 ///
1016 /// \headerfile <x86intrin.h>
1017 ///
1018 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1019 ///
1020 /// \param __a
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.
1023 /// \param __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)
1030 {
1031   return __builtin_ia32_comisdlt((__v2df)__a, (__v2df)__b);
1032 }
1033
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.
1038 ///
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.
1041 ///
1042 /// \headerfile <x86intrin.h>
1043 ///
1044 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1045 ///
1046 /// \param __a
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.
1049 /// \param __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)
1056 {
1057   return __builtin_ia32_comisdle((__v2df)__a, (__v2df)__b);
1058 }
1059
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.
1064 ///
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.
1067 ///
1068 /// \headerfile <x86intrin.h>
1069 ///
1070 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1071 ///
1072 /// \param __a
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.
1075 /// \param __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)
1082 {
1083   return __builtin_ia32_comisdgt((__v2df)__a, (__v2df)__b);
1084 }
1085
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.
1090 ///
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.
1093 ///
1094 /// \headerfile <x86intrin.h>
1095 ///
1096 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1097 ///
1098 /// \param __a
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.
1101 /// \param __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)
1108 {
1109   return __builtin_ia32_comisdge((__v2df)__a, (__v2df)__b);
1110 }
1111
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.
1116 ///
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.
1119 ///
1120 /// \headerfile <x86intrin.h>
1121 ///
1122 /// This intrinsic corresponds to the <c> VCOMISD / COMISD </c> instruction.
1123 ///
1124 /// \param __a
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.
1127 /// \param __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)
1134 {
1135   return __builtin_ia32_comisdneq((__v2df)__a, (__v2df)__b);
1136 }
1137
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.
1141 ///
1142 ///    If either of the two lower double-precision values is NaN, 0 is returned.
1143 ///
1144 /// \headerfile <x86intrin.h>
1145 ///
1146 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1147 ///
1148 /// \param __a
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.
1151 /// \param __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)
1158 {
1159   return __builtin_ia32_ucomisdeq((__v2df)__a, (__v2df)__b);
1160 }
1161
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.
1166 ///
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.
1169 ///
1170 /// \headerfile <x86intrin.h>
1171 ///
1172 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1173 ///
1174 /// \param __a
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.
1177 /// \param __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)
1184 {
1185   return __builtin_ia32_ucomisdlt((__v2df)__a, (__v2df)__b);
1186 }
1187
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.
1192 ///
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.
1195 ///
1196 /// \headerfile <x86intrin.h>
1197 ///
1198 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1199 ///
1200 /// \param __a
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.
1203 /// \param __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)
1210 {
1211   return __builtin_ia32_ucomisdle((__v2df)__a, (__v2df)__b);
1212 }
1213
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.
1218 ///
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.
1221 ///
1222 /// \headerfile <x86intrin.h>
1223 ///
1224 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1225 ///
1226 /// \param __a
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.
1229 /// \param __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)
1236 {
1237   return __builtin_ia32_ucomisdgt((__v2df)__a, (__v2df)__b);
1238 }
1239
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.
1244 ///
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.
1247 ///
1248 /// \headerfile <x86intrin.h>
1249 ///
1250 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1251 ///
1252 /// \param __a
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.
1255 /// \param __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)
1262 {
1263   return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b);
1264 }
1265
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.
1270 ///
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.
1273 ///
1274 /// \headerfile <x86intrin.h>
1275 ///
1276 /// This intrinsic corresponds to the <c> VUCOMISD / UCOMISD </c> instruction.
1277 ///
1278 /// \param __a
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.
1281 /// \param __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)
1288 {
1289   return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b);
1290 }
1291
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.
1296 ///
1297 /// \headerfile <x86intrin.h>
1298 ///
1299 /// This intrinsic corresponds to the <c> VCVTPD2PS / CVTPD2PS </c> instruction.
1300 ///
1301 /// \param __a
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)
1307 {
1308   return __builtin_ia32_cvtpd2ps((__v2df)__a);
1309 }
1310
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.
1315 ///
1316 /// \headerfile <x86intrin.h>
1317 ///
1318 /// This intrinsic corresponds to the <c> VCVTPS2PD / CVTPS2PD </c> instruction.
1319 ///
1320 /// \param __a
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)
1327 {
1328   return (__m128d) __builtin_convertvector(
1329       __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1), __v2df);
1330 }
1331
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].
1335 ///
1336 ///    The upper two elements of the input vector are unused.
1337 ///
1338 /// \headerfile <x86intrin.h>
1339 ///
1340 /// This intrinsic corresponds to the <c> VCVTDQ2PD / CVTDQ2PD </c> instruction.
1341 ///
1342 /// \param __a
1343 ///    A 128-bit integer vector of [4 x i32]. The lower two integer elements are
1344 ///    converted to double-precision values.
1345 ///
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)
1350 {
1351   return (__m128d) __builtin_convertvector(
1352       __builtin_shufflevector((__v4si)__a, (__v4si)__a, 0, 1), __v2df);
1353 }
1354
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.
1359 ///
1360 /// \headerfile <x86intrin.h>
1361 ///
1362 /// This intrinsic corresponds to the <c> VCVTPD2DQ / CVTPD2DQ </c> instruction.
1363 ///
1364 /// \param __a
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)
1370 {
1371   return __builtin_ia32_cvtpd2dq((__v2df)__a);
1372 }
1373
1374 /// Converts the low-order element of a 128-bit vector of [2 x double]
1375 ///    into a 32-bit signed integer value.
1376 ///
1377 /// \headerfile <x86intrin.h>
1378 ///
1379 /// This intrinsic corresponds to the <c> VCVTSD2SI / CVTSD2SI </c> instruction.
1380 ///
1381 /// \param __a
1382 ///    A 128-bit vector of [2 x double]. The lower 64 bits are used in the
1383 ///    conversion.
1384 /// \returns A 32-bit signed integer containing the converted value.
1385 static __inline__ int __DEFAULT_FN_ATTRS
1386 _mm_cvtsd_si32(__m128d __a)
1387 {
1388   return __builtin_ia32_cvtsd2si((__v2df)__a);
1389 }
1390
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.
1396 ///
1397 /// \headerfile <x86intrin.h>
1398 ///
1399 /// This intrinsic corresponds to the <c> VCVTSD2SS / CVTSD2SS </c> instruction.
1400 ///
1401 /// \param __a
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.
1404 /// \param __b
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)
1412 {
1413   return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__a, (__v2df)__b);
1414 }
1415
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.
1420 ///
1421 /// \headerfile <x86intrin.h>
1422 ///
1423 /// This intrinsic corresponds to the <c> VCVTSI2SD / CVTSI2SD </c> instruction.
1424 ///
1425 /// \param __a
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.
1428 /// \param __b
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)
1435 {
1436   __a[0] = __b;
1437   return __a;
1438 }
1439
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.
1445 ///
1446 /// \headerfile <x86intrin.h>
1447 ///
1448 /// This intrinsic corresponds to the <c> VCVTSS2SD / CVTSS2SD </c> instruction.
1449 ///
1450 /// \param __a
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.
1453 /// \param __b
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)
1461 {
1462   __a[0] = __b[0];
1463   return __a;
1464 }
1465
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].
1469 ///
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.
1473 ///
1474 /// \headerfile <x86intrin.h>
1475 ///
1476 /// This intrinsic corresponds to the <c> VCVTTPD2DQ / CVTTPD2DQ </c>
1477 ///   instruction.
1478 ///
1479 /// \param __a
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)
1485 {
1486   return (__m128i)__builtin_ia32_cvttpd2dq((__v2df)__a);
1487 }
1488
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.
1491 ///
1492 /// \headerfile <x86intrin.h>
1493 ///
1494 /// This intrinsic corresponds to the <c> VCVTTSD2SI / CVTTSD2SI </c>
1495 ///   instruction.
1496 ///
1497 /// \param __a
1498 ///    A 128-bit vector of [2 x double]. The lower 64 bits are used in the
1499 ///    conversion.
1500 /// \returns A 32-bit signed integer containing the converted value.
1501 static __inline__ int __DEFAULT_FN_ATTRS
1502 _mm_cvttsd_si32(__m128d __a)
1503 {
1504   return __builtin_ia32_cvttsd2si((__v2df)__a);
1505 }
1506
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].
1510 ///
1511 /// \headerfile <x86intrin.h>
1512 ///
1513 /// This intrinsic corresponds to the <c> CVTPD2PI </c> instruction.
1514 ///
1515 /// \param __a
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)
1520 {
1521   return (__m64)__builtin_ia32_cvtpd2pi((__v2df)__a);
1522 }
1523
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].
1527 ///
1528 ///    If the result of either conversion is inexact, the result is truncated
1529 ///    (rounded towards zero) regardless of the current MXCSR setting.
1530 ///
1531 /// \headerfile <x86intrin.h>
1532 ///
1533 /// This intrinsic corresponds to the <c> CVTTPD2PI </c> instruction.
1534 ///
1535 /// \param __a
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)
1540 {
1541   return (__m64)__builtin_ia32_cvttpd2pi((__v2df)__a);
1542 }
1543
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].
1547 ///
1548 /// \headerfile <x86intrin.h>
1549 ///
1550 /// This intrinsic corresponds to the <c> CVTPI2PD </c> instruction.
1551 ///
1552 /// \param __a
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)
1557 {
1558   return __builtin_ia32_cvtpi2pd((__v2si)__a);
1559 }
1560
1561 /// Returns the low-order element of a 128-bit vector of [2 x double] as
1562 ///    a double-precision floating-point value.
1563 ///
1564 /// \headerfile <x86intrin.h>
1565 ///
1566 /// This intrinsic has no corresponding instruction.
1567 ///
1568 /// \param __a
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
1571 ///    bits of \a __a.
1572 static __inline__ double __DEFAULT_FN_ATTRS
1573 _mm_cvtsd_f64(__m128d __a)
1574 {
1575   return __a[0];
1576 }
1577
1578 /// Loads a 128-bit floating-point vector of [2 x double] from an aligned
1579 ///    memory location.
1580 ///
1581 /// \headerfile <x86intrin.h>
1582 ///
1583 /// This intrinsic corresponds to the <c> VMOVAPD / MOVAPD </c> instruction.
1584 ///
1585 /// \param __dp
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)
1591 {
1592   return *(__m128d*)__dp;
1593 }
1594
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
1597 ///    [2 x double].
1598 ///
1599 /// \headerfile <x86intrin.h>
1600 ///
1601 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVDDUP </c> instruction.
1602 ///
1603 /// \param __dp
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)
1609 {
1610   struct __mm_load1_pd_struct {
1611     double __u;
1612   } __attribute__((__packed__, __may_alias__));
1613   double __u = ((struct __mm_load1_pd_struct*)__dp)->__u;
1614   return __extension__ (__m128d){ __u, __u };
1615 }
1616
1617 #define        _mm_load_pd1(dp)        _mm_load1_pd(dp)
1618
1619 /// Loads two double-precision values, in reverse order, from an aligned
1620 ///    memory location into a 128-bit vector of [2 x double].
1621 ///
1622 /// \headerfile <x86intrin.h>
1623 ///
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.
1627 ///
1628 /// \param __dp
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
1632 ///    values.
1633 static __inline__ __m128d __DEFAULT_FN_ATTRS
1634 _mm_loadr_pd(double const *__dp)
1635 {
1636   __m128d __u = *(__m128d*)__dp;
1637   return __builtin_shufflevector((__v2df)__u, (__v2df)__u, 1, 0);
1638 }
1639
1640 /// Loads a 128-bit floating-point vector of [2 x double] from an
1641 ///    unaligned memory location.
1642 ///
1643 /// \headerfile <x86intrin.h>
1644 ///
1645 /// This intrinsic corresponds to the <c> VMOVUPD / MOVUPD </c> instruction.
1646 ///
1647 /// \param __dp
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)
1653 {
1654   struct __loadu_pd {
1655     __m128d __v;
1656   } __attribute__((__packed__, __may_alias__));
1657   return ((struct __loadu_pd*)__dp)->__v;
1658 }
1659
1660 /// Loads a 64-bit integer value to the low element of a 128-bit integer
1661 ///    vector and clears the upper element.
1662 ///
1663 /// \headerfile <x86intrin.h>
1664 ///
1665 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
1666 ///
1667 /// \param __a
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)
1673 {
1674   struct __loadu_si64 {
1675     long long __v;
1676   } __attribute__((__packed__, __may_alias__));
1677   long long __u = ((struct __loadu_si64*)__a)->__v;
1678   return __extension__ (__m128i)(__v2di){__u, 0L};
1679 }
1680
1681 /// Loads a 64-bit double-precision value to the low element of a
1682 ///    128-bit integer vector and clears the upper element.
1683 ///
1684 /// \headerfile <x86intrin.h>
1685 ///
1686 /// This intrinsic corresponds to the <c> VMOVSD / MOVSD </c> instruction.
1687 ///
1688 /// \param __dp
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)
1694 {
1695   struct __mm_load_sd_struct {
1696     double __u;
1697   } __attribute__((__packed__, __may_alias__));
1698   double __u = ((struct __mm_load_sd_struct*)__dp)->__u;
1699   return __extension__ (__m128d){ __u, 0 };
1700 }
1701
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.
1705 ///
1706 /// \headerfile <x86intrin.h>
1707 ///
1708 /// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
1709 ///
1710 /// \param __a
1711 ///    A 128-bit vector of [2 x double]. \n
1712 ///    Bits [63:0] are written to bits [63:0] of the result.
1713 /// \param __dp
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
1717 ///    to be aligned.
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)
1721 {
1722   struct __mm_loadh_pd_struct {
1723     double __u;
1724   } __attribute__((__packed__, __may_alias__));
1725   double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u;
1726   return __extension__ (__m128d){ __a[0], __u };
1727 }
1728
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.
1732 ///
1733 /// \headerfile <x86intrin.h>
1734 ///
1735 /// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
1736 ///
1737 /// \param __a
1738 ///    A 128-bit vector of [2 x double]. \n
1739 ///    Bits [127:64] are written to bits [127:64] of the result.
1740 /// \param __dp
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
1744 ///    be aligned.
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)
1748 {
1749   struct __mm_loadl_pd_struct {
1750     double __u;
1751   } __attribute__((__packed__, __may_alias__));
1752   double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u;
1753   return __extension__ (__m128d){ __u, __a[1] };
1754 }
1755
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
1759 ///    actually used.
1760 ///
1761 /// \headerfile <x86intrin.h>
1762 ///
1763 /// This intrinsic has no corresponding instruction.
1764 ///
1765 /// \returns A 128-bit floating-point vector of [2 x double] with unspecified
1766 ///    content.
1767 static __inline__ __m128d __DEFAULT_FN_ATTRS
1768 _mm_undefined_pd(void)
1769 {
1770   return (__m128d)__builtin_ia32_undef128();
1771 }
1772
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.
1776 ///
1777 /// \headerfile <x86intrin.h>
1778 ///
1779 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
1780 ///
1781 /// \param __w
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
1786 ///    set to zero.
1787 static __inline__ __m128d __DEFAULT_FN_ATTRS
1788 _mm_set_sd(double __w)
1789 {
1790   return __extension__ (__m128d){ __w, 0 };
1791 }
1792
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.
1796 ///
1797 /// \headerfile <x86intrin.h>
1798 ///
1799 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVLHPS </c> instruction.
1800 ///
1801 /// \param __w
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)
1807 {
1808   return __extension__ (__m128d){ __w, __w };
1809 }
1810
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.
1814 ///
1815 /// \headerfile <x86intrin.h>
1816 ///
1817 /// This intrinsic corresponds to the <c> VMOVDDUP / MOVLHPS </c> instruction.
1818 ///
1819 /// \param __w
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)
1825 {
1826   return _mm_set1_pd(__w);
1827 }
1828
1829 /// Constructs a 128-bit floating-point vector of [2 x double]
1830 ///    initialized with the specified double-precision floating-point values.
1831 ///
1832 /// \headerfile <x86intrin.h>
1833 ///
1834 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
1835 ///
1836 /// \param __w
1837 ///    A double-precision floating-point value used to initialize the upper 64
1838 ///    bits of the result.
1839 /// \param __x
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)
1845 {
1846   return __extension__ (__m128d){ __x, __w };
1847 }
1848
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.
1852 ///
1853 /// \headerfile <x86intrin.h>
1854 ///
1855 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
1856 ///
1857 /// \param __w
1858 ///    A double-precision floating-point value used to initialize the lower 64
1859 ///    bits of the result.
1860 /// \param __x
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)
1866 {
1867   return __extension__ (__m128d){ __w, __x };
1868 }
1869
1870 /// Constructs a 128-bit floating-point vector of [2 x double]
1871 ///    initialized to zero.
1872 ///
1873 /// \headerfile <x86intrin.h>
1874 ///
1875 /// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
1876 ///
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)
1881 {
1882   return __extension__ (__m128d){ 0, 0 };
1883 }
1884
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.
1888 ///
1889 /// \headerfile <x86intrin.h>
1890 ///
1891 /// This intrinsic corresponds to the <c> VBLENDPD / BLENDPD </c> instruction.
1892 ///
1893 /// \param __a
1894 ///    A 128-bit vector of [2 x double]. The upper 64 bits are written to the
1895 ///    upper 64 bits of the result.
1896 /// \param __b
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)
1902 {
1903   __a[0] = __b[0];
1904   return __a;
1905 }
1906
1907 /// Stores the lower 64 bits of a 128-bit vector of [2 x double] to a
1908 ///    memory location.
1909 ///
1910 /// \headerfile <x86intrin.h>
1911 ///
1912 /// This intrinsic corresponds to the <c> VMOVSD / MOVSD </c> instruction.
1913 ///
1914 /// \param __dp
1915 ///    A pointer to a 64-bit memory location.
1916 /// \param __a
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)
1920 {
1921   struct __mm_store_sd_struct {
1922     double __u;
1923   } __attribute__((__packed__, __may_alias__));
1924   ((struct __mm_store_sd_struct*)__dp)->__u = __a[0];
1925 }
1926
1927 /// Moves packed double-precision values from a 128-bit vector of
1928 ///    [2 x double] to a memory location.
1929 ///
1930 /// \headerfile <x86intrin.h>
1931 ///
1932 /// This intrinsic corresponds to the <c>VMOVAPD / MOVAPS</c> instruction.
1933 ///
1934 /// \param __dp
1935 ///    A pointer to an aligned memory location that can store two
1936 ///    double-precision values.
1937 /// \param __a
1938 ///    A packed 128-bit vector of [2 x double] containing the values to be
1939 ///    moved.
1940 static __inline__ void __DEFAULT_FN_ATTRS
1941 _mm_store_pd(double *__dp, __m128d __a)
1942 {
1943   *(__m128d*)__dp = __a;
1944 }
1945
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.
1948 ///
1949 /// \headerfile <x86intrin.h>
1950 ///
1951 /// This intrinsic corresponds to the
1952 ///   <c> VMOVDDUP + VMOVAPD / MOVLHPS + MOVAPS </c> instruction.
1953 ///
1954 /// \param __dp
1955 ///    A pointer to a memory location that can store two double-precision
1956 ///    values.
1957 /// \param __a
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)
1962 {
1963   __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0);
1964   _mm_store_pd(__dp, __a);
1965 }
1966
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.
1969 ///
1970 /// \headerfile <x86intrin.h>
1971 ///
1972 /// This intrinsic corresponds to the
1973 ///   <c> VMOVDDUP + VMOVAPD / MOVLHPS + MOVAPS </c> instruction.
1974 ///
1975 /// \param __dp
1976 ///    A pointer to a memory location that can store two double-precision
1977 ///    values.
1978 /// \param __a
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)
1983 {
1984   _mm_store1_pd(__dp, __a);
1985 }
1986
1987 /// Stores a 128-bit vector of [2 x double] into an unaligned memory
1988 ///    location.
1989 ///
1990 /// \headerfile <x86intrin.h>
1991 ///
1992 /// This intrinsic corresponds to the <c> VMOVUPD / MOVUPD </c> instruction.
1993 ///
1994 /// \param __dp
1995 ///    A pointer to a 128-bit memory location. The address of the memory
1996 ///    location does not have to be aligned.
1997 /// \param __a
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)
2001 {
2002   struct __storeu_pd {
2003     __m128d __v;
2004   } __attribute__((__packed__, __may_alias__));
2005   ((struct __storeu_pd*)__dp)->__v = __a;
2006 }
2007
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.
2010 ///
2011 /// \headerfile <x86intrin.h>
2012 ///
2013 /// This intrinsic corresponds to a shuffling instruction followed by a
2014 /// <c> VMOVAPD / MOVAPD </c> instruction.
2015 ///
2016 /// \param __dp
2017 ///    A pointer to a 16-byte aligned memory location that can store two
2018 ///    double-precision values.
2019 /// \param __a
2020 ///    A 128-bit vector of [2 x double] containing the values to be reversed and
2021 ///    stored.
2022 static __inline__ void __DEFAULT_FN_ATTRS
2023 _mm_storer_pd(double *__dp, __m128d __a)
2024 {
2025   __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 1, 0);
2026   *(__m128d *)__dp = __a;
2027 }
2028
2029 /// Stores the upper 64 bits of a 128-bit vector of [2 x double] to a
2030 ///    memory location.
2031 ///
2032 /// \headerfile <x86intrin.h>
2033 ///
2034 /// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
2035 ///
2036 /// \param __dp
2037 ///    A pointer to a 64-bit memory location.
2038 /// \param __a
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)
2042 {
2043   struct __mm_storeh_pd_struct {
2044     double __u;
2045   } __attribute__((__packed__, __may_alias__));
2046   ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1];
2047 }
2048
2049 /// Stores the lower 64 bits of a 128-bit vector of [2 x double] to a
2050 ///    memory location.
2051 ///
2052 /// \headerfile <x86intrin.h>
2053 ///
2054 /// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
2055 ///
2056 /// \param __dp
2057 ///    A pointer to a 64-bit memory location.
2058 /// \param __a
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)
2062 {
2063   struct __mm_storeh_pd_struct {
2064     double __u;
2065   } __attribute__((__packed__, __may_alias__));
2066   ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0];
2067 }
2068
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].
2072 ///
2073 ///    The integer elements of both parameters can be either signed or unsigned.
2074 ///
2075 /// \headerfile <x86intrin.h>
2076 ///
2077 /// This intrinsic corresponds to the <c> VPADDB / PADDB </c> instruction.
2078 ///
2079 /// \param __a
2080 ///    A 128-bit vector of [16 x i8].
2081 /// \param __b
2082 ///    A 128-bit vector of [16 x i8].
2083 /// \returns A 128-bit vector of [16 x i8] containing the sums of both
2084 ///    parameters.
2085 static __inline__ __m128i __DEFAULT_FN_ATTRS
2086 _mm_add_epi8(__m128i __a, __m128i __b)
2087 {
2088   return (__m128i)((__v16qu)__a + (__v16qu)__b);
2089 }
2090
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].
2094 ///
2095 ///    The integer elements of both parameters can be either signed or unsigned.
2096 ///
2097 /// \headerfile <x86intrin.h>
2098 ///
2099 /// This intrinsic corresponds to the <c> VPADDW / PADDW </c> instruction.
2100 ///
2101 /// \param __a
2102 ///    A 128-bit vector of [8 x i16].
2103 /// \param __b
2104 ///    A 128-bit vector of [8 x i16].
2105 /// \returns A 128-bit vector of [8 x i16] containing the sums of both
2106 ///    parameters.
2107 static __inline__ __m128i __DEFAULT_FN_ATTRS
2108 _mm_add_epi16(__m128i __a, __m128i __b)
2109 {
2110   return (__m128i)((__v8hu)__a + (__v8hu)__b);
2111 }
2112
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].
2116 ///
2117 ///    The integer elements of both parameters can be either signed or unsigned.
2118 ///
2119 /// \headerfile <x86intrin.h>
2120 ///
2121 /// This intrinsic corresponds to the <c> VPADDD / PADDD </c> instruction.
2122 ///
2123 /// \param __a
2124 ///    A 128-bit vector of [4 x i32].
2125 /// \param __b
2126 ///    A 128-bit vector of [4 x i32].
2127 /// \returns A 128-bit vector of [4 x i32] containing the sums of both
2128 ///    parameters.
2129 static __inline__ __m128i __DEFAULT_FN_ATTRS
2130 _mm_add_epi32(__m128i __a, __m128i __b)
2131 {
2132   return (__m128i)((__v4su)__a + (__v4su)__b);
2133 }
2134
2135 /// Adds two signed or unsigned 64-bit integer values, returning the
2136 ///    lower 64 bits of the sum.
2137 ///
2138 /// \headerfile <x86intrin.h>
2139 ///
2140 /// This intrinsic corresponds to the <c> PADDQ </c> instruction.
2141 ///
2142 /// \param __a
2143 ///    A 64-bit integer.
2144 /// \param __b
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)
2149 {
2150   return (__m64)__builtin_ia32_paddq((__v1di)__a, (__v1di)__b);
2151 }
2152
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].
2156 ///
2157 ///    The integer elements of both parameters can be either signed or unsigned.
2158 ///
2159 /// \headerfile <x86intrin.h>
2160 ///
2161 /// This intrinsic corresponds to the <c> VPADDQ / PADDQ </c> instruction.
2162 ///
2163 /// \param __a
2164 ///    A 128-bit vector of [2 x i64].
2165 /// \param __b
2166 ///    A 128-bit vector of [2 x i64].
2167 /// \returns A 128-bit vector of [2 x i64] containing the sums of both
2168 ///    parameters.
2169 static __inline__ __m128i __DEFAULT_FN_ATTRS
2170 _mm_add_epi64(__m128i __a, __m128i __b)
2171 {
2172   return (__m128i)((__v2du)__a + (__v2du)__b);
2173 }
2174
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.
2179 ///
2180 /// \headerfile <x86intrin.h>
2181 ///
2182 /// This intrinsic corresponds to the <c> VPADDSB / PADDSB </c> instruction.
2183 ///
2184 /// \param __a
2185 ///    A 128-bit signed [16 x i8] vector.
2186 /// \param __b
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)
2192 {
2193   return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b);
2194 }
2195
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
2200 ///    0x8000.
2201 ///
2202 /// \headerfile <x86intrin.h>
2203 ///
2204 /// This intrinsic corresponds to the <c> VPADDSW / PADDSW </c> instruction.
2205 ///
2206 /// \param __a
2207 ///    A 128-bit signed [8 x i16] vector.
2208 /// \param __b
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)
2214 {
2215   return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b);
2216 }
2217
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.
2222 ///
2223 /// \headerfile <x86intrin.h>
2224 ///
2225 /// This intrinsic corresponds to the <c> VPADDUSB / PADDUSB </c> instruction.
2226 ///
2227 /// \param __a
2228 ///    A 128-bit unsigned [16 x i8] vector.
2229 /// \param __b
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)
2235 {
2236   return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b);
2237 }
2238
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.
2243 ///
2244 /// \headerfile <x86intrin.h>
2245 ///
2246 /// This intrinsic corresponds to the <c> VPADDUSB / PADDUSB </c> instruction.
2247 ///
2248 /// \param __a
2249 ///    A 128-bit unsigned [8 x i16] vector.
2250 /// \param __b
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)
2256 {
2257   return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b);
2258 }
2259
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].
2263 ///
2264 /// \headerfile <x86intrin.h>
2265 ///
2266 /// This intrinsic corresponds to the <c> VPAVGB / PAVGB </c> instruction.
2267 ///
2268 /// \param __a
2269 ///    A 128-bit unsigned [16 x i8] vector.
2270 /// \param __b
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)
2276 {
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)
2281                  >> 1, __v16qu);
2282 }
2283
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].
2287 ///
2288 /// \headerfile <x86intrin.h>
2289 ///
2290 /// This intrinsic corresponds to the <c> VPAVGW / PAVGW </c> instruction.
2291 ///
2292 /// \param __a
2293 ///    A 128-bit unsigned [8 x i16] vector.
2294 /// \param __b
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)
2300 {
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)
2305                  >> 1, __v8hu);
2306 }
2307
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.
2312 ///
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]
2316 ///    of the result.
2317 ///
2318 /// \headerfile <x86intrin.h>
2319 ///
2320 /// This intrinsic corresponds to the <c> VPMADDWD / PMADDWD </c> instruction.
2321 ///
2322 /// \param __a
2323 ///    A 128-bit signed [8 x i16] vector.
2324 /// \param __b
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)
2330 {
2331   return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b);
2332 }
2333
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].
2337 ///
2338 /// \headerfile <x86intrin.h>
2339 ///
2340 /// This intrinsic corresponds to the <c> VPMAXSW / PMAXSW </c> instruction.
2341 ///
2342 /// \param __a
2343 ///    A 128-bit signed [8 x i16] vector.
2344 /// \param __b
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)
2350 {
2351   return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b);
2352 }
2353
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].
2357 ///
2358 /// \headerfile <x86intrin.h>
2359 ///
2360 /// This intrinsic corresponds to the <c> VPMAXUB / PMAXUB </c> instruction.
2361 ///
2362 /// \param __a
2363 ///    A 128-bit unsigned [16 x i8] vector.
2364 /// \param __b
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)
2370 {
2371   return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b);
2372 }
2373
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].
2377 ///
2378 /// \headerfile <x86intrin.h>
2379 ///
2380 /// This intrinsic corresponds to the <c> VPMINSW / PMINSW </c> instruction.
2381 ///
2382 /// \param __a
2383 ///    A 128-bit signed [8 x i16] vector.
2384 /// \param __b
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)
2390 {
2391   return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b);
2392 }
2393
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].
2397 ///
2398 /// \headerfile <x86intrin.h>
2399 ///
2400 /// This intrinsic corresponds to the <c> VPMINUB / PMINUB </c> instruction.
2401 ///
2402 /// \param __a
2403 ///    A 128-bit unsigned [16 x i8] vector.
2404 /// \param __b
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)
2410 {
2411   return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b);
2412 }
2413
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.
2417 ///
2418 /// \headerfile <x86intrin.h>
2419 ///
2420 /// This intrinsic corresponds to the <c> VPMULHW / PMULHW </c> instruction.
2421 ///
2422 /// \param __a
2423 ///    A 128-bit signed [8 x i16] vector.
2424 /// \param __b
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)
2430 {
2431   return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b);
2432 }
2433
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.
2437 ///
2438 /// \headerfile <x86intrin.h>
2439 ///
2440 /// This intrinsic corresponds to the <c> VPMULHUW / PMULHUW </c> instruction.
2441 ///
2442 /// \param __a
2443 ///    A 128-bit unsigned [8 x i16] vector.
2444 /// \param __b
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)
2450 {
2451   return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
2452 }
2453
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.
2457 ///
2458 /// \headerfile <x86intrin.h>
2459 ///
2460 /// This intrinsic corresponds to the <c> VPMULLW / PMULLW </c> instruction.
2461 ///
2462 /// \param __a
2463 ///    A 128-bit signed [8 x i16] vector.
2464 /// \param __b
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)
2470 {
2471   return (__m128i)((__v8hu)__a * (__v8hu)__b);
2472 }
2473
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
2476 ///    product.
2477 ///
2478 /// \headerfile <x86intrin.h>
2479 ///
2480 /// This intrinsic corresponds to the <c> PMULUDQ </c> instruction.
2481 ///
2482 /// \param __a
2483 ///    A 64-bit integer containing one of the source operands.
2484 /// \param __b
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)
2489 {
2490   return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b);
2491 }
2492
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.
2496 ///
2497 /// \headerfile <x86intrin.h>
2498 ///
2499 /// This intrinsic corresponds to the <c> VPMULUDQ / PMULUDQ </c> instruction.
2500 ///
2501 /// \param __a
2502 ///    A [2 x i64] vector containing one of the source operands.
2503 /// \param __b
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)
2508 {
2509   return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b);
2510 }
2511
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.
2517 ///
2518 /// \headerfile <x86intrin.h>
2519 ///
2520 /// This intrinsic corresponds to the <c> VPSADBW / PSADBW </c> instruction.
2521 ///
2522 /// \param __a
2523 ///    A 128-bit integer vector containing one of the source operands.
2524 /// \param __b
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)
2530 {
2531   return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b);
2532 }
2533
2534 /// Subtracts the corresponding 8-bit integer values in the operands.
2535 ///
2536 /// \headerfile <x86intrin.h>
2537 ///
2538 /// This intrinsic corresponds to the <c> VPSUBB / PSUBB </c> instruction.
2539 ///
2540 /// \param __a
2541 ///    A 128-bit integer vector containing the minuends.
2542 /// \param __b
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)
2548 {
2549   return (__m128i)((__v16qu)__a - (__v16qu)__b);
2550 }
2551
2552 /// Subtracts the corresponding 16-bit integer values in the operands.
2553 ///
2554 /// \headerfile <x86intrin.h>
2555 ///
2556 /// This intrinsic corresponds to the <c> VPSUBW / PSUBW </c> instruction.
2557 ///
2558 /// \param __a
2559 ///    A 128-bit integer vector containing the minuends.
2560 /// \param __b
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)
2566 {
2567   return (__m128i)((__v8hu)__a - (__v8hu)__b);
2568 }
2569
2570 /// Subtracts the corresponding 32-bit integer values in the operands.
2571 ///
2572 /// \headerfile <x86intrin.h>
2573 ///
2574 /// This intrinsic corresponds to the <c> VPSUBD / PSUBD </c> instruction.
2575 ///
2576 /// \param __a
2577 ///    A 128-bit integer vector containing the minuends.
2578 /// \param __b
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)
2584 {
2585   return (__m128i)((__v4su)__a - (__v4su)__b);
2586 }
2587
2588 /// Subtracts signed or unsigned 64-bit integer values and writes the
2589 ///    difference to the corresponding bits in the destination.
2590 ///
2591 /// \headerfile <x86intrin.h>
2592 ///
2593 /// This intrinsic corresponds to the <c> PSUBQ </c> instruction.
2594 ///
2595 /// \param __a
2596 ///    A 64-bit integer vector containing the minuend.
2597 /// \param __b
2598 ///    A 64-bit integer vector containing the subtrahend.
2599 /// \returns A 64-bit integer vector containing the difference of the values in
2600 ///    the operands.
2601 static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX
2602 _mm_sub_si64(__m64 __a, __m64 __b)
2603 {
2604   return (__m64)__builtin_ia32_psubq((__v1di)__a, (__v1di)__b);
2605 }
2606
2607 /// Subtracts the corresponding elements of two [2 x i64] vectors.
2608 ///
2609 /// \headerfile <x86intrin.h>
2610 ///
2611 /// This intrinsic corresponds to the <c> VPSUBQ / PSUBQ </c> instruction.
2612 ///
2613 /// \param __a
2614 ///    A 128-bit integer vector containing the minuends.
2615 /// \param __b
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)
2621 {
2622   return (__m128i)((__v2du)__a - (__v2du)__b);
2623 }
2624
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.
2629 ///
2630 /// \headerfile <x86intrin.h>
2631 ///
2632 /// This intrinsic corresponds to the <c> VPSUBSB / PSUBSB </c> instruction.
2633 ///
2634 /// \param __a
2635 ///    A 128-bit integer vector containing the minuends.
2636 /// \param __b
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)
2642 {
2643   return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b);
2644 }
2645
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.
2650 ///
2651 /// \headerfile <x86intrin.h>
2652 ///
2653 /// This intrinsic corresponds to the <c> VPSUBSW / PSUBSW </c> instruction.
2654 ///
2655 /// \param __a
2656 ///    A 128-bit integer vector containing the minuends.
2657 /// \param __b
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)
2663 {
2664   return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b);
2665 }
2666
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.
2670 ///
2671 /// \headerfile <x86intrin.h>
2672 ///
2673 /// This intrinsic corresponds to the <c> VPSUBUSB / PSUBUSB </c> instruction.
2674 ///
2675 /// \param __a
2676 ///    A 128-bit integer vector containing the minuends.
2677 /// \param __b
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)
2683 {
2684   return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b);
2685 }
2686
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.
2690 ///
2691 /// \headerfile <x86intrin.h>
2692 ///
2693 /// This intrinsic corresponds to the <c> VPSUBUSW / PSUBUSW </c> instruction.
2694 ///
2695 /// \param __a
2696 ///    A 128-bit integer vector containing the minuends.
2697 /// \param __b
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)
2703 {
2704   return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b);
2705 }
2706
2707 /// Performs a bitwise AND of two 128-bit integer vectors.
2708 ///
2709 /// \headerfile <x86intrin.h>
2710 ///
2711 /// This intrinsic corresponds to the <c> VPAND / PAND </c> instruction.
2712 ///
2713 /// \param __a
2714 ///    A 128-bit integer vector containing one of the source operands.
2715 /// \param __b
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)
2721 {
2722   return (__m128i)((__v2du)__a & (__v2du)__b);
2723 }
2724
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.
2727 ///
2728 /// \headerfile <x86intrin.h>
2729 ///
2730 /// This intrinsic corresponds to the <c> VPANDN / PANDN </c> instruction.
2731 ///
2732 /// \param __a
2733 ///    A 128-bit vector containing the left source operand. The one's complement
2734 ///    of this value is used in the bitwise AND.
2735 /// \param __b
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)
2741 {
2742   return (__m128i)(~(__v2du)__a & (__v2du)__b);
2743 }
2744 /// Performs a bitwise OR of two 128-bit integer vectors.
2745 ///
2746 /// \headerfile <x86intrin.h>
2747 ///
2748 /// This intrinsic corresponds to the <c> VPOR / POR </c> instruction.
2749 ///
2750 /// \param __a
2751 ///    A 128-bit integer vector containing one of the source operands.
2752 /// \param __b
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)
2758 {
2759   return (__m128i)((__v2du)__a | (__v2du)__b);
2760 }
2761
2762 /// Performs a bitwise exclusive OR of two 128-bit integer vectors.
2763 ///
2764 /// \headerfile <x86intrin.h>
2765 ///
2766 /// This intrinsic corresponds to the <c> VPXOR / PXOR </c> instruction.
2767 ///
2768 /// \param __a
2769 ///    A 128-bit integer vector containing one of the source operands.
2770 /// \param __b
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)
2776 {
2777   return (__m128i)((__v2du)__a ^ (__v2du)__b);
2778 }
2779
2780 /// Left-shifts the 128-bit integer vector operand by the specified
2781 ///    number of bytes. Low-order bits are cleared.
2782 ///
2783 /// \headerfile <x86intrin.h>
2784 ///
2785 /// \code
2786 /// __m128i _mm_slli_si128(__m128i a, const int imm);
2787 /// \endcode
2788 ///
2789 /// This intrinsic corresponds to the <c> VPSLLDQ / PSLLDQ </c> instruction.
2790 ///
2791 /// \param a
2792 ///    A 128-bit integer vector containing the source operand.
2793 /// \param imm
2794 ///    An immediate value specifying the number of bytes to left-shift operand
2795 ///    \a a.
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))
2799
2800 #define _mm_bslli_si128(a, imm) \
2801   (__m128i)__builtin_ia32_pslldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
2802
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.
2805 ///
2806 /// \headerfile <x86intrin.h>
2807 ///
2808 /// This intrinsic corresponds to the <c> VPSLLW / PSLLW </c> instruction.
2809 ///
2810 /// \param __a
2811 ///    A 128-bit integer vector containing the source operand.
2812 /// \param __count
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)
2818 {
2819   return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count);
2820 }
2821
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.
2824 ///
2825 /// \headerfile <x86intrin.h>
2826 ///
2827 /// This intrinsic corresponds to the <c> VPSLLW / PSLLW </c> instruction.
2828 ///
2829 /// \param __a
2830 ///    A 128-bit integer vector containing the source operand.
2831 /// \param __count
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)
2837 {
2838   return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count);
2839 }
2840
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.
2843 ///
2844 /// \headerfile <x86intrin.h>
2845 ///
2846 /// This intrinsic corresponds to the <c> VPSLLD / PSLLD </c> instruction.
2847 ///
2848 /// \param __a
2849 ///    A 128-bit integer vector containing the source operand.
2850 /// \param __count
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)
2856 {
2857   return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count);
2858 }
2859
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.
2862 ///
2863 /// \headerfile <x86intrin.h>
2864 ///
2865 /// This intrinsic corresponds to the <c> VPSLLD / PSLLD </c> instruction.
2866 ///
2867 /// \param __a
2868 ///    A 128-bit integer vector containing the source operand.
2869 /// \param __count
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)
2875 {
2876   return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count);
2877 }
2878
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.
2881 ///
2882 /// \headerfile <x86intrin.h>
2883 ///
2884 /// This intrinsic corresponds to the <c> VPSLLQ / PSLLQ </c> instruction.
2885 ///
2886 /// \param __a
2887 ///    A 128-bit integer vector containing the source operand.
2888 /// \param __count
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)
2894 {
2895   return __builtin_ia32_psllqi128((__v2di)__a, __count);
2896 }
2897
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.
2900 ///
2901 /// \headerfile <x86intrin.h>
2902 ///
2903 /// This intrinsic corresponds to the <c> VPSLLQ / PSLLQ </c> instruction.
2904 ///
2905 /// \param __a
2906 ///    A 128-bit integer vector containing the source operand.
2907 /// \param __count
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)
2913 {
2914   return __builtin_ia32_psllq128((__v2di)__a, (__v2di)__count);
2915 }
2916
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.
2920 ///
2921 /// \headerfile <x86intrin.h>
2922 ///
2923 /// This intrinsic corresponds to the <c> VPSRAW / PSRAW </c> instruction.
2924 ///
2925 /// \param __a
2926 ///    A 128-bit integer vector containing the source operand.
2927 /// \param __count
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)
2933 {
2934   return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count);
2935 }
2936
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.
2940 ///
2941 /// \headerfile <x86intrin.h>
2942 ///
2943 /// This intrinsic corresponds to the <c> VPSRAW / PSRAW </c> instruction.
2944 ///
2945 /// \param __a
2946 ///    A 128-bit integer vector containing the source operand.
2947 /// \param __count
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)
2953 {
2954   return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count);
2955 }
2956
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.
2960 ///
2961 /// \headerfile <x86intrin.h>
2962 ///
2963 /// This intrinsic corresponds to the <c> VPSRAD / PSRAD </c> instruction.
2964 ///
2965 /// \param __a
2966 ///    A 128-bit integer vector containing the source operand.
2967 /// \param __count
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)
2973 {
2974   return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count);
2975 }
2976
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.
2980 ///
2981 /// \headerfile <x86intrin.h>
2982 ///
2983 /// This intrinsic corresponds to the <c> VPSRAD / PSRAD </c> instruction.
2984 ///
2985 /// \param __a
2986 ///    A 128-bit integer vector containing the source operand.
2987 /// \param __count
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)
2993 {
2994   return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count);
2995 }
2996
2997 /// Right-shifts the 128-bit integer vector operand by the specified
2998 ///    number of bytes. High-order bits are cleared.
2999 ///
3000 /// \headerfile <x86intrin.h>
3001 ///
3002 /// \code
3003 /// __m128i _mm_srli_si128(__m128i a, const int imm);
3004 /// \endcode
3005 ///
3006 /// This intrinsic corresponds to the <c> VPSRLDQ / PSRLDQ </c> instruction.
3007 ///
3008 /// \param a
3009 ///    A 128-bit integer vector containing the source operand.
3010 /// \param imm
3011 ///    An immediate value specifying the number of bytes to right-shift operand
3012 ///    \a a.
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))
3016
3017 #define _mm_bsrli_si128(a, imm) \
3018   (__m128i)__builtin_ia32_psrldqi128_byteshift((__v2di)(__m128i)(a), (int)(imm))
3019
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.
3022 ///
3023 /// \headerfile <x86intrin.h>
3024 ///
3025 /// This intrinsic corresponds to the <c> VPSRLW / PSRLW </c> instruction.
3026 ///
3027 /// \param __a
3028 ///    A 128-bit integer vector containing the source operand.
3029 /// \param __count
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)
3035 {
3036   return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count);
3037 }
3038
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.
3041 ///
3042 /// \headerfile <x86intrin.h>
3043 ///
3044 /// This intrinsic corresponds to the <c> VPSRLW / PSRLW </c> instruction.
3045 ///
3046 /// \param __a
3047 ///    A 128-bit integer vector containing the source operand.
3048 /// \param __count
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)
3054 {
3055   return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count);
3056 }
3057
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.
3060 ///
3061 /// \headerfile <x86intrin.h>
3062 ///
3063 /// This intrinsic corresponds to the <c> VPSRLD / PSRLD </c> instruction.
3064 ///
3065 /// \param __a
3066 ///    A 128-bit integer vector containing the source operand.
3067 /// \param __count
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)
3073 {
3074   return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count);
3075 }
3076
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.
3079 ///
3080 /// \headerfile <x86intrin.h>
3081 ///
3082 /// This intrinsic corresponds to the <c> VPSRLD / PSRLD </c> instruction.
3083 ///
3084 /// \param __a
3085 ///    A 128-bit integer vector containing the source operand.
3086 /// \param __count
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)
3092 {
3093   return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count);
3094 }
3095
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.
3098 ///
3099 /// \headerfile <x86intrin.h>
3100 ///
3101 /// This intrinsic corresponds to the <c> VPSRLQ / PSRLQ </c> instruction.
3102 ///
3103 /// \param __a
3104 ///    A 128-bit integer vector containing the source operand.
3105 /// \param __count
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)
3111 {
3112   return __builtin_ia32_psrlqi128((__v2di)__a, __count);
3113 }
3114
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.
3117 ///
3118 /// \headerfile <x86intrin.h>
3119 ///
3120 /// This intrinsic corresponds to the <c> VPSRLQ / PSRLQ </c> instruction.
3121 ///
3122 /// \param __a
3123 ///    A 128-bit integer vector containing the source operand.
3124 /// \param __count
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)
3130 {
3131   return __builtin_ia32_psrlq128((__v2di)__a, (__v2di)__count);
3132 }
3133
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
3136 ///    for true.
3137 ///
3138 /// \headerfile <x86intrin.h>
3139 ///
3140 /// This intrinsic corresponds to the <c> VPCMPEQB / PCMPEQB </c> instruction.
3141 ///
3142 /// \param __a
3143 ///    A 128-bit integer vector.
3144 /// \param __b
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)
3149 {
3150   return (__m128i)((__v16qi)__a == (__v16qi)__b);
3151 }
3152
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.
3156 ///
3157 /// \headerfile <x86intrin.h>
3158 ///
3159 /// This intrinsic corresponds to the <c> VPCMPEQW / PCMPEQW </c> instruction.
3160 ///
3161 /// \param __a
3162 ///    A 128-bit integer vector.
3163 /// \param __b
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)
3168 {
3169   return (__m128i)((__v8hi)__a == (__v8hi)__b);
3170 }
3171
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.
3175 ///
3176 /// \headerfile <x86intrin.h>
3177 ///
3178 /// This intrinsic corresponds to the <c> VPCMPEQD / PCMPEQD </c> instruction.
3179 ///
3180 /// \param __a
3181 ///    A 128-bit integer vector.
3182 /// \param __b
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)
3187 {
3188   return (__m128i)((__v4si)__a == (__v4si)__b);
3189 }
3190
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.
3195 ///
3196 /// \headerfile <x86intrin.h>
3197 ///
3198 /// This intrinsic corresponds to the <c> VPCMPGTB / PCMPGTB </c> instruction.
3199 ///
3200 /// \param __a
3201 ///    A 128-bit integer vector.
3202 /// \param __b
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)
3207 {
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);
3211 }
3212
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.
3216 ///
3217 ///    Each comparison yields 0x0 for false, 0xFFFF for true.
3218 ///
3219 /// \headerfile <x86intrin.h>
3220 ///
3221 /// This intrinsic corresponds to the <c> VPCMPGTW / PCMPGTW </c> instruction.
3222 ///
3223 /// \param __a
3224 ///    A 128-bit integer vector.
3225 /// \param __b
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)
3230 {
3231   return (__m128i)((__v8hi)__a > (__v8hi)__b);
3232 }
3233
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.
3237 ///
3238 ///    Each comparison yields 0x0 for false, 0xFFFFFFFF for true.
3239 ///
3240 /// \headerfile <x86intrin.h>
3241 ///
3242 /// This intrinsic corresponds to the <c> VPCMPGTD / PCMPGTD </c> instruction.
3243 ///
3244 /// \param __a
3245 ///    A 128-bit integer vector.
3246 /// \param __b
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)
3251 {
3252   return (__m128i)((__v4si)__a > (__v4si)__b);
3253 }
3254
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.
3258 ///
3259 ///    Each comparison yields 0x0 for false, 0xFF for true.
3260 ///
3261 /// \headerfile <x86intrin.h>
3262 ///
3263 /// This intrinsic corresponds to the <c> VPCMPGTB / PCMPGTB </c> instruction.
3264 ///
3265 /// \param __a
3266 ///    A 128-bit integer vector.
3267 /// \param __b
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)
3272 {
3273   return _mm_cmpgt_epi8(__b, __a);
3274 }
3275
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.
3279 ///
3280 ///    Each comparison yields 0x0 for false, 0xFFFF for true.
3281 ///
3282 /// \headerfile <x86intrin.h>
3283 ///
3284 /// This intrinsic corresponds to the <c> VPCMPGTW / PCMPGTW </c> instruction.
3285 ///
3286 /// \param __a
3287 ///    A 128-bit integer vector.
3288 /// \param __b
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)
3293 {
3294   return _mm_cmpgt_epi16(__b, __a);
3295 }
3296
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.
3300 ///
3301 ///    Each comparison yields 0x0 for false, 0xFFFFFFFF for true.
3302 ///
3303 /// \headerfile <x86intrin.h>
3304 ///
3305 /// This intrinsic corresponds to the <c> VPCMPGTD / PCMPGTD </c> instruction.
3306 ///
3307 /// \param __a
3308 ///    A 128-bit integer vector.
3309 /// \param __b
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)
3314 {
3315   return _mm_cmpgt_epi32(__b, __a);
3316 }
3317
3318 #ifdef __x86_64__
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.
3323 ///
3324 /// \headerfile <x86intrin.h>
3325 ///
3326 /// This intrinsic corresponds to the <c> VCVTSI2SD / CVTSI2SD </c> instruction.
3327 ///
3328 /// \param __a
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.
3331 /// \param __b
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)
3338 {
3339   __a[0] = __b;
3340   return __a;
3341 }
3342
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.
3345 ///
3346 /// \headerfile <x86intrin.h>
3347 ///
3348 /// This intrinsic corresponds to the <c> VCVTSD2SI / CVTSD2SI </c> instruction.
3349 ///
3350 /// \param __a
3351 ///    A 128-bit vector of [2 x double]. The lower 64 bits are used in the
3352 ///    conversion.
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)
3356 {
3357   return __builtin_ia32_cvtsd2si64((__v2df)__a);
3358 }
3359
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.
3362 ///
3363 /// \headerfile <x86intrin.h>
3364 ///
3365 /// This intrinsic corresponds to the <c> VCVTTSD2SI / CVTTSD2SI </c>
3366 ///   instruction.
3367 ///
3368 /// \param __a
3369 ///    A 128-bit vector of [2 x double]. The lower 64 bits are used in the
3370 ///    conversion.
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)
3374 {
3375   return __builtin_ia32_cvttsd2si64((__v2df)__a);
3376 }
3377 #endif
3378
3379 /// Converts a vector of [4 x i32] into a vector of [4 x float].
3380 ///
3381 /// \headerfile <x86intrin.h>
3382 ///
3383 /// This intrinsic corresponds to the <c> VCVTDQ2PS / CVTDQ2PS </c> instruction.
3384 ///
3385 /// \param __a
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)
3390 {
3391   return (__m128)__builtin_convertvector((__v4si)__a, __v4sf);
3392 }
3393
3394 /// Converts a vector of [4 x float] into a vector of [4 x i32].
3395 ///
3396 /// \headerfile <x86intrin.h>
3397 ///
3398 /// This intrinsic corresponds to the <c> VCVTPS2DQ / CVTPS2DQ </c> instruction.
3399 ///
3400 /// \param __a
3401 ///    A 128-bit vector of [4 x float].
3402 /// \returns A 128-bit integer vector of [4 x i32] containing the converted
3403 ///    values.
3404 static __inline__ __m128i __DEFAULT_FN_ATTRS
3405 _mm_cvtps_epi32(__m128 __a)
3406 {
3407   return (__m128i)__builtin_ia32_cvtps2dq((__v4sf)__a);
3408 }
3409
3410 /// Converts a vector of [4 x float] into a vector of [4 x i32],
3411 ///    truncating the result when it is inexact.
3412 ///
3413 /// \headerfile <x86intrin.h>
3414 ///
3415 /// This intrinsic corresponds to the <c> VCVTTPS2DQ / CVTTPS2DQ </c>
3416 ///   instruction.
3417 ///
3418 /// \param __a
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)
3423 {
3424   return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a);
3425 }
3426
3427 /// Returns a vector of [4 x i32] where the lowest element is the input
3428 ///    operand and the remaining elements are zero.
3429 ///
3430 /// \headerfile <x86intrin.h>
3431 ///
3432 /// This intrinsic corresponds to the <c> VMOVD / MOVD </c> instruction.
3433 ///
3434 /// \param __a
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)
3439 {
3440   return __extension__ (__m128i)(__v4si){ __a, 0, 0, 0 };
3441 }
3442
3443 #ifdef __x86_64__
3444 /// Returns a vector of [2 x i64] where the lower element is the input
3445 ///    operand and the upper element is zero.
3446 ///
3447 /// \headerfile <x86intrin.h>
3448 ///
3449 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3450 ///
3451 /// \param __a
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)
3456 {
3457   return __extension__ (__m128i)(__v2di){ __a, 0 };
3458 }
3459 #endif
3460
3461 /// Moves the least significant 32 bits of a vector of [4 x i32] to a
3462 ///    32-bit signed integer value.
3463 ///
3464 /// \headerfile <x86intrin.h>
3465 ///
3466 /// This intrinsic corresponds to the <c> VMOVD / MOVD </c> instruction.
3467 ///
3468 /// \param __a
3469 ///    A vector of [4 x i32]. The least significant 32 bits are moved to the
3470 ///    destination.
3471 /// \returns A 32-bit signed integer containing the moved value.
3472 static __inline__ int __DEFAULT_FN_ATTRS
3473 _mm_cvtsi128_si32(__m128i __a)
3474 {
3475   __v4si __b = (__v4si)__a;
3476   return __b[0];
3477 }
3478
3479 #ifdef __x86_64__
3480 /// Moves the least significant 64 bits of a vector of [2 x i64] to a
3481 ///    64-bit signed integer value.
3482 ///
3483 /// \headerfile <x86intrin.h>
3484 ///
3485 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3486 ///
3487 /// \param __a
3488 ///    A vector of [2 x i64]. The least significant 64 bits are moved to the
3489 ///    destination.
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)
3493 {
3494   return __a[0];
3495 }
3496 #endif
3497
3498 /// Moves packed integer values from an aligned 128-bit memory location
3499 ///    to elements in a 128-bit integer vector.
3500 ///
3501 /// \headerfile <x86intrin.h>
3502 ///
3503 /// This intrinsic corresponds to the <c> VMOVDQA / MOVDQA </c> instruction.
3504 ///
3505 /// \param __p
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)
3510 {
3511   return *__p;
3512 }
3513
3514 /// Moves packed integer values from an unaligned 128-bit memory location
3515 ///    to elements in a 128-bit integer vector.
3516 ///
3517 /// \headerfile <x86intrin.h>
3518 ///
3519 /// This intrinsic corresponds to the <c> VMOVDQU / MOVDQU </c> instruction.
3520 ///
3521 /// \param __p
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)
3526 {
3527   struct __loadu_si128 {
3528     __m128i __v;
3529   } __attribute__((__packed__, __may_alias__));
3530   return ((struct __loadu_si128*)__p)->__v;
3531 }
3532
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.
3535 ///
3536 /// \headerfile <x86intrin.h>
3537 ///
3538 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
3539 ///
3540 /// \param __p
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)
3547 {
3548   struct __mm_loadl_epi64_struct {
3549     long long __u;
3550   } __attribute__((__packed__, __may_alias__));
3551   return __extension__ (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0};
3552 }
3553
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.
3557 ///
3558 /// \headerfile <x86intrin.h>
3559 ///
3560 /// This intrinsic has no corresponding instruction.
3561 ///
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)
3565 {
3566   return (__m128i)__builtin_ia32_undef128();
3567 }
3568
3569 /// Initializes both 64-bit values in a 128-bit vector of [2 x i64] with
3570 ///    the specified 64-bit integer values.
3571 ///
3572 /// \headerfile <x86intrin.h>
3573 ///
3574 /// This intrinsic is a utility function and does not correspond to a specific
3575 ///    instruction.
3576 ///
3577 /// \param __q1
3578 ///    A 64-bit integer value used to initialize the upper 64 bits of the
3579 ///    destination vector of [2 x i64].
3580 /// \param __q0
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)
3587 {
3588   return __extension__ (__m128i)(__v2di){ __q0, __q1 };
3589 }
3590
3591 /// Initializes both 64-bit values in a 128-bit vector of [2 x i64] with
3592 ///    the specified 64-bit integer values.
3593 ///
3594 /// \headerfile <x86intrin.h>
3595 ///
3596 /// This intrinsic is a utility function and does not correspond to a specific
3597 ///    instruction.
3598 ///
3599 /// \param __q1
3600 ///    A 64-bit integer value used to initialize the upper 64 bits of the
3601 ///    destination vector of [2 x i64].
3602 /// \param __q0
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)
3609 {
3610   return _mm_set_epi64x((long long)__q1, (long long)__q0);
3611 }
3612
3613 /// Initializes the 32-bit values in a 128-bit vector of [4 x i32] with
3614 ///    the specified 32-bit integer values.
3615 ///
3616 /// \headerfile <x86intrin.h>
3617 ///
3618 /// This intrinsic is a utility function and does not correspond to a specific
3619 ///    instruction.
3620 ///
3621 /// \param __i3
3622 ///    A 32-bit integer value used to initialize bits [127:96] of the
3623 ///    destination vector.
3624 /// \param __i2
3625 ///    A 32-bit integer value used to initialize bits [95:64] of the destination
3626 ///    vector.
3627 /// \param __i1
3628 ///    A 32-bit integer value used to initialize bits [63:32] of the destination
3629 ///    vector.
3630 /// \param __i0
3631 ///    A 32-bit integer value used to initialize bits [31:0] of the destination
3632 ///    vector.
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)
3637 {
3638   return __extension__ (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
3639 }
3640
3641 /// Initializes the 16-bit values in a 128-bit vector of [8 x i16] with
3642 ///    the specified 16-bit integer values.
3643 ///
3644 /// \headerfile <x86intrin.h>
3645 ///
3646 /// This intrinsic is a utility function and does not correspond to a specific
3647 ///    instruction.
3648 ///
3649 /// \param __w7
3650 ///    A 16-bit integer value used to initialize bits [127:112] of the
3651 ///    destination vector.
3652 /// \param __w6
3653 ///    A 16-bit integer value used to initialize bits [111:96] of the
3654 ///    destination vector.
3655 /// \param __w5
3656 ///    A 16-bit integer value used to initialize bits [95:80] of the destination
3657 ///    vector.
3658 /// \param __w4
3659 ///    A 16-bit integer value used to initialize bits [79:64] of the destination
3660 ///    vector.
3661 /// \param __w3
3662 ///    A 16-bit integer value used to initialize bits [63:48] of the destination
3663 ///    vector.
3664 /// \param __w2
3665 ///    A 16-bit integer value used to initialize bits [47:32] of the destination
3666 ///    vector.
3667 /// \param __w1
3668 ///    A 16-bit integer value used to initialize bits [31:16] of the destination
3669 ///    vector.
3670 /// \param __w0
3671 ///    A 16-bit integer value used to initialize bits [15:0] of the destination
3672 ///    vector.
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)
3677 {
3678   return __extension__ (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
3679 }
3680
3681 /// Initializes the 8-bit values in a 128-bit vector of [16 x i8] with
3682 ///    the specified 8-bit integer values.
3683 ///
3684 /// \headerfile <x86intrin.h>
3685 ///
3686 /// This intrinsic is a utility function and does not correspond to a specific
3687 ///    instruction.
3688 ///
3689 /// \param __b15
3690 ///    Initializes bits [127:120] of the destination vector.
3691 /// \param __b14
3692 ///    Initializes bits [119:112] of the destination vector.
3693 /// \param __b13
3694 ///    Initializes bits [111:104] of the destination vector.
3695 /// \param __b12
3696 ///    Initializes bits [103:96] of the destination vector.
3697 /// \param __b11
3698 ///    Initializes bits [95:88] of the destination vector.
3699 /// \param __b10
3700 ///    Initializes bits [87:80] of the destination vector.
3701 /// \param __b9
3702 ///    Initializes bits [79:72] of the destination vector.
3703 /// \param __b8
3704 ///    Initializes bits [71:64] of the destination vector.
3705 /// \param __b7
3706 ///    Initializes bits [63:56] of the destination vector.
3707 /// \param __b6
3708 ///    Initializes bits [55:48] of the destination vector.
3709 /// \param __b5
3710 ///    Initializes bits [47:40] of the destination vector.
3711 /// \param __b4
3712 ///    Initializes bits [39:32] of the destination vector.
3713 /// \param __b3
3714 ///    Initializes bits [31:24] of the destination vector.
3715 /// \param __b2
3716 ///    Initializes bits [23:16] of the destination vector.
3717 /// \param __b1
3718 ///    Initializes bits [15:8] of the destination vector.
3719 /// \param __b0
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)
3725 {
3726   return __extension__ (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
3727 }
3728
3729 /// Initializes both values in a 128-bit integer vector with the
3730 ///    specified 64-bit integer value.
3731 ///
3732 /// \headerfile <x86intrin.h>
3733 ///
3734 /// This intrinsic is a utility function and does not correspond to a specific
3735 ///    instruction.
3736 ///
3737 /// \param __q
3738 ///    Integer value used to initialize the elements of the destination integer
3739 ///    vector.
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)
3744 {
3745   return _mm_set_epi64x(__q, __q);
3746 }
3747
3748 /// Initializes both values in a 128-bit vector of [2 x i64] with the
3749 ///    specified 64-bit value.
3750 ///
3751 /// \headerfile <x86intrin.h>
3752 ///
3753 /// This intrinsic is a utility function and does not correspond to a specific
3754 ///    instruction.
3755 ///
3756 /// \param __q
3757 ///    A 64-bit value used to initialize the elements of the destination integer
3758 ///    vector.
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)
3763 {
3764   return _mm_set_epi64(__q, __q);
3765 }
3766
3767 /// Initializes all values in a 128-bit vector of [4 x i32] with the
3768 ///    specified 32-bit value.
3769 ///
3770 /// \headerfile <x86intrin.h>
3771 ///
3772 /// This intrinsic is a utility function and does not correspond to a specific
3773 ///    instruction.
3774 ///
3775 /// \param __i
3776 ///    A 32-bit value used to initialize the elements of the destination integer
3777 ///    vector.
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)
3782 {
3783   return _mm_set_epi32(__i, __i, __i, __i);
3784 }
3785
3786 /// Initializes all values in a 128-bit vector of [8 x i16] with the
3787 ///    specified 16-bit value.
3788 ///
3789 /// \headerfile <x86intrin.h>
3790 ///
3791 /// This intrinsic is a utility function and does not correspond to a specific
3792 ///    instruction.
3793 ///
3794 /// \param __w
3795 ///    A 16-bit value used to initialize the elements of the destination integer
3796 ///    vector.
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)
3801 {
3802   return _mm_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w);
3803 }
3804
3805 /// Initializes all values in a 128-bit vector of [16 x i8] with the
3806 ///    specified 8-bit value.
3807 ///
3808 /// \headerfile <x86intrin.h>
3809 ///
3810 /// This intrinsic is a utility function and does not correspond to a specific
3811 ///    instruction.
3812 ///
3813 /// \param __b
3814 ///    An 8-bit value used to initialize the elements of the destination integer
3815 ///    vector.
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)
3820 {
3821   return _mm_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b);
3822 }
3823
3824 /// Constructs a 128-bit integer vector, initialized in reverse order
3825 ///     with the specified 64-bit integral values.
3826 ///
3827 /// \headerfile <x86intrin.h>
3828 ///
3829 /// This intrinsic does not correspond to a specific instruction.
3830 ///
3831 /// \param __q0
3832 ///    A 64-bit integral value used to initialize the lower 64 bits of the
3833 ///    result.
3834 /// \param __q1
3835 ///    A 64-bit integral value used to initialize the upper 64 bits of the
3836 ///    result.
3837 /// \returns An initialized 128-bit integer vector.
3838 static __inline__ __m128i __DEFAULT_FN_ATTRS
3839 _mm_setr_epi64(__m64 __q0, __m64 __q1)
3840 {
3841   return _mm_set_epi64(__q1, __q0);
3842 }
3843
3844 /// Constructs a 128-bit integer vector, initialized in reverse order
3845 ///     with the specified 32-bit integral values.
3846 ///
3847 /// \headerfile <x86intrin.h>
3848 ///
3849 /// This intrinsic is a utility function and does not correspond to a specific
3850 ///    instruction.
3851 ///
3852 /// \param __i0
3853 ///    A 32-bit integral value used to initialize bits [31:0] of the result.
3854 /// \param __i1
3855 ///    A 32-bit integral value used to initialize bits [63:32] of the result.
3856 /// \param __i2
3857 ///    A 32-bit integral value used to initialize bits [95:64] of the result.
3858 /// \param __i3
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)
3863 {
3864   return _mm_set_epi32(__i3, __i2, __i1, __i0);
3865 }
3866
3867 /// Constructs a 128-bit integer vector, initialized in reverse order
3868 ///     with the specified 16-bit integral values.
3869 ///
3870 /// \headerfile <x86intrin.h>
3871 ///
3872 /// This intrinsic is a utility function and does not correspond to a specific
3873 ///    instruction.
3874 ///
3875 /// \param __w0
3876 ///    A 16-bit integral value used to initialize bits [15:0] of the result.
3877 /// \param __w1
3878 ///    A 16-bit integral value used to initialize bits [31:16] of the result.
3879 /// \param __w2
3880 ///    A 16-bit integral value used to initialize bits [47:32] of the result.
3881 /// \param __w3
3882 ///    A 16-bit integral value used to initialize bits [63:48] of the result.
3883 /// \param __w4
3884 ///    A 16-bit integral value used to initialize bits [79:64] of the result.
3885 /// \param __w5
3886 ///    A 16-bit integral value used to initialize bits [95:80] of the result.
3887 /// \param __w6
3888 ///    A 16-bit integral value used to initialize bits [111:96] of the result.
3889 /// \param __w7
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)
3894 {
3895   return _mm_set_epi16(__w7, __w6, __w5, __w4, __w3, __w2, __w1, __w0);
3896 }
3897
3898 /// Constructs a 128-bit integer vector, initialized in reverse order
3899 ///     with the specified 8-bit integral values.
3900 ///
3901 /// \headerfile <x86intrin.h>
3902 ///
3903 /// This intrinsic is a utility function and does not correspond to a specific
3904 ///    instruction.
3905 ///
3906 /// \param __b0
3907 ///    An 8-bit integral value used to initialize bits [7:0] of the result.
3908 /// \param __b1
3909 ///    An 8-bit integral value used to initialize bits [15:8] of the result.
3910 /// \param __b2
3911 ///    An 8-bit integral value used to initialize bits [23:16] of the result.
3912 /// \param __b3
3913 ///    An 8-bit integral value used to initialize bits [31:24] of the result.
3914 /// \param __b4
3915 ///    An 8-bit integral value used to initialize bits [39:32] of the result.
3916 /// \param __b5
3917 ///    An 8-bit integral value used to initialize bits [47:40] of the result.
3918 /// \param __b6
3919 ///    An 8-bit integral value used to initialize bits [55:48] of the result.
3920 /// \param __b7
3921 ///    An 8-bit integral value used to initialize bits [63:56] of the result.
3922 /// \param __b8
3923 ///    An 8-bit integral value used to initialize bits [71:64] of the result.
3924 /// \param __b9
3925 ///    An 8-bit integral value used to initialize bits [79:72] of the result.
3926 /// \param __b10
3927 ///    An 8-bit integral value used to initialize bits [87:80] of the result.
3928 /// \param __b11
3929 ///    An 8-bit integral value used to initialize bits [95:88] of the result.
3930 /// \param __b12
3931 ///    An 8-bit integral value used to initialize bits [103:96] of the result.
3932 /// \param __b13
3933 ///    An 8-bit integral value used to initialize bits [111:104] of the result.
3934 /// \param __b14
3935 ///    An 8-bit integral value used to initialize bits [119:112] of the result.
3936 /// \param __b15
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)
3941 {
3942   return _mm_set_epi8(__b15, __b14, __b13, __b12, __b11, __b10, __b9, __b8, __b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
3943 }
3944
3945 /// Creates a 128-bit integer vector initialized to zero.
3946 ///
3947 /// \headerfile <x86intrin.h>
3948 ///
3949 /// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
3950 ///
3951 /// \returns An initialized 128-bit integer vector with all elements set to
3952 ///    zero.
3953 static __inline__ __m128i __DEFAULT_FN_ATTRS
3954 _mm_setzero_si128(void)
3955 {
3956   return __extension__ (__m128i)(__v2di){ 0LL, 0LL };
3957 }
3958
3959 /// Stores a 128-bit integer vector to a memory location aligned on a
3960 ///    128-bit boundary.
3961 ///
3962 /// \headerfile <x86intrin.h>
3963 ///
3964 /// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
3965 ///
3966 /// \param __p
3967 ///    A pointer to an aligned memory location that will receive the integer
3968 ///    values.
3969 /// \param __b
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)
3973 {
3974   *__p = __b;
3975 }
3976
3977 /// Stores a 128-bit integer vector to an unaligned memory location.
3978 ///
3979 /// \headerfile <x86intrin.h>
3980 ///
3981 /// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
3982 ///
3983 /// \param __p
3984 ///    A pointer to a memory location that will receive the integer values.
3985 /// \param __b
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)
3989 {
3990   struct __storeu_si128 {
3991     __m128i __v;
3992   } __attribute__((__packed__, __may_alias__));
3993   ((struct __storeu_si128*)__p)->__v = __b;
3994 }
3995
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.
3999 ///
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.
4003 ///
4004 /// \headerfile <x86intrin.h>
4005 ///
4006 /// This intrinsic corresponds to the <c> VMASKMOVDQU / MASKMOVDQU </c>
4007 ///   instruction.
4008 ///
4009 /// \param __d
4010 ///    A 128-bit integer vector containing the values to be moved.
4011 /// \param __n
4012 ///    A 128-bit integer vector containing the mask. The most significant bit of
4013 ///    each byte represents the mask bits.
4014 /// \param __p
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)
4019 {
4020   __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p);
4021 }
4022
4023 /// Stores the lower 64 bits of a 128-bit integer vector of [2 x i64] to
4024 ///    a memory location.
4025 ///
4026 /// \headerfile <x86intrin.h>
4027 ///
4028 /// This intrinsic corresponds to the <c> VMOVLPS / MOVLPS </c> instruction.
4029 ///
4030 /// \param __p
4031 ///    A pointer to a 64-bit memory location that will receive the lower 64 bits
4032 ///    of the integer vector parameter.
4033 /// \param __a
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)
4038 {
4039   struct __mm_storel_epi64_struct {
4040     long long __u;
4041   } __attribute__((__packed__, __may_alias__));
4042   ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0];
4043 }
4044
4045 /// Stores a 128-bit floating point vector of [2 x double] to a 128-bit
4046 ///    aligned memory location.
4047 ///
4048 ///    To minimize caching, the data is flagged as non-temporal (unlikely to be
4049 ///    used again soon).
4050 ///
4051 /// \headerfile <x86intrin.h>
4052 ///
4053 /// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
4054 ///
4055 /// \param __p
4056 ///    A pointer to the 128-bit aligned memory location used to store the value.
4057 /// \param __a
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)
4061 {
4062   __builtin_nontemporal_store((__v2df)__a, (__v2df*)__p);
4063 }
4064
4065 /// Stores a 128-bit integer vector to a 128-bit aligned memory location.
4066 ///
4067 ///    To minimize caching, the data is flagged as non-temporal (unlikely to be
4068 ///    used again soon).
4069 ///
4070 /// \headerfile <x86intrin.h>
4071 ///
4072 /// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
4073 ///
4074 /// \param __p
4075 ///    A pointer to the 128-bit aligned memory location used to store the value.
4076 /// \param __a
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)
4080 {
4081   __builtin_nontemporal_store((__v2di)__a, (__v2di*)__p);
4082 }
4083
4084 /// Stores a 32-bit integer value in the specified memory location.
4085 ///
4086 ///    To minimize caching, the data is flagged as non-temporal (unlikely to be
4087 ///    used again soon).
4088 ///
4089 /// \headerfile <x86intrin.h>
4090 ///
4091 /// This intrinsic corresponds to the <c> MOVNTI </c> instruction.
4092 ///
4093 /// \param __p
4094 ///    A pointer to the 32-bit memory location used to store the value.
4095 /// \param __a
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)
4099 {
4100   __builtin_ia32_movnti(__p, __a);
4101 }
4102
4103 #ifdef __x86_64__
4104 /// Stores a 64-bit integer value in the specified memory location.
4105 ///
4106 ///    To minimize caching, the data is flagged as non-temporal (unlikely to be
4107 ///    used again soon).
4108 ///
4109 /// \headerfile <x86intrin.h>
4110 ///
4111 /// This intrinsic corresponds to the <c> MOVNTIQ </c> instruction.
4112 ///
4113 /// \param __p
4114 ///    A pointer to the 64-bit memory location used to store the value.
4115 /// \param __a
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)
4119 {
4120   __builtin_ia32_movnti64(__p, __a);
4121 }
4122 #endif
4123
4124 #if defined(__cplusplus)
4125 extern "C" {
4126 #endif
4127
4128 /// The cache line containing \a __p is flushed and invalidated from all
4129 ///    caches in the coherency domain.
4130 ///
4131 /// \headerfile <x86intrin.h>
4132 ///
4133 /// This intrinsic corresponds to the <c> CLFLUSH </c> instruction.
4134 ///
4135 /// \param __p
4136 ///    A pointer to the memory location used to identify the cache line to be
4137 ///    flushed.
4138 void _mm_clflush(void const * __p);
4139
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.
4144 ///
4145 /// \headerfile <x86intrin.h>
4146 ///
4147 /// This intrinsic corresponds to the <c> LFENCE </c> instruction.
4148 ///
4149 void _mm_lfence(void);
4150
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.
4155 ///
4156 /// \headerfile <x86intrin.h>
4157 ///
4158 /// This intrinsic corresponds to the <c> MFENCE </c> instruction.
4159 ///
4160 void _mm_mfence(void);
4161
4162 #if defined(__cplusplus)
4163 } // extern "C"
4164 #endif
4165
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.
4170 ///
4171 /// \headerfile <x86intrin.h>
4172 ///
4173 /// This intrinsic corresponds to the <c> VPACKSSWB / PACKSSWB </c> instruction.
4174 ///
4175 /// \param __a
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.
4181 /// \param __b
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)
4190 {
4191   return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b);
4192 }
4193
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.
4198 ///
4199 /// \headerfile <x86intrin.h>
4200 ///
4201 /// This intrinsic corresponds to the <c> VPACKSSDW / PACKSSDW </c> instruction.
4202 ///
4203 /// \param __a
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.
4209 /// \param __b
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)
4218 {
4219   return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b);
4220 }
4221
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.
4226 ///
4227 /// \headerfile <x86intrin.h>
4228 ///
4229 /// This intrinsic corresponds to the <c> VPACKUSWB / PACKUSWB </c> instruction.
4230 ///
4231 /// \param __a
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.
4237 /// \param __b
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)
4246 {
4247   return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b);
4248 }
4249
4250 /// Extracts 16 bits from a 128-bit integer vector of [8 x i16], using
4251 ///    the immediate-value parameter as a selector.
4252 ///
4253 /// \headerfile <x86intrin.h>
4254 ///
4255 /// This intrinsic corresponds to the <c> VPEXTRW / PEXTRW </c> instruction.
4256 ///
4257 /// \param __a
4258 ///    A 128-bit integer vector.
4259 /// \param __imm
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), \
4274                                                    (int)(imm))
4275
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
4279 ///    parameter.
4280 ///
4281 /// \headerfile <x86intrin.h>
4282 ///
4283 /// This intrinsic corresponds to the <c> VPINSRW / PINSRW </c> instruction.
4284 ///
4285 /// \param __a
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.
4289 /// \param __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.
4292 /// \param __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), \
4298                                        (int)(imm))
4299
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.
4303 ///
4304 /// \headerfile <x86intrin.h>
4305 ///
4306 /// This intrinsic corresponds to the <c> VPMOVMSKB / PMOVMSKB </c> instruction.
4307 ///
4308 /// \param __a
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)
4314 {
4315   return __builtin_ia32_pmovmskb128((__v16qi)__a);
4316 }
4317
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.
4321 ///
4322 /// \headerfile <x86intrin.h>
4323 ///
4324 /// \code
4325 /// __m128i _mm_shuffle_epi32(__m128i a, const int imm);
4326 /// \endcode
4327 ///
4328 /// This intrinsic corresponds to the <c> VPSHUFD / PSHUFD </c> instruction.
4329 ///
4330 /// \param a
4331 ///    A 128-bit integer vector containing the values to be copied.
4332 /// \param imm
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))
4348
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.
4352 ///
4353 /// \headerfile <x86intrin.h>
4354 ///
4355 /// \code
4356 /// __m128i _mm_shufflelo_epi16(__m128i a, const int imm);
4357 /// \endcode
4358 ///
4359 /// This intrinsic corresponds to the <c> VPSHUFLW / PSHUFLW </c> instruction.
4360 ///
4361 /// \param a
4362 ///    A 128-bit integer vector of [8 x i16]. Bits [127:64] are copied to bits
4363 ///    [127:64] of the result.
4364 /// \param imm
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))
4378
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.
4382 ///
4383 /// \headerfile <x86intrin.h>
4384 ///
4385 /// \code
4386 /// __m128i _mm_shufflehi_epi16(__m128i a, const int imm);
4387 /// \endcode
4388 ///
4389 /// This intrinsic corresponds to the <c> VPSHUFHW / PSHUFHW </c> instruction.
4390 ///
4391 /// \param a
4392 ///    A 128-bit integer vector of [8 x i16]. Bits [63:0] are copied to bits
4393 ///    [63:0] of the result.
4394 /// \param imm
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))
4408
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].
4411 ///
4412 /// \headerfile <x86intrin.h>
4413 ///
4414 /// This intrinsic corresponds to the <c> VPUNPCKHBW / PUNPCKHBW </c>
4415 ///   instruction.
4416 ///
4417 /// \param __a
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.
4427 /// \param __b
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)
4440 {
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);
4442 }
4443
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].
4446 ///
4447 /// \headerfile <x86intrin.h>
4448 ///
4449 /// This intrinsic corresponds to the <c> VPUNPCKHWD / PUNPCKHWD </c>
4450 ///   instruction.
4451 ///
4452 /// \param __a
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.
4458 /// \param __b
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)
4467 {
4468   return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
4469 }
4470
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].
4473 ///
4474 /// \headerfile <x86intrin.h>
4475 ///
4476 /// This intrinsic corresponds to the <c> VPUNPCKHDQ / PUNPCKHDQ </c>
4477 ///   instruction.
4478 ///
4479 /// \param __a
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.
4483 /// \param __b
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)
4490 {
4491   return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3);
4492 }
4493
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].
4496 ///
4497 /// \headerfile <x86intrin.h>
4498 ///
4499 /// This intrinsic corresponds to the <c> VPUNPCKHQDQ / PUNPCKHQDQ </c>
4500 ///   instruction.
4501 ///
4502 /// \param __a
4503 ///    A 128-bit vector of [2 x i64]. \n
4504 ///    Bits [127:64] are written to bits [63:0] of the destination.
4505 /// \param __b
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)
4511 {
4512   return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 1, 2+1);
4513 }
4514
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].
4517 ///
4518 /// \headerfile <x86intrin.h>
4519 ///
4520 /// This intrinsic corresponds to the <c> VPUNPCKLBW / PUNPCKLBW </c>
4521 ///   instruction.
4522 ///
4523 /// \param __a
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.
4533 /// \param __b
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)
4546 {
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);
4548 }
4549
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
4552 ///    [8 x i16].
4553 ///
4554 /// \headerfile <x86intrin.h>
4555 ///
4556 /// This intrinsic corresponds to the <c> VPUNPCKLWD / PUNPCKLWD </c>
4557 ///   instruction.
4558 ///
4559 /// \param __a
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.
4565 /// \param __b
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)
4574 {
4575   return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
4576 }
4577
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].
4580 ///
4581 /// \headerfile <x86intrin.h>
4582 ///
4583 /// This intrinsic corresponds to the <c> VPUNPCKLDQ / PUNPCKLDQ </c>
4584 ///   instruction.
4585 ///
4586 /// \param __a
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.
4590 /// \param __b
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)
4597 {
4598   return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1);
4599 }
4600
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].
4603 ///
4604 /// \headerfile <x86intrin.h>
4605 ///
4606 /// This intrinsic corresponds to the <c> VPUNPCKLQDQ / PUNPCKLQDQ </c>
4607 ///   instruction.
4608 ///
4609 /// \param __a
4610 ///    A 128-bit vector of [2 x i64]. \n
4611 ///    Bits [63:0] are written to bits [63:0] of the destination. \n
4612 /// \param __b
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)
4618 {
4619   return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 0, 2+0);
4620 }
4621
4622 /// Returns the lower 64 bits of a 128-bit integer vector as a 64-bit
4623 ///    integer.
4624 ///
4625 /// \headerfile <x86intrin.h>
4626 ///
4627 /// This intrinsic corresponds to the <c> MOVDQ2Q </c> instruction.
4628 ///
4629 /// \param __a
4630 ///    A 128-bit integer vector operand. The lower 64 bits are moved to the
4631 ///    destination.
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)
4635 {
4636   return (__m64)__a[0];
4637 }
4638
4639 /// Moves the 64-bit operand to a 128-bit integer vector, zeroing the
4640 ///    upper bits.
4641 ///
4642 /// \headerfile <x86intrin.h>
4643 ///
4644 /// This intrinsic corresponds to the <c> MOVD+VMOVQ </c> instruction.
4645 ///
4646 /// \param __a
4647 ///    A 64-bit value.
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)
4652 {
4653   return __extension__ (__m128i)(__v2di){ (long long)__a, 0 };
4654 }
4655
4656 /// Moves the lower 64 bits of a 128-bit integer vector to a 128-bit
4657 ///    integer vector, zeroing the upper bits.
4658 ///
4659 /// \headerfile <x86intrin.h>
4660 ///
4661 /// This intrinsic corresponds to the <c> VMOVQ / MOVQ </c> instruction.
4662 ///
4663 /// \param __a
4664 ///    A 128-bit integer vector operand. The lower 64 bits are moved to the
4665 ///    destination.
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)
4670 {
4671   return __builtin_shufflevector((__v2di)__a, _mm_setzero_si128(), 0, 2);
4672 }
4673
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
4676 ///    double].
4677 ///
4678 /// \headerfile <x86intrin.h>
4679 ///
4680 /// This intrinsic corresponds to the <c> VUNPCKHPD / UNPCKHPD </c> instruction.
4681 ///
4682 /// \param __a
4683 ///    A 128-bit vector of [2 x double]. \n
4684 ///    Bits [127:64] are written to bits [63:0] of the destination.
4685 /// \param __b
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)
4691 {
4692   return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 1, 2+1);
4693 }
4694
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
4697 ///    double].
4698 ///
4699 /// \headerfile <x86intrin.h>
4700 ///
4701 /// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
4702 ///
4703 /// \param __a
4704 ///    A 128-bit vector of [2 x double]. \n
4705 ///    Bits [63:0] are written to bits [63:0] of the destination.
4706 /// \param __b
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)
4712 {
4713   return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 0, 2+0);
4714 }
4715
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.
4719 ///
4720 /// \headerfile <x86intrin.h>
4721 ///
4722 /// This intrinsic corresponds to the <c> VMOVMSKPD / MOVMSKPD </c> instruction.
4723 ///
4724 /// \param __a
4725 ///    A 128-bit vector of [2 x double] containing the values with sign bits to
4726 ///    be extracted.
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)
4731 {
4732   return __builtin_ia32_movmskpd((__v2df)__a);
4733 }
4734
4735
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.
4739 ///
4740 /// \headerfile <x86intrin.h>
4741 ///
4742 /// \code
4743 /// __m128d _mm_shuffle_pd(__m128d a, __m128d b, const int i);
4744 /// \endcode
4745 ///
4746 /// This intrinsic corresponds to the <c> VSHUFPD / SHUFPD </c> instruction.
4747 ///
4748 /// \param a
4749 ///    A 128-bit vector of [2 x double].
4750 /// \param b
4751 ///    A 128-bit vector of [2 x double].
4752 /// \param i
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), \
4762                                  (int)(i))
4763
4764 /// Casts a 128-bit floating-point vector of [2 x double] into a 128-bit
4765 ///    floating-point vector of [4 x float].
4766 ///
4767 /// \headerfile <x86intrin.h>
4768 ///
4769 /// This intrinsic has no corresponding instruction.
4770 ///
4771 /// \param __a
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)
4777 {
4778   return (__m128)__a;
4779 }
4780
4781 /// Casts a 128-bit floating-point vector of [2 x double] into a 128-bit
4782 ///    integer vector.
4783 ///
4784 /// \headerfile <x86intrin.h>
4785 ///
4786 /// This intrinsic has no corresponding instruction.
4787 ///
4788 /// \param __a
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
4791 ///    parameter.
4792 static __inline__ __m128i __DEFAULT_FN_ATTRS
4793 _mm_castpd_si128(__m128d __a)
4794 {
4795   return (__m128i)__a;
4796 }
4797
4798 /// Casts a 128-bit floating-point vector of [4 x float] into a 128-bit
4799 ///    floating-point vector of [2 x double].
4800 ///
4801 /// \headerfile <x86intrin.h>
4802 ///
4803 /// This intrinsic has no corresponding instruction.
4804 ///
4805 /// \param __a
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)
4811 {
4812   return (__m128d)__a;
4813 }
4814
4815 /// Casts a 128-bit floating-point vector of [4 x float] into a 128-bit
4816 ///    integer vector.
4817 ///
4818 /// \headerfile <x86intrin.h>
4819 ///
4820 /// This intrinsic has no corresponding instruction.
4821 ///
4822 /// \param __a
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
4825 ///    parameter.
4826 static __inline__ __m128i __DEFAULT_FN_ATTRS
4827 _mm_castps_si128(__m128 __a)
4828 {
4829   return (__m128i)__a;
4830 }
4831
4832 /// Casts a 128-bit integer vector into a 128-bit floating-point vector
4833 ///    of [4 x float].
4834 ///
4835 /// \headerfile <x86intrin.h>
4836 ///
4837 /// This intrinsic has no corresponding instruction.
4838 ///
4839 /// \param __a
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)
4845 {
4846   return (__m128)__a;
4847 }
4848
4849 /// Casts a 128-bit integer vector into a 128-bit floating-point vector
4850 ///    of [2 x double].
4851 ///
4852 /// \headerfile <x86intrin.h>
4853 ///
4854 /// This intrinsic has no corresponding instruction.
4855 ///
4856 /// \param __a
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)
4862 {
4863   return (__m128d)__a;
4864 }
4865
4866 #if defined(__cplusplus)
4867 extern "C" {
4868 #endif
4869
4870 /// Indicates that a spin loop is being executed for the purposes of
4871 ///    optimizing power consumption during the loop.
4872 ///
4873 /// \headerfile <x86intrin.h>
4874 ///
4875 /// This intrinsic corresponds to the <c> PAUSE </c> instruction.
4876 ///
4877 void _mm_pause(void);
4878
4879 #if defined(__cplusplus)
4880 } // extern "C"
4881 #endif
4882 #undef __DEFAULT_FN_ATTRS
4883 #undef __DEFAULT_FN_ATTRS_MMX
4884
4885 #define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))
4886
4887 #define _MM_DENORMALS_ZERO_ON   (0x0040)
4888 #define _MM_DENORMALS_ZERO_OFF  (0x0000)
4889
4890 #define _MM_DENORMALS_ZERO_MASK (0x0040)
4891
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)))
4894
4895 #endif /* __EMMINTRIN_H */