clang 20.0.0git
xmmintrin.h
Go to the documentation of this file.
1/*===---- xmmintrin.h - SSE intrinsics -------------------------------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __XMMINTRIN_H
11#define __XMMINTRIN_H
12
13#if !defined(__i386__) && !defined(__x86_64__)
14#error "This header is only meant to be used on x86 and x64 architecture"
15#endif
16
17#include <mmintrin.h>
18
19typedef int __v4si __attribute__((__vector_size__(16)));
20typedef float __v4sf __attribute__((__vector_size__(16)));
21typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));
22
23typedef float __m128_u __attribute__((__vector_size__(16), __aligned__(1)));
24
25/* Unsigned types */
26typedef unsigned int __v4su __attribute__((__vector_size__(16)));
27
28/* This header should only be included in a hosted environment as it depends on
29 * a standard library to provide allocation routines. */
30#if __STDC_HOSTED__
31#include <mm_malloc.h>
32#endif
33
34/* Define the default attributes for the functions in this file. */
35#define __DEFAULT_FN_ATTRS \
36 __attribute__((__always_inline__, __nodebug__, __target__("sse,no-evex512"), \
37 __min_vector_width__(128)))
38#define __DEFAULT_FN_ATTRS_SSE2 \
39 __attribute__((__always_inline__, __nodebug__, \
40 __target__("sse2,no-evex512"), __min_vector_width__(128)))
41
42#define __trunc64(x) \
43 (__m64) __builtin_shufflevector((__v2di)(x), __extension__(__v2di){}, 0)
44#define __zext128(x) \
45 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
46 1, 2, 3)
47#define __anyext128(x) \
48 (__m128i) __builtin_shufflevector((__v2si)(x), __extension__(__v2si){}, 0, \
49 1, -1, -1)
50#define __zeroupper64(x) \
51 (__m128i) __builtin_shufflevector((__v4si)(x), __extension__(__v4si){}, 0, \
52 1, 4, 5)
53
54/// Adds the 32-bit float values in the low-order bits of the operands.
55///
56/// \headerfile <x86intrin.h>
57///
58/// This intrinsic corresponds to the <c> VADDSS / ADDSS </c> instructions.
59///
60/// \param __a
61/// A 128-bit vector of [4 x float] containing one of the source operands.
62/// The lower 32 bits of this operand are used in the calculation.
63/// \param __b
64/// A 128-bit vector of [4 x float] containing one of the source operands.
65/// The lower 32 bits of this operand are used in the calculation.
66/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the sum
67/// of the lower 32 bits of both operands. The upper 96 bits are copied from
68/// the upper 96 bits of the first source operand.
69static __inline__ __m128 __DEFAULT_FN_ATTRS
70_mm_add_ss(__m128 __a, __m128 __b)
71{
72 __a[0] += __b[0];
73 return __a;
74}
75
76/// Adds two 128-bit vectors of [4 x float], and returns the results of
77/// the addition.
78///
79/// \headerfile <x86intrin.h>
80///
81/// This intrinsic corresponds to the <c> VADDPS / ADDPS </c> instructions.
82///
83/// \param __a
84/// A 128-bit vector of [4 x float] containing one of the source operands.
85/// \param __b
86/// A 128-bit vector of [4 x float] containing one of the source operands.
87/// \returns A 128-bit vector of [4 x float] containing the sums of both
88/// operands.
89static __inline__ __m128 __DEFAULT_FN_ATTRS
90_mm_add_ps(__m128 __a, __m128 __b)
91{
92 return (__m128)((__v4sf)__a + (__v4sf)__b);
93}
94
95/// Subtracts the 32-bit float value in the low-order bits of the second
96/// operand from the corresponding value in the first operand.
97///
98/// \headerfile <x86intrin.h>
99///
100/// This intrinsic corresponds to the <c> VSUBSS / SUBSS </c> instructions.
101///
102/// \param __a
103/// A 128-bit vector of [4 x float] containing the minuend. The lower 32 bits
104/// of this operand are used in the calculation.
105/// \param __b
106/// A 128-bit vector of [4 x float] containing the subtrahend. The lower 32
107/// bits of this operand are used in the calculation.
108/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
109/// difference of the lower 32 bits of both operands. The upper 96 bits are
110/// copied from the upper 96 bits of the first source operand.
111static __inline__ __m128 __DEFAULT_FN_ATTRS
112_mm_sub_ss(__m128 __a, __m128 __b)
113{
114 __a[0] -= __b[0];
115 return __a;
116}
117
118/// Subtracts each of the values of the second operand from the first
119/// operand, both of which are 128-bit vectors of [4 x float] and returns
120/// the results of the subtraction.
121///
122/// \headerfile <x86intrin.h>
123///
124/// This intrinsic corresponds to the <c> VSUBPS / SUBPS </c> instructions.
125///
126/// \param __a
127/// A 128-bit vector of [4 x float] containing the minuend.
128/// \param __b
129/// A 128-bit vector of [4 x float] containing the subtrahend.
130/// \returns A 128-bit vector of [4 x float] containing the differences between
131/// both operands.
132static __inline__ __m128 __DEFAULT_FN_ATTRS
133_mm_sub_ps(__m128 __a, __m128 __b)
134{
135 return (__m128)((__v4sf)__a - (__v4sf)__b);
136}
137
138/// Multiplies two 32-bit float values in the low-order bits of the
139/// operands.
140///
141/// \headerfile <x86intrin.h>
142///
143/// This intrinsic corresponds to the <c> VMULSS / MULSS </c> instructions.
144///
145/// \param __a
146/// A 128-bit vector of [4 x float] containing one of the source operands.
147/// The lower 32 bits of this operand are used in the calculation.
148/// \param __b
149/// A 128-bit vector of [4 x float] containing one of the source operands.
150/// The lower 32 bits of this operand are used in the calculation.
151/// \returns A 128-bit vector of [4 x float] containing the product of the lower
152/// 32 bits of both operands. The upper 96 bits are copied from the upper 96
153/// bits of the first source operand.
154static __inline__ __m128 __DEFAULT_FN_ATTRS
155_mm_mul_ss(__m128 __a, __m128 __b)
156{
157 __a[0] *= __b[0];
158 return __a;
159}
160
161/// Multiplies two 128-bit vectors of [4 x float] and returns the
162/// results of the multiplication.
163///
164/// \headerfile <x86intrin.h>
165///
166/// This intrinsic corresponds to the <c> VMULPS / MULPS </c> instructions.
167///
168/// \param __a
169/// A 128-bit vector of [4 x float] containing one of the source operands.
170/// \param __b
171/// A 128-bit vector of [4 x float] containing one of the source operands.
172/// \returns A 128-bit vector of [4 x float] containing the products of both
173/// operands.
174static __inline__ __m128 __DEFAULT_FN_ATTRS
175_mm_mul_ps(__m128 __a, __m128 __b)
176{
177 return (__m128)((__v4sf)__a * (__v4sf)__b);
178}
179
180/// Divides the value in the low-order 32 bits of the first operand by
181/// the corresponding value in the second operand.
182///
183/// \headerfile <x86intrin.h>
184///
185/// This intrinsic corresponds to the <c> VDIVSS / DIVSS </c> instructions.
186///
187/// \param __a
188/// A 128-bit vector of [4 x float] containing the dividend. The lower 32
189/// bits of this operand are used in the calculation.
190/// \param __b
191/// A 128-bit vector of [4 x float] containing the divisor. The lower 32 bits
192/// of this operand are used in the calculation.
193/// \returns A 128-bit vector of [4 x float] containing the quotients of the
194/// lower 32 bits of both operands. The upper 96 bits are copied from the
195/// upper 96 bits of the first source operand.
196static __inline__ __m128 __DEFAULT_FN_ATTRS
197_mm_div_ss(__m128 __a, __m128 __b)
198{
199 __a[0] /= __b[0];
200 return __a;
201}
202
203/// Divides two 128-bit vectors of [4 x float].
204///
205/// \headerfile <x86intrin.h>
206///
207/// This intrinsic corresponds to the <c> VDIVPS / DIVPS </c> instructions.
208///
209/// \param __a
210/// A 128-bit vector of [4 x float] containing the dividend.
211/// \param __b
212/// A 128-bit vector of [4 x float] containing the divisor.
213/// \returns A 128-bit vector of [4 x float] containing the quotients of both
214/// operands.
215static __inline__ __m128 __DEFAULT_FN_ATTRS
216_mm_div_ps(__m128 __a, __m128 __b)
217{
218 return (__m128)((__v4sf)__a / (__v4sf)__b);
219}
220
221/// Calculates the square root of the value stored in the low-order bits
222/// of a 128-bit vector of [4 x float].
223///
224/// \headerfile <x86intrin.h>
225///
226/// This intrinsic corresponds to the <c> VSQRTSS / SQRTSS </c> instructions.
227///
228/// \param __a
229/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
230/// used in the calculation.
231/// \returns A 128-bit vector of [4 x float] containing the square root of the
232/// value in the low-order bits of the operand.
233static __inline__ __m128 __DEFAULT_FN_ATTRS
235{
236 return (__m128)__builtin_ia32_sqrtss((__v4sf)__a);
237}
238
239/// Calculates the square roots of the values stored in a 128-bit vector
240/// of [4 x float].
241///
242/// \headerfile <x86intrin.h>
243///
244/// This intrinsic corresponds to the <c> VSQRTPS / SQRTPS </c> instructions.
245///
246/// \param __a
247/// A 128-bit vector of [4 x float].
248/// \returns A 128-bit vector of [4 x float] containing the square roots of the
249/// values in the operand.
250static __inline__ __m128 __DEFAULT_FN_ATTRS
252{
253 return __builtin_ia32_sqrtps((__v4sf)__a);
254}
255
256/// Calculates the approximate reciprocal of the value stored in the
257/// low-order bits of a 128-bit vector of [4 x float].
258///
259/// \headerfile <x86intrin.h>
260///
261/// This intrinsic corresponds to the <c> VRCPSS / RCPSS </c> instructions.
262///
263/// \param __a
264/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
265/// used in the calculation.
266/// \returns A 128-bit vector of [4 x float] containing the approximate
267/// reciprocal of the value in the low-order bits of the operand.
268static __inline__ __m128 __DEFAULT_FN_ATTRS
270{
271 return (__m128)__builtin_ia32_rcpss((__v4sf)__a);
272}
273
274/// Calculates the approximate reciprocals of the values stored in a
275/// 128-bit vector of [4 x float].
276///
277/// \headerfile <x86intrin.h>
278///
279/// This intrinsic corresponds to the <c> VRCPPS / RCPPS </c> instructions.
280///
281/// \param __a
282/// A 128-bit vector of [4 x float].
283/// \returns A 128-bit vector of [4 x float] containing the approximate
284/// reciprocals of the values in the operand.
285static __inline__ __m128 __DEFAULT_FN_ATTRS
287{
288 return (__m128)__builtin_ia32_rcpps((__v4sf)__a);
289}
290
291/// Calculates the approximate reciprocal of the square root of the value
292/// stored in the low-order bits of a 128-bit vector of [4 x float].
293///
294/// \headerfile <x86intrin.h>
295///
296/// This intrinsic corresponds to the <c> VRSQRTSS / RSQRTSS </c> instructions.
297///
298/// \param __a
299/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
300/// used in the calculation.
301/// \returns A 128-bit vector of [4 x float] containing the approximate
302/// reciprocal of the square root of the value in the low-order bits of the
303/// operand.
304static __inline__ __m128 __DEFAULT_FN_ATTRS
306{
307 return __builtin_ia32_rsqrtss((__v4sf)__a);
308}
309
310/// Calculates the approximate reciprocals of the square roots of the
311/// values stored in a 128-bit vector of [4 x float].
312///
313/// \headerfile <x86intrin.h>
314///
315/// This intrinsic corresponds to the <c> VRSQRTPS / RSQRTPS </c> instructions.
316///
317/// \param __a
318/// A 128-bit vector of [4 x float].
319/// \returns A 128-bit vector of [4 x float] containing the approximate
320/// reciprocals of the square roots of the values in the operand.
321static __inline__ __m128 __DEFAULT_FN_ATTRS
323{
324 return __builtin_ia32_rsqrtps((__v4sf)__a);
325}
326
327/// Compares two 32-bit float values in the low-order bits of both
328/// operands and returns the lesser value in the low-order bits of the
329/// vector of [4 x float].
330///
331/// If either value in a comparison is NaN, returns the value from \a __b.
332///
333/// \headerfile <x86intrin.h>
334///
335/// This intrinsic corresponds to the <c> VMINSS / MINSS </c> instructions.
336///
337/// \param __a
338/// A 128-bit vector of [4 x float] containing one of the operands. The lower
339/// 32 bits of this operand are used in the comparison.
340/// \param __b
341/// A 128-bit vector of [4 x float] containing one of the operands. The lower
342/// 32 bits of this operand are used in the comparison.
343/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
344/// minimum value between both operands. The upper 96 bits are copied from
345/// the upper 96 bits of the first source operand.
346static __inline__ __m128 __DEFAULT_FN_ATTRS
347_mm_min_ss(__m128 __a, __m128 __b)
348{
349 return __builtin_ia32_minss((__v4sf)__a, (__v4sf)__b);
350}
351
352/// Compares two 128-bit vectors of [4 x float] and returns the lesser
353/// of each pair of values.
354///
355/// If either value in a comparison is NaN, returns the value from \a __b.
356///
357/// \headerfile <x86intrin.h>
358///
359/// This intrinsic corresponds to the <c> VMINPS / MINPS </c> instructions.
360///
361/// \param __a
362/// A 128-bit vector of [4 x float] containing one of the operands.
363/// \param __b
364/// A 128-bit vector of [4 x float] containing one of the operands.
365/// \returns A 128-bit vector of [4 x float] containing the minimum values
366/// between both operands.
367static __inline__ __m128 __DEFAULT_FN_ATTRS
368_mm_min_ps(__m128 __a, __m128 __b)
369{
370 return __builtin_ia32_minps((__v4sf)__a, (__v4sf)__b);
371}
372
373/// Compares two 32-bit float values in the low-order bits of both
374/// operands and returns the greater value in the low-order bits of a 128-bit
375/// vector of [4 x float].
376///
377/// If either value in a comparison is NaN, returns the value from \a __b.
378///
379/// \headerfile <x86intrin.h>
380///
381/// This intrinsic corresponds to the <c> VMAXSS / MAXSS </c> instructions.
382///
383/// \param __a
384/// A 128-bit vector of [4 x float] containing one of the operands. The lower
385/// 32 bits of this operand are used in the comparison.
386/// \param __b
387/// A 128-bit vector of [4 x float] containing one of the operands. The lower
388/// 32 bits of this operand are used in the comparison.
389/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
390/// maximum value between both operands. The upper 96 bits are copied from
391/// the upper 96 bits of the first source operand.
392static __inline__ __m128 __DEFAULT_FN_ATTRS
393_mm_max_ss(__m128 __a, __m128 __b)
394{
395 return __builtin_ia32_maxss((__v4sf)__a, (__v4sf)__b);
396}
397
398/// Compares two 128-bit vectors of [4 x float] and returns the greater
399/// of each pair of values.
400///
401/// If either value in a comparison is NaN, returns the value from \a __b.
402///
403/// \headerfile <x86intrin.h>
404///
405/// This intrinsic corresponds to the <c> VMAXPS / MAXPS </c> instructions.
406///
407/// \param __a
408/// A 128-bit vector of [4 x float] containing one of the operands.
409/// \param __b
410/// A 128-bit vector of [4 x float] containing one of the operands.
411/// \returns A 128-bit vector of [4 x float] containing the maximum values
412/// between both operands.
413static __inline__ __m128 __DEFAULT_FN_ATTRS
414_mm_max_ps(__m128 __a, __m128 __b)
415{
416 return __builtin_ia32_maxps((__v4sf)__a, (__v4sf)__b);
417}
418
419/// Performs a bitwise AND of two 128-bit vectors of [4 x float].
420///
421/// \headerfile <x86intrin.h>
422///
423/// This intrinsic corresponds to the <c> VANDPS / ANDPS </c> instructions.
424///
425/// \param __a
426/// A 128-bit vector containing one of the source operands.
427/// \param __b
428/// A 128-bit vector containing one of the source operands.
429/// \returns A 128-bit vector of [4 x float] containing the bitwise AND of the
430/// values between both operands.
431static __inline__ __m128 __DEFAULT_FN_ATTRS
432_mm_and_ps(__m128 __a, __m128 __b)
433{
434 return (__m128)((__v4su)__a & (__v4su)__b);
435}
436
437/// Performs a bitwise AND of two 128-bit vectors of [4 x float], using
438/// the one's complement of the values contained in the first source
439/// operand.
440///
441/// \headerfile <x86intrin.h>
442///
443/// This intrinsic corresponds to the <c> VANDNPS / ANDNPS </c> instructions.
444///
445/// \param __a
446/// A 128-bit vector of [4 x float] containing the first source operand. The
447/// one's complement of this value is used in the bitwise AND.
448/// \param __b
449/// A 128-bit vector of [4 x float] containing the second source operand.
450/// \returns A 128-bit vector of [4 x float] containing the bitwise AND of the
451/// one's complement of the first operand and the values in the second
452/// operand.
453static __inline__ __m128 __DEFAULT_FN_ATTRS
454_mm_andnot_ps(__m128 __a, __m128 __b)
455{
456 return (__m128)(~(__v4su)__a & (__v4su)__b);
457}
458
459/// Performs a bitwise OR of two 128-bit vectors of [4 x float].
460///
461/// \headerfile <x86intrin.h>
462///
463/// This intrinsic corresponds to the <c> VORPS / ORPS </c> instructions.
464///
465/// \param __a
466/// A 128-bit vector of [4 x float] containing one of the source operands.
467/// \param __b
468/// A 128-bit vector of [4 x float] containing one of the source operands.
469/// \returns A 128-bit vector of [4 x float] containing the bitwise OR of the
470/// values between both operands.
471static __inline__ __m128 __DEFAULT_FN_ATTRS
472_mm_or_ps(__m128 __a, __m128 __b)
473{
474 return (__m128)((__v4su)__a | (__v4su)__b);
475}
476
477/// Performs a bitwise exclusive OR of two 128-bit vectors of
478/// [4 x float].
479///
480/// \headerfile <x86intrin.h>
481///
482/// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instructions.
483///
484/// \param __a
485/// A 128-bit vector of [4 x float] containing one of the source operands.
486/// \param __b
487/// A 128-bit vector of [4 x float] containing one of the source operands.
488/// \returns A 128-bit vector of [4 x float] containing the bitwise exclusive OR
489/// of the values between both operands.
490static __inline__ __m128 __DEFAULT_FN_ATTRS
491_mm_xor_ps(__m128 __a, __m128 __b)
492{
493 return (__m128)((__v4su)__a ^ (__v4su)__b);
494}
495
496/// Compares two 32-bit float values in the low-order bits of both
497/// operands for equality.
498///
499/// The comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
500/// low-order bits of a vector [4 x float].
501/// If either value in a comparison is NaN, returns false.
502///
503/// \headerfile <x86intrin.h>
504///
505/// This intrinsic corresponds to the <c> VCMPEQSS / CMPEQSS </c> instructions.
506///
507/// \param __a
508/// A 128-bit vector of [4 x float] containing one of the operands. The lower
509/// 32 bits of this operand are used in the comparison.
510/// \param __b
511/// A 128-bit vector of [4 x float] containing one of the operands. The lower
512/// 32 bits of this operand are used in the comparison.
513/// \returns A 128-bit vector of [4 x float] containing the comparison results
514/// in the low-order bits.
515static __inline__ __m128 __DEFAULT_FN_ATTRS
516_mm_cmpeq_ss(__m128 __a, __m128 __b)
517{
518 return (__m128)__builtin_ia32_cmpeqss((__v4sf)__a, (__v4sf)__b);
519}
520
521/// Compares each of the corresponding 32-bit float values of the
522/// 128-bit vectors of [4 x float] for equality.
523///
524/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
525/// If either value in a comparison is NaN, returns false.
526///
527/// \headerfile <x86intrin.h>
528///
529/// This intrinsic corresponds to the <c> VCMPEQPS / CMPEQPS </c> instructions.
530///
531/// \param __a
532/// A 128-bit vector of [4 x float].
533/// \param __b
534/// A 128-bit vector of [4 x float].
535/// \returns A 128-bit vector of [4 x float] containing the comparison results.
536static __inline__ __m128 __DEFAULT_FN_ATTRS
537_mm_cmpeq_ps(__m128 __a, __m128 __b)
538{
539 return (__m128)__builtin_ia32_cmpeqps((__v4sf)__a, (__v4sf)__b);
540}
541
542/// Compares two 32-bit float values in the low-order bits of both
543/// operands to determine if the value in the first operand is less than the
544/// corresponding value in the second operand.
545///
546/// The comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
547/// low-order bits of a vector of [4 x float].
548/// If either value in a comparison is NaN, returns false.
549///
550/// \headerfile <x86intrin.h>
551///
552/// This intrinsic corresponds to the <c> VCMPLTSS / CMPLTSS </c> instructions.
553///
554/// \param __a
555/// A 128-bit vector of [4 x float] containing one of the operands. The lower
556/// 32 bits of this operand are used in the comparison.
557/// \param __b
558/// A 128-bit vector of [4 x float] containing one of the operands. The lower
559/// 32 bits of this operand are used in the comparison.
560/// \returns A 128-bit vector of [4 x float] containing the comparison results
561/// in the low-order bits.
562static __inline__ __m128 __DEFAULT_FN_ATTRS
563_mm_cmplt_ss(__m128 __a, __m128 __b)
564{
565 return (__m128)__builtin_ia32_cmpltss((__v4sf)__a, (__v4sf)__b);
566}
567
568/// Compares each of the corresponding 32-bit float values of the
569/// 128-bit vectors of [4 x float] to determine if the values in the first
570/// operand are less than those in the second operand.
571///
572/// Each comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
573/// If either value in a comparison is NaN, returns false.
574///
575/// \headerfile <x86intrin.h>
576///
577/// This intrinsic corresponds to the <c> VCMPLTPS / CMPLTPS </c> instructions.
578///
579/// \param __a
580/// A 128-bit vector of [4 x float].
581/// \param __b
582/// A 128-bit vector of [4 x float].
583/// \returns A 128-bit vector of [4 x float] containing the comparison results.
584static __inline__ __m128 __DEFAULT_FN_ATTRS
585_mm_cmplt_ps(__m128 __a, __m128 __b)
586{
587 return (__m128)__builtin_ia32_cmpltps((__v4sf)__a, (__v4sf)__b);
588}
589
590/// Compares two 32-bit float values in the low-order bits of both
591/// operands to determine if the value in the first operand is less than or
592/// equal to the corresponding value in the second operand.
593///
594/// The comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true, in
595/// the low-order bits of a vector of [4 x float].
596/// If either value in a comparison is NaN, returns false.
597///
598/// \headerfile <x86intrin.h>
599///
600/// This intrinsic corresponds to the <c> VCMPLESS / CMPLESS </c> instructions.
601///
602/// \param __a
603/// A 128-bit vector of [4 x float] containing one of the operands. The lower
604/// 32 bits of this operand are used in the comparison.
605/// \param __b
606/// A 128-bit vector of [4 x float] containing one of the operands. The lower
607/// 32 bits of this operand are used in the comparison.
608/// \returns A 128-bit vector of [4 x float] containing the comparison results
609/// in the low-order bits.
610static __inline__ __m128 __DEFAULT_FN_ATTRS
611_mm_cmple_ss(__m128 __a, __m128 __b)
612{
613 return (__m128)__builtin_ia32_cmpless((__v4sf)__a, (__v4sf)__b);
614}
615
616/// Compares each of the corresponding 32-bit float values of the
617/// 128-bit vectors of [4 x float] to determine if the values in the first
618/// operand are less than or equal to those in the second operand.
619///
620/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
621/// If either value in a comparison is NaN, returns false.
622///
623/// \headerfile <x86intrin.h>
624///
625/// This intrinsic corresponds to the <c> VCMPLEPS / CMPLEPS </c> instructions.
626///
627/// \param __a
628/// A 128-bit vector of [4 x float].
629/// \param __b
630/// A 128-bit vector of [4 x float].
631/// \returns A 128-bit vector of [4 x float] containing the comparison results.
632static __inline__ __m128 __DEFAULT_FN_ATTRS
633_mm_cmple_ps(__m128 __a, __m128 __b)
634{
635 return (__m128)__builtin_ia32_cmpleps((__v4sf)__a, (__v4sf)__b);
636}
637
638/// Compares two 32-bit float values in the low-order bits of both
639/// operands to determine if the value in the first operand is greater than
640/// the corresponding value in the second operand.
641///
642/// The comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
643/// low-order bits of a vector of [4 x float].
644/// If either value in a comparison is NaN, returns false.
645///
646/// \headerfile <x86intrin.h>
647///
648/// This intrinsic corresponds to the <c> VCMPLTSS / CMPLTSS </c> instructions.
649///
650/// \param __a
651/// A 128-bit vector of [4 x float] containing one of the operands. The lower
652/// 32 bits of this operand are used in the comparison.
653/// \param __b
654/// A 128-bit vector of [4 x float] containing one of the operands. The lower
655/// 32 bits of this operand are used in the comparison.
656/// \returns A 128-bit vector of [4 x float] containing the comparison results
657/// in the low-order bits.
658static __inline__ __m128 __DEFAULT_FN_ATTRS
659_mm_cmpgt_ss(__m128 __a, __m128 __b)
660{
661 return (__m128)__builtin_shufflevector((__v4sf)__a,
662 (__v4sf)__builtin_ia32_cmpltss((__v4sf)__b, (__v4sf)__a),
663 4, 1, 2, 3);
664}
665
666/// Compares each of the corresponding 32-bit float values of the
667/// 128-bit vectors of [4 x float] to determine if the values in the first
668/// operand are greater than those in the second operand.
669///
670/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
671/// If either value in a comparison is NaN, returns false.
672///
673/// \headerfile <x86intrin.h>
674///
675/// This intrinsic corresponds to the <c> VCMPLTPS / CMPLTPS </c> instructions.
676///
677/// \param __a
678/// A 128-bit vector of [4 x float].
679/// \param __b
680/// A 128-bit vector of [4 x float].
681/// \returns A 128-bit vector of [4 x float] containing the comparison results.
682static __inline__ __m128 __DEFAULT_FN_ATTRS
683_mm_cmpgt_ps(__m128 __a, __m128 __b)
684{
685 return (__m128)__builtin_ia32_cmpltps((__v4sf)__b, (__v4sf)__a);
686}
687
688/// Compares two 32-bit float values in the low-order bits of both
689/// operands to determine if the value in the first operand is greater than
690/// or equal to the corresponding value in the second operand.
691///
692/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
693/// low-order bits of a vector of [4 x float].
694/// If either value in a comparison is NaN, returns false.
695///
696/// \headerfile <x86intrin.h>
697///
698/// This intrinsic corresponds to the <c> VCMPLESS / CMPLESS </c> instructions.
699///
700/// \param __a
701/// A 128-bit vector of [4 x float] containing one of the operands. The lower
702/// 32 bits of this operand are used in the comparison.
703/// \param __b
704/// A 128-bit vector of [4 x float] containing one of the operands. The lower
705/// 32 bits of this operand are used in the comparison.
706/// \returns A 128-bit vector of [4 x float] containing the comparison results
707/// in the low-order bits.
708static __inline__ __m128 __DEFAULT_FN_ATTRS
709_mm_cmpge_ss(__m128 __a, __m128 __b)
710{
711 return (__m128)__builtin_shufflevector((__v4sf)__a,
712 (__v4sf)__builtin_ia32_cmpless((__v4sf)__b, (__v4sf)__a),
713 4, 1, 2, 3);
714}
715
716/// Compares each of the corresponding 32-bit float values of the
717/// 128-bit vectors of [4 x float] to determine if the values in the first
718/// operand are greater than or equal to those in the second operand.
719///
720/// Each comparison returns 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
721/// If either value in a comparison is NaN, returns false.
722///
723/// \headerfile <x86intrin.h>
724///
725/// This intrinsic corresponds to the <c> VCMPLEPS / CMPLEPS </c> instructions.
726///
727/// \param __a
728/// A 128-bit vector of [4 x float].
729/// \param __b
730/// A 128-bit vector of [4 x float].
731/// \returns A 128-bit vector of [4 x float] containing the comparison results.
732static __inline__ __m128 __DEFAULT_FN_ATTRS
733_mm_cmpge_ps(__m128 __a, __m128 __b)
734{
735 return (__m128)__builtin_ia32_cmpleps((__v4sf)__b, (__v4sf)__a);
736}
737
738/// Compares two 32-bit float values in the low-order bits of both operands
739/// for inequality.
740///
741/// The comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
742/// low-order bits of a vector of [4 x float].
743/// If either value in a comparison is NaN, returns true.
744///
745/// \headerfile <x86intrin.h>
746///
747/// This intrinsic corresponds to the <c> VCMPNEQSS / CMPNEQSS </c>
748/// instructions.
749///
750/// \param __a
751/// A 128-bit vector of [4 x float] containing one of the operands. The lower
752/// 32 bits of this operand are used in the comparison.
753/// \param __b
754/// A 128-bit vector of [4 x float] containing one of the operands. The lower
755/// 32 bits of this operand are used in the comparison.
756/// \returns A 128-bit vector of [4 x float] containing the comparison results
757/// in the low-order bits.
758static __inline__ __m128 __DEFAULT_FN_ATTRS
759_mm_cmpneq_ss(__m128 __a, __m128 __b)
760{
761 return (__m128)__builtin_ia32_cmpneqss((__v4sf)__a, (__v4sf)__b);
762}
763
764/// Compares each of the corresponding 32-bit float values of the
765/// 128-bit vectors of [4 x float] for inequality.
766///
767/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
768/// If either value in a comparison is NaN, returns true.
769///
770/// \headerfile <x86intrin.h>
771///
772/// This intrinsic corresponds to the <c> VCMPNEQPS / CMPNEQPS </c>
773/// instructions.
774///
775/// \param __a
776/// A 128-bit vector of [4 x float].
777/// \param __b
778/// A 128-bit vector of [4 x float].
779/// \returns A 128-bit vector of [4 x float] containing the comparison results.
780static __inline__ __m128 __DEFAULT_FN_ATTRS
781_mm_cmpneq_ps(__m128 __a, __m128 __b)
782{
783 return (__m128)__builtin_ia32_cmpneqps((__v4sf)__a, (__v4sf)__b);
784}
785
786/// Compares two 32-bit float values in the low-order bits of both
787/// operands to determine if the value in the first operand is not less than
788/// the corresponding value in the second operand.
789///
790/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
791/// low-order bits of a vector of [4 x float].
792/// If either value in a comparison is NaN, returns true.
793///
794/// \headerfile <x86intrin.h>
795///
796/// This intrinsic corresponds to the <c> VCMPNLTSS / CMPNLTSS </c>
797/// instructions.
798///
799/// \param __a
800/// A 128-bit vector of [4 x float] containing one of the operands. The lower
801/// 32 bits of this operand are used in the comparison.
802/// \param __b
803/// A 128-bit vector of [4 x float] containing one of the operands. The lower
804/// 32 bits of this operand are used in the comparison.
805/// \returns A 128-bit vector of [4 x float] containing the comparison results
806/// in the low-order bits.
807static __inline__ __m128 __DEFAULT_FN_ATTRS
808_mm_cmpnlt_ss(__m128 __a, __m128 __b)
809{
810 return (__m128)__builtin_ia32_cmpnltss((__v4sf)__a, (__v4sf)__b);
811}
812
813/// Compares each of the corresponding 32-bit float values of the
814/// 128-bit vectors of [4 x float] to determine if the values in the first
815/// operand are not less than those in the second operand.
816///
817/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
818/// If either value in a comparison is NaN, returns true.
819///
820/// \headerfile <x86intrin.h>
821///
822/// This intrinsic corresponds to the <c> VCMPNLTPS / CMPNLTPS </c>
823/// instructions.
824///
825/// \param __a
826/// A 128-bit vector of [4 x float].
827/// \param __b
828/// A 128-bit vector of [4 x float].
829/// \returns A 128-bit vector of [4 x float] containing the comparison results.
830static __inline__ __m128 __DEFAULT_FN_ATTRS
831_mm_cmpnlt_ps(__m128 __a, __m128 __b)
832{
833 return (__m128)__builtin_ia32_cmpnltps((__v4sf)__a, (__v4sf)__b);
834}
835
836/// Compares two 32-bit float values in the low-order bits of both
837/// operands to determine if the value in the first operand is not less than
838/// or equal to the corresponding value in the second operand.
839///
840/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
841/// low-order bits of a vector of [4 x float].
842/// If either value in a comparison is NaN, returns true.
843///
844/// \headerfile <x86intrin.h>
845///
846/// This intrinsic corresponds to the <c> VCMPNLESS / CMPNLESS </c>
847/// instructions.
848///
849/// \param __a
850/// A 128-bit vector of [4 x float] containing one of the operands. The lower
851/// 32 bits of this operand are used in the comparison.
852/// \param __b
853/// A 128-bit vector of [4 x float] containing one of the operands. The lower
854/// 32 bits of this operand are used in the comparison.
855/// \returns A 128-bit vector of [4 x float] containing the comparison results
856/// in the low-order bits.
857static __inline__ __m128 __DEFAULT_FN_ATTRS
858_mm_cmpnle_ss(__m128 __a, __m128 __b)
859{
860 return (__m128)__builtin_ia32_cmpnless((__v4sf)__a, (__v4sf)__b);
861}
862
863/// Compares each of the corresponding 32-bit float values of the
864/// 128-bit vectors of [4 x float] to determine if the values in the first
865/// operand are not less than or equal to those in the second operand.
866///
867/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
868/// If either value in a comparison is NaN, returns true.
869///
870/// \headerfile <x86intrin.h>
871///
872/// This intrinsic corresponds to the <c> VCMPNLEPS / CMPNLEPS </c>
873/// instructions.
874///
875/// \param __a
876/// A 128-bit vector of [4 x float].
877/// \param __b
878/// A 128-bit vector of [4 x float].
879/// \returns A 128-bit vector of [4 x float] containing the comparison results.
880static __inline__ __m128 __DEFAULT_FN_ATTRS
881_mm_cmpnle_ps(__m128 __a, __m128 __b)
882{
883 return (__m128)__builtin_ia32_cmpnleps((__v4sf)__a, (__v4sf)__b);
884}
885
886/// Compares two 32-bit float values in the low-order bits of both
887/// operands to determine if the value in the first operand is not greater
888/// than the corresponding value in the second operand.
889///
890/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
891/// low-order bits of a vector of [4 x float].
892/// If either value in a comparison is NaN, returns true.
893///
894/// \headerfile <x86intrin.h>
895///
896/// This intrinsic corresponds to the <c> VCMPNLTSS / CMPNLTSS </c>
897/// instructions.
898///
899/// \param __a
900/// A 128-bit vector of [4 x float] containing one of the operands. The lower
901/// 32 bits of this operand are used in the comparison.
902/// \param __b
903/// A 128-bit vector of [4 x float] containing one of the operands. The lower
904/// 32 bits of this operand are used in the comparison.
905/// \returns A 128-bit vector of [4 x float] containing the comparison results
906/// in the low-order bits.
907static __inline__ __m128 __DEFAULT_FN_ATTRS
908_mm_cmpngt_ss(__m128 __a, __m128 __b)
909{
910 return (__m128)__builtin_shufflevector((__v4sf)__a,
911 (__v4sf)__builtin_ia32_cmpnltss((__v4sf)__b, (__v4sf)__a),
912 4, 1, 2, 3);
913}
914
915/// Compares each of the corresponding 32-bit float values of the
916/// 128-bit vectors of [4 x float] to determine if the values in the first
917/// operand are not greater than those in the second operand.
918///
919/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
920/// If either value in a comparison is NaN, returns true.
921///
922/// \headerfile <x86intrin.h>
923///
924/// This intrinsic corresponds to the <c> VCMPNLTPS / CMPNLTPS </c>
925/// instructions.
926///
927/// \param __a
928/// A 128-bit vector of [4 x float].
929/// \param __b
930/// A 128-bit vector of [4 x float].
931/// \returns A 128-bit vector of [4 x float] containing the comparison results.
932static __inline__ __m128 __DEFAULT_FN_ATTRS
933_mm_cmpngt_ps(__m128 __a, __m128 __b)
934{
935 return (__m128)__builtin_ia32_cmpnltps((__v4sf)__b, (__v4sf)__a);
936}
937
938/// Compares two 32-bit float values in the low-order bits of both
939/// operands to determine if the value in the first operand is not greater
940/// than or equal to the corresponding value in the second operand.
941///
942/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true, in the
943/// low-order bits of a vector of [4 x float].
944/// If either value in a comparison is NaN, returns true.
945///
946/// \headerfile <x86intrin.h>
947///
948/// This intrinsic corresponds to the <c> VCMPNLESS / CMPNLESS </c>
949/// instructions.
950///
951/// \param __a
952/// A 128-bit vector of [4 x float] containing one of the operands. The lower
953/// 32 bits of this operand are used in the comparison.
954/// \param __b
955/// A 128-bit vector of [4 x float] containing one of the operands. The lower
956/// 32 bits of this operand are used in the comparison.
957/// \returns A 128-bit vector of [4 x float] containing the comparison results
958/// in the low-order bits.
959static __inline__ __m128 __DEFAULT_FN_ATTRS
960_mm_cmpnge_ss(__m128 __a, __m128 __b)
961{
962 return (__m128)__builtin_shufflevector((__v4sf)__a,
963 (__v4sf)__builtin_ia32_cmpnless((__v4sf)__b, (__v4sf)__a),
964 4, 1, 2, 3);
965}
966
967/// Compares each of the corresponding 32-bit float values of the
968/// 128-bit vectors of [4 x float] to determine if the values in the first
969/// operand are not greater than or equal to those in the second operand.
970///
971/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
972/// If either value in a comparison is NaN, returns true.
973///
974/// \headerfile <x86intrin.h>
975///
976/// This intrinsic corresponds to the <c> VCMPNLEPS / CMPNLEPS </c>
977/// instructions.
978///
979/// \param __a
980/// A 128-bit vector of [4 x float].
981/// \param __b
982/// A 128-bit vector of [4 x float].
983/// \returns A 128-bit vector of [4 x float] containing the comparison results.
984static __inline__ __m128 __DEFAULT_FN_ATTRS
985_mm_cmpnge_ps(__m128 __a, __m128 __b)
986{
987 return (__m128)__builtin_ia32_cmpnleps((__v4sf)__b, (__v4sf)__a);
988}
989
990/// Compares two 32-bit float values in the low-order bits of both
991/// operands to determine if the value in the first operand is ordered with
992/// respect to the corresponding value in the second operand.
993///
994/// A pair of floating-point values are ordered with respect to each
995/// other if neither value is a NaN. Each comparison returns 0x0 for false,
996/// 0xFFFFFFFF for true.
997///
998/// \headerfile <x86intrin.h>
999///
1000/// This intrinsic corresponds to the <c> VCMPORDSS / CMPORDSS </c>
1001/// instructions.
1002///
1003/// \param __a
1004/// A 128-bit vector of [4 x float] containing one of the operands. The lower
1005/// 32 bits of this operand are used in the comparison.
1006/// \param __b
1007/// A 128-bit vector of [4 x float] containing one of the operands. The lower
1008/// 32 bits of this operand are used in the comparison.
1009/// \returns A 128-bit vector of [4 x float] containing the comparison results
1010/// in the low-order bits.
1011static __inline__ __m128 __DEFAULT_FN_ATTRS
1012_mm_cmpord_ss(__m128 __a, __m128 __b)
1013{
1014 return (__m128)__builtin_ia32_cmpordss((__v4sf)__a, (__v4sf)__b);
1015}
1016
1017/// Compares each of the corresponding 32-bit float values of the
1018/// 128-bit vectors of [4 x float] to determine if the values in the first
1019/// operand are ordered with respect to those in the second operand.
1020///
1021/// A pair of floating-point values are ordered with respect to each
1022/// other if neither value is a NaN. Each comparison returns 0x0 for false,
1023/// 0xFFFFFFFF for true.
1024///
1025/// \headerfile <x86intrin.h>
1026///
1027/// This intrinsic corresponds to the <c> VCMPORDPS / CMPORDPS </c>
1028/// instructions.
1029///
1030/// \param __a
1031/// A 128-bit vector of [4 x float].
1032/// \param __b
1033/// A 128-bit vector of [4 x float].
1034/// \returns A 128-bit vector of [4 x float] containing the comparison results.
1035static __inline__ __m128 __DEFAULT_FN_ATTRS
1036_mm_cmpord_ps(__m128 __a, __m128 __b)
1037{
1038 return (__m128)__builtin_ia32_cmpordps((__v4sf)__a, (__v4sf)__b);
1039}
1040
1041/// Compares two 32-bit float values in the low-order bits of both
1042/// operands to determine if the value in the first operand is unordered
1043/// with respect to the corresponding value in the second operand.
1044///
1045/// A pair of double-precision values are unordered with respect to each
1046/// other if one or both values are NaN. Each comparison returns 0x0 for
1047/// false, 0xFFFFFFFF for true.
1048///
1049/// \headerfile <x86intrin.h>
1050///
1051/// This intrinsic corresponds to the <c> VCMPUNORDSS / CMPUNORDSS </c>
1052/// instructions.
1053///
1054/// \param __a
1055/// A 128-bit vector of [4 x float] containing one of the operands. The lower
1056/// 32 bits of this operand are used in the comparison.
1057/// \param __b
1058/// A 128-bit vector of [4 x float] containing one of the operands. The lower
1059/// 32 bits of this operand are used in the comparison.
1060/// \returns A 128-bit vector of [4 x float] containing the comparison results
1061/// in the low-order bits.
1062static __inline__ __m128 __DEFAULT_FN_ATTRS
1063_mm_cmpunord_ss(__m128 __a, __m128 __b)
1064{
1065 return (__m128)__builtin_ia32_cmpunordss((__v4sf)__a, (__v4sf)__b);
1066}
1067
1068/// Compares each of the corresponding 32-bit float values of the
1069/// 128-bit vectors of [4 x float] to determine if the values in the first
1070/// operand are unordered with respect to those in the second operand.
1071///
1072/// A pair of double-precision values are unordered with respect to each
1073/// other if one or both values are NaN. Each comparison returns 0x0 for
1074/// false, 0xFFFFFFFFFFFFFFFF for true.
1075///
1076/// \headerfile <x86intrin.h>
1077///
1078/// This intrinsic corresponds to the <c> VCMPUNORDPS / CMPUNORDPS </c>
1079/// instructions.
1080///
1081/// \param __a
1082/// A 128-bit vector of [4 x float].
1083/// \param __b
1084/// A 128-bit vector of [4 x float].
1085/// \returns A 128-bit vector of [4 x float] containing the comparison results.
1086static __inline__ __m128 __DEFAULT_FN_ATTRS
1087_mm_cmpunord_ps(__m128 __a, __m128 __b)
1088{
1089 return (__m128)__builtin_ia32_cmpunordps((__v4sf)__a, (__v4sf)__b);
1090}
1091
1092/// Compares two 32-bit float values in the low-order bits of both
1093/// operands for equality.
1094///
1095/// The comparison returns 0 for false, 1 for true. If either value in a
1096/// comparison is NaN, returns 0.
1097///
1098/// \headerfile <x86intrin.h>
1099///
1100/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c>
1101/// instructions.
1102///
1103/// \param __a
1104/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1105/// used in the comparison.
1106/// \param __b
1107/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1108/// used in the comparison.
1109/// \returns An integer containing the comparison results.
1110static __inline__ int __DEFAULT_FN_ATTRS
1111_mm_comieq_ss(__m128 __a, __m128 __b)
1112{
1113 return __builtin_ia32_comieq((__v4sf)__a, (__v4sf)__b);
1114}
1115
1116/// Compares two 32-bit float values in the low-order bits of both
1117/// operands to determine if the first operand is less than the second
1118/// operand.
1119///
1120/// The comparison returns 0 for false, 1 for true. If either value in a
1121/// comparison is NaN, returns 0.
1122///
1123/// \headerfile <x86intrin.h>
1124///
1125/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c>
1126/// instructions.
1127///
1128/// \param __a
1129/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1130/// used in the comparison.
1131/// \param __b
1132/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1133/// used in the comparison.
1134/// \returns An integer containing the comparison results.
1135static __inline__ int __DEFAULT_FN_ATTRS
1136_mm_comilt_ss(__m128 __a, __m128 __b)
1137{
1138 return __builtin_ia32_comilt((__v4sf)__a, (__v4sf)__b);
1139}
1140
1141/// Compares two 32-bit float values in the low-order bits of both
1142/// operands to determine if the first operand is less than or equal to the
1143/// second operand.
1144///
1145/// The comparison returns 0 for false, 1 for true. If either value in a
1146/// comparison is NaN, returns 0.
1147///
1148/// \headerfile <x86intrin.h>
1149///
1150/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions.
1151///
1152/// \param __a
1153/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1154/// used in the comparison.
1155/// \param __b
1156/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1157/// used in the comparison.
1158/// \returns An integer containing the comparison results.
1159static __inline__ int __DEFAULT_FN_ATTRS
1160_mm_comile_ss(__m128 __a, __m128 __b)
1161{
1162 return __builtin_ia32_comile((__v4sf)__a, (__v4sf)__b);
1163}
1164
1165/// Compares two 32-bit float values in the low-order bits of both
1166/// operands to determine if the first operand is greater than the second
1167/// operand.
1168///
1169/// The comparison returns 0 for false, 1 for true. If either value in a
1170/// comparison is NaN, returns 0.
1171///
1172/// \headerfile <x86intrin.h>
1173///
1174/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions.
1175///
1176/// \param __a
1177/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1178/// used in the comparison.
1179/// \param __b
1180/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1181/// used in the comparison.
1182/// \returns An integer containing the comparison results.
1183static __inline__ int __DEFAULT_FN_ATTRS
1184_mm_comigt_ss(__m128 __a, __m128 __b)
1185{
1186 return __builtin_ia32_comigt((__v4sf)__a, (__v4sf)__b);
1187}
1188
1189/// Compares two 32-bit float values in the low-order bits of both
1190/// operands to determine if the first operand is greater than or equal to
1191/// the second operand.
1192///
1193/// The comparison returns 0 for false, 1 for true. If either value in a
1194/// comparison is NaN, returns 0.
1195///
1196/// \headerfile <x86intrin.h>
1197///
1198/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions.
1199///
1200/// \param __a
1201/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1202/// used in the comparison.
1203/// \param __b
1204/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1205/// used in the comparison.
1206/// \returns An integer containing the comparison results.
1207static __inline__ int __DEFAULT_FN_ATTRS
1208_mm_comige_ss(__m128 __a, __m128 __b)
1209{
1210 return __builtin_ia32_comige((__v4sf)__a, (__v4sf)__b);
1211}
1212
1213/// Compares two 32-bit float values in the low-order bits of both
1214/// operands to determine if the first operand is not equal to the second
1215/// operand.
1216///
1217/// The comparison returns 0 for false, 1 for true. If either value in a
1218/// comparison is NaN, returns 1.
1219///
1220/// \headerfile <x86intrin.h>
1221///
1222/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions.
1223///
1224/// \param __a
1225/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1226/// used in the comparison.
1227/// \param __b
1228/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1229/// used in the comparison.
1230/// \returns An integer containing the comparison results.
1231static __inline__ int __DEFAULT_FN_ATTRS
1232_mm_comineq_ss(__m128 __a, __m128 __b)
1233{
1234 return __builtin_ia32_comineq((__v4sf)__a, (__v4sf)__b);
1235}
1236
1237/// Performs an unordered comparison of two 32-bit float values using
1238/// the low-order bits of both operands to determine equality.
1239///
1240/// The comparison returns 0 for false, 1 for true. If either value in a
1241/// comparison is NaN, returns 0.
1242///
1243/// \headerfile <x86intrin.h>
1244///
1245/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1246///
1247/// \param __a
1248/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1249/// used in the comparison.
1250/// \param __b
1251/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1252/// used in the comparison.
1253/// \returns An integer containing the comparison results.
1254static __inline__ int __DEFAULT_FN_ATTRS
1255_mm_ucomieq_ss(__m128 __a, __m128 __b)
1256{
1257 return __builtin_ia32_ucomieq((__v4sf)__a, (__v4sf)__b);
1258}
1259
1260/// Performs an unordered comparison of two 32-bit float values using
1261/// the low-order bits of both operands to determine if the first operand is
1262/// less than the second operand.
1263///
1264/// The comparison returns 0 for false, 1 for true. If either value in a
1265/// comparison is NaN, returns 0.
1266///
1267/// \headerfile <x86intrin.h>
1268///
1269/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1270///
1271/// \param __a
1272/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1273/// used in the comparison.
1274/// \param __b
1275/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1276/// used in the comparison.
1277/// \returns An integer containing the comparison results.
1278static __inline__ int __DEFAULT_FN_ATTRS
1279_mm_ucomilt_ss(__m128 __a, __m128 __b)
1280{
1281 return __builtin_ia32_ucomilt((__v4sf)__a, (__v4sf)__b);
1282}
1283
1284/// Performs an unordered comparison of two 32-bit float values using
1285/// the low-order bits of both operands to determine if the first operand is
1286/// less than or equal to the second operand.
1287///
1288/// The comparison returns 0 for false, 1 for true. If either value in a
1289/// comparison is NaN, returns 0.
1290///
1291/// \headerfile <x86intrin.h>
1292///
1293/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1294///
1295/// \param __a
1296/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1297/// used in the comparison.
1298/// \param __b
1299/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1300/// used in the comparison.
1301/// \returns An integer containing the comparison results.
1302static __inline__ int __DEFAULT_FN_ATTRS
1303_mm_ucomile_ss(__m128 __a, __m128 __b)
1304{
1305 return __builtin_ia32_ucomile((__v4sf)__a, (__v4sf)__b);
1306}
1307
1308/// Performs an unordered comparison of two 32-bit float values using
1309/// the low-order bits of both operands to determine if the first operand is
1310/// greater than the second operand.
1311///
1312/// The comparison returns 0 for false, 1 for true. If either value in a
1313/// comparison is NaN, returns 0.
1314///
1315/// \headerfile <x86intrin.h>
1316///
1317/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1318///
1319/// \param __a
1320/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1321/// used in the comparison.
1322/// \param __b
1323/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1324/// used in the comparison.
1325/// \returns An integer containing the comparison results.
1326static __inline__ int __DEFAULT_FN_ATTRS
1327_mm_ucomigt_ss(__m128 __a, __m128 __b)
1328{
1329 return __builtin_ia32_ucomigt((__v4sf)__a, (__v4sf)__b);
1330}
1331
1332/// Performs an unordered comparison of two 32-bit float values using
1333/// the low-order bits of both operands to determine if the first operand is
1334/// greater than or equal to the second operand.
1335///
1336/// The comparison returns 0 for false, 1 for true. If either value in a
1337/// comparison is NaN, returns 0.
1338///
1339/// \headerfile <x86intrin.h>
1340///
1341/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1342///
1343/// \param __a
1344/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1345/// used in the comparison.
1346/// \param __b
1347/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1348/// used in the comparison.
1349/// \returns An integer containing the comparison results.
1350static __inline__ int __DEFAULT_FN_ATTRS
1351_mm_ucomige_ss(__m128 __a, __m128 __b)
1352{
1353 return __builtin_ia32_ucomige((__v4sf)__a, (__v4sf)__b);
1354}
1355
1356/// Performs an unordered comparison of two 32-bit float values using
1357/// the low-order bits of both operands to determine inequality.
1358///
1359/// The comparison returns 0 for false, 1 for true. If either value in a
1360/// comparison is NaN, returns 0.
1361///
1362/// \headerfile <x86intrin.h>
1363///
1364/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions.
1365///
1366/// \param __a
1367/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1368/// used in the comparison.
1369/// \param __b
1370/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1371/// used in the comparison.
1372/// \returns An integer containing the comparison results.
1373static __inline__ int __DEFAULT_FN_ATTRS
1374_mm_ucomineq_ss(__m128 __a, __m128 __b)
1375{
1376 return __builtin_ia32_ucomineq((__v4sf)__a, (__v4sf)__b);
1377}
1378
1379/// Converts a float value contained in the lower 32 bits of a vector of
1380/// [4 x float] into a 32-bit integer.
1381///
1382/// If the converted value does not fit in a 32-bit integer, raises a
1383/// floating-point invalid exception. If the exception is masked, returns
1384/// the most negative integer.
1385///
1386/// \headerfile <x86intrin.h>
1387///
1388/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c>
1389/// instructions.
1390///
1391/// \param __a
1392/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1393/// used in the conversion.
1394/// \returns A 32-bit integer containing the converted value.
1395static __inline__ int __DEFAULT_FN_ATTRS
1397{
1398 return __builtin_ia32_cvtss2si((__v4sf)__a);
1399}
1400
1401/// Converts a float value contained in the lower 32 bits of a vector of
1402/// [4 x float] into a 32-bit integer.
1403///
1404/// If the converted value does not fit in a 32-bit integer, raises a
1405/// floating-point invalid exception. If the exception is masked, returns
1406/// the most negative integer.
1407///
1408/// \headerfile <x86intrin.h>
1409///
1410/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c>
1411/// instructions.
1412///
1413/// \param __a
1414/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1415/// used in the conversion.
1416/// \returns A 32-bit integer containing the converted value.
1417static __inline__ int __DEFAULT_FN_ATTRS
1419{
1420 return _mm_cvtss_si32(__a);
1421}
1422
1423#ifdef __x86_64__
1424
1425/// Converts a float value contained in the lower 32 bits of a vector of
1426/// [4 x float] into a 64-bit integer.
1427///
1428/// If the converted value does not fit in a 32-bit integer, raises a
1429/// floating-point invalid exception. If the exception is masked, returns
1430/// the most negative integer.
1431///
1432/// \headerfile <x86intrin.h>
1433///
1434/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c>
1435/// instructions.
1436///
1437/// \param __a
1438/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1439/// used in the conversion.
1440/// \returns A 64-bit integer containing the converted value.
1441static __inline__ long long __DEFAULT_FN_ATTRS
1442_mm_cvtss_si64(__m128 __a)
1443{
1444 return __builtin_ia32_cvtss2si64((__v4sf)__a);
1445}
1446
1447#endif
1448
1449/// Converts two low-order float values in a 128-bit vector of
1450/// [4 x float] into a 64-bit vector of [2 x i32].
1451///
1452/// If a converted value does not fit in a 32-bit integer, raises a
1453/// floating-point invalid exception. If the exception is masked, returns
1454/// the most negative integer.
1455///
1456/// \headerfile <x86intrin.h>
1457///
1458/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction.
1459///
1460/// \param __a
1461/// A 128-bit vector of [4 x float].
1462/// \returns A 64-bit integer vector containing the converted values.
1463static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1465{
1466 return __trunc64(__builtin_ia32_cvtps2dq((__v4sf)__zeroupper64(__a)));
1467}
1468
1469/// Converts two low-order float values in a 128-bit vector of
1470/// [4 x float] into a 64-bit vector of [2 x i32].
1471///
1472/// If a converted value does not fit in a 32-bit integer, raises a
1473/// floating-point invalid exception. If the exception is masked, returns
1474/// the most negative integer.
1475///
1476/// \headerfile <x86intrin.h>
1477///
1478/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction.
1479///
1480/// \param __a
1481/// A 128-bit vector of [4 x float].
1482/// \returns A 64-bit integer vector containing the converted values.
1483static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1485{
1486 return _mm_cvtps_pi32(__a);
1487}
1488
1489/// Converts the lower (first) element of a vector of [4 x float] into a signed
1490/// truncated (rounded toward zero) 32-bit integer.
1491///
1492/// If the converted value does not fit in a 32-bit integer, raises a
1493/// floating-point invalid exception. If the exception is masked, returns
1494/// the most negative integer.
1495///
1496/// \headerfile <x86intrin.h>
1497///
1498/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1499/// instructions.
1500///
1501/// \param __a
1502/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1503/// used in the conversion.
1504/// \returns A 32-bit integer containing the converted value.
1505static __inline__ int __DEFAULT_FN_ATTRS
1507{
1508 return __builtin_ia32_cvttss2si((__v4sf)__a);
1509}
1510
1511/// Converts the lower (first) element of a vector of [4 x float] into a signed
1512/// truncated (rounded toward zero) 32-bit integer.
1513///
1514/// If the converted value does not fit in a 32-bit integer, raises a
1515/// floating-point invalid exception. If the exception is masked, returns
1516/// the most negative integer.
1517///
1518/// \headerfile <x86intrin.h>
1519///
1520/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1521/// instructions.
1522///
1523/// \param __a
1524/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1525/// used in the conversion.
1526/// \returns A 32-bit integer containing the converted value.
1527static __inline__ int __DEFAULT_FN_ATTRS
1529{
1530 return _mm_cvttss_si32(__a);
1531}
1532
1533#ifdef __x86_64__
1534/// Converts the lower (first) element of a vector of [4 x float] into a signed
1535/// truncated (rounded toward zero) 64-bit integer.
1536///
1537/// If the converted value does not fit in a 64-bit integer, raises a
1538/// floating-point invalid exception. If the exception is masked, returns
1539/// the most negative integer.
1540///
1541/// \headerfile <x86intrin.h>
1542///
1543/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1544/// instructions.
1545///
1546/// \param __a
1547/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1548/// used in the conversion.
1549/// \returns A 64-bit integer containing the converted value.
1550static __inline__ long long __DEFAULT_FN_ATTRS
1551_mm_cvttss_si64(__m128 __a)
1552{
1553 return __builtin_ia32_cvttss2si64((__v4sf)__a);
1554}
1555#endif
1556
1557/// Converts the lower (first) two elements of a 128-bit vector of [4 x float]
1558/// into two signed truncated (rounded toward zero) 32-bit integers,
1559/// returned in a 64-bit vector of [2 x i32].
1560///
1561/// If a converted value does not fit in a 32-bit integer, raises a
1562/// floating-point invalid exception. If the exception is masked, returns
1563/// the most negative integer.
1564///
1565/// \headerfile <x86intrin.h>
1566///
1567/// This intrinsic corresponds to the <c> CVTTPS2PI / VTTPS2PI </c>
1568/// instructions.
1569///
1570/// \param __a
1571/// A 128-bit vector of [4 x float].
1572/// \returns A 64-bit integer vector containing the converted values.
1573static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1575{
1576 return __trunc64(__builtin_ia32_cvttps2dq((__v4sf)__zeroupper64(__a)));
1577}
1578
1579/// Converts the lower (first) two elements of a 128-bit vector of [4 x float]
1580/// into two signed truncated (rounded toward zero) 64-bit integers,
1581/// returned in a 64-bit vector of [2 x i32].
1582///
1583/// If a converted value does not fit in a 32-bit integer, raises a
1584/// floating-point invalid exception. If the exception is masked, returns
1585/// the most negative integer.
1586///
1587/// \headerfile <x86intrin.h>
1588///
1589/// This intrinsic corresponds to the <c> CVTTPS2PI </c> instruction.
1590///
1591/// \param __a
1592/// A 128-bit vector of [4 x float].
1593/// \returns A 64-bit integer vector containing the converted values.
1594static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1596{
1597 return _mm_cvttps_pi32(__a);
1598}
1599
1600/// Converts a 32-bit signed integer value into a floating point value
1601/// and writes it to the lower 32 bits of the destination. The remaining
1602/// higher order elements of the destination vector are copied from the
1603/// corresponding elements in the first operand.
1604///
1605/// \headerfile <x86intrin.h>
1606///
1607/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1608///
1609/// \param __a
1610/// A 128-bit vector of [4 x float].
1611/// \param __b
1612/// A 32-bit signed integer operand containing the value to be converted.
1613/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1614/// converted value of the second operand. The upper 96 bits are copied from
1615/// the upper 96 bits of the first operand.
1616static __inline__ __m128 __DEFAULT_FN_ATTRS
1618{
1619 __a[0] = __b;
1620 return __a;
1621}
1622
1623/// Converts a 32-bit signed integer value into a floating point value
1624/// and writes it to the lower 32 bits of the destination. The remaining
1625/// higher order elements of the destination are copied from the
1626/// corresponding elements in the first operand.
1627///
1628/// \headerfile <x86intrin.h>
1629///
1630/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1631///
1632/// \param __a
1633/// A 128-bit vector of [4 x float].
1634/// \param __b
1635/// A 32-bit signed integer operand containing the value to be converted.
1636/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1637/// converted value of the second operand. The upper 96 bits are copied from
1638/// the upper 96 bits of the first operand.
1639static __inline__ __m128 __DEFAULT_FN_ATTRS
1641{
1642 return _mm_cvtsi32_ss(__a, __b);
1643}
1644
1645#ifdef __x86_64__
1646
1647/// Converts a 64-bit signed integer value into a floating point value
1648/// and writes it to the lower 32 bits of the destination. The remaining
1649/// higher order elements of the destination are copied from the
1650/// corresponding elements in the first operand.
1651///
1652/// \headerfile <x86intrin.h>
1653///
1654/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1655///
1656/// \param __a
1657/// A 128-bit vector of [4 x float].
1658/// \param __b
1659/// A 64-bit signed integer operand containing the value to be converted.
1660/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1661/// converted value of the second operand. The upper 96 bits are copied from
1662/// the upper 96 bits of the first operand.
1663static __inline__ __m128 __DEFAULT_FN_ATTRS
1664_mm_cvtsi64_ss(__m128 __a, long long __b)
1665{
1666 __a[0] = __b;
1667 return __a;
1668}
1669
1670#endif
1671
1672/// Converts two elements of a 64-bit vector of [2 x i32] into two
1673/// floating point values and writes them to the lower 64-bits of the
1674/// destination. The remaining higher order elements of the destination are
1675/// copied from the corresponding elements in the first operand.
1676///
1677/// \headerfile <x86intrin.h>
1678///
1679/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction.
1680///
1681/// \param __a
1682/// A 128-bit vector of [4 x float].
1683/// \param __b
1684/// A 64-bit vector of [2 x i32]. The elements in this vector are converted
1685/// and written to the corresponding low-order elements in the destination.
1686/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
1687/// converted value of the second operand. The upper 64 bits are copied from
1688/// the upper 64 bits of the first operand.
1689static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
1690_mm_cvtpi32_ps(__m128 __a, __m64 __b)
1691{
1692 return (__m128)__builtin_shufflevector(
1693 (__v4sf)__a,
1694 __builtin_convertvector((__v4si)__zext128(__b), __v4sf),
1695 4, 5, 2, 3);
1696}
1697
1698/// Converts two elements of a 64-bit vector of [2 x i32] into two
1699/// floating point values and writes them to the lower 64-bits of the
1700/// destination. The remaining higher order elements of the destination are
1701/// copied from the corresponding elements in the first operand.
1702///
1703/// \headerfile <x86intrin.h>
1704///
1705/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction.
1706///
1707/// \param __a
1708/// A 128-bit vector of [4 x float].
1709/// \param __b
1710/// A 64-bit vector of [2 x i32]. The elements in this vector are converted
1711/// and written to the corresponding low-order elements in the destination.
1712/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
1713/// converted value from the second operand. The upper 64 bits are copied
1714/// from the upper 64 bits of the first operand.
1715static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
1716_mm_cvt_pi2ps(__m128 __a, __m64 __b)
1717{
1718 return _mm_cvtpi32_ps(__a, __b);
1719}
1720
1721/// Extracts a float value contained in the lower 32 bits of a vector of
1722/// [4 x float].
1723///
1724/// \headerfile <x86intrin.h>
1725///
1726/// This intrinsic has no corresponding instruction.
1727///
1728/// \param __a
1729/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1730/// used in the extraction.
1731/// \returns A 32-bit float containing the extracted value.
1732static __inline__ float __DEFAULT_FN_ATTRS
1734{
1735 return __a[0];
1736}
1737
1738/// Loads two packed float values from the address \a __p into the
1739/// high-order bits of a 128-bit vector of [4 x float]. The low-order bits
1740/// are copied from the low-order bits of the first operand.
1741///
1742/// \headerfile <x86intrin.h>
1743///
1744/// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
1745///
1746/// \param __a
1747/// A 128-bit vector of [4 x float]. Bits [63:0] are written to bits [63:0]
1748/// of the destination.
1749/// \param __p
1750/// A pointer to two packed float values. Bits [63:0] are written to bits
1751/// [127:64] of the destination.
1752/// \returns A 128-bit vector of [4 x float] containing the moved values.
1753static __inline__ __m128 __DEFAULT_FN_ATTRS
1754_mm_loadh_pi(__m128 __a, const __m64 *__p)
1755{
1756 typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));
1757 struct __mm_loadh_pi_struct {
1758 __mm_loadh_pi_v2f32 __u;
1759 } __attribute__((__packed__, __may_alias__));
1760 __mm_loadh_pi_v2f32 __b = ((const struct __mm_loadh_pi_struct*)__p)->__u;
1761 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
1762 return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
1763}
1764
1765/// Loads two packed float values from the address \a __p into the
1766/// low-order bits of a 128-bit vector of [4 x float]. The high-order bits
1767/// are copied from the high-order bits of the first operand.
1768///
1769/// \headerfile <x86intrin.h>
1770///
1771/// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
1772///
1773/// \param __a
1774/// A 128-bit vector of [4 x float]. Bits [127:64] are written to bits
1775/// [127:64] of the destination.
1776/// \param __p
1777/// A pointer to two packed float values. Bits [63:0] are written to bits
1778/// [63:0] of the destination.
1779/// \returns A 128-bit vector of [4 x float] containing the moved values.
1780static __inline__ __m128 __DEFAULT_FN_ATTRS
1781_mm_loadl_pi(__m128 __a, const __m64 *__p)
1782{
1783 typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));
1784 struct __mm_loadl_pi_struct {
1785 __mm_loadl_pi_v2f32 __u;
1786 } __attribute__((__packed__, __may_alias__));
1787 __mm_loadl_pi_v2f32 __b = ((const struct __mm_loadl_pi_struct*)__p)->__u;
1788 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
1789 return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
1790}
1791
1792/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
1793/// 32 bits of the vector are initialized with the single-precision
1794/// floating-point value loaded from a specified memory location. The upper
1795/// 96 bits are set to zero.
1796///
1797/// \headerfile <x86intrin.h>
1798///
1799/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
1800///
1801/// \param __p
1802/// A pointer to a 32-bit memory location containing a single-precision
1803/// floating-point value.
1804/// \returns An initialized 128-bit floating-point vector of [4 x float]. The
1805/// lower 32 bits contain the value loaded from the memory location. The
1806/// upper 96 bits are set to zero.
1807static __inline__ __m128 __DEFAULT_FN_ATTRS
1808_mm_load_ss(const float *__p)
1809{
1810 struct __mm_load_ss_struct {
1811 float __u;
1812 } __attribute__((__packed__, __may_alias__));
1813 float __u = ((const struct __mm_load_ss_struct*)__p)->__u;
1814 return __extension__ (__m128){ __u, 0, 0, 0 };
1815}
1816
1817/// Loads a 32-bit float value and duplicates it to all four vector
1818/// elements of a 128-bit vector of [4 x float].
1819///
1820/// \headerfile <x86intrin.h>
1821///
1822/// This intrinsic corresponds to the <c> VBROADCASTSS / MOVSS + shuffling </c>
1823/// instruction.
1824///
1825/// \param __p
1826/// A pointer to a float value to be loaded and duplicated.
1827/// \returns A 128-bit vector of [4 x float] containing the loaded and
1828/// duplicated values.
1829static __inline__ __m128 __DEFAULT_FN_ATTRS
1830_mm_load1_ps(const float *__p)
1831{
1832 struct __mm_load1_ps_struct {
1833 float __u;
1834 } __attribute__((__packed__, __may_alias__));
1835 float __u = ((const struct __mm_load1_ps_struct*)__p)->__u;
1836 return __extension__ (__m128){ __u, __u, __u, __u };
1837}
1838
1839#define _mm_load_ps1(p) _mm_load1_ps(p)
1840
1841/// Loads a 128-bit floating-point vector of [4 x float] from an aligned
1842/// memory location.
1843///
1844/// \headerfile <x86intrin.h>
1845///
1846/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
1847///
1848/// \param __p
1849/// A pointer to a 128-bit memory location. The address of the memory
1850/// location has to be 128-bit aligned.
1851/// \returns A 128-bit vector of [4 x float] containing the loaded values.
1852static __inline__ __m128 __DEFAULT_FN_ATTRS
1853_mm_load_ps(const float *__p)
1854{
1855 return *(const __m128*)__p;
1856}
1857
1858/// Loads a 128-bit floating-point vector of [4 x float] from an
1859/// unaligned memory location.
1860///
1861/// \headerfile <x86intrin.h>
1862///
1863/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
1864///
1865/// \param __p
1866/// A pointer to a 128-bit memory location. The address of the memory
1867/// location does not have to be aligned.
1868/// \returns A 128-bit vector of [4 x float] containing the loaded values.
1869static __inline__ __m128 __DEFAULT_FN_ATTRS
1870_mm_loadu_ps(const float *__p)
1871{
1872 struct __loadu_ps {
1873 __m128_u __v;
1874 } __attribute__((__packed__, __may_alias__));
1875 return ((const struct __loadu_ps*)__p)->__v;
1876}
1877
1878/// Loads four packed float values, in reverse order, from an aligned
1879/// memory location to 32-bit elements in a 128-bit vector of [4 x float].
1880///
1881/// \headerfile <x86intrin.h>
1882///
1883/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c>
1884/// instruction.
1885///
1886/// \param __p
1887/// A pointer to a 128-bit memory location. The address of the memory
1888/// location has to be 128-bit aligned.
1889/// \returns A 128-bit vector of [4 x float] containing the moved values, loaded
1890/// in reverse order.
1891static __inline__ __m128 __DEFAULT_FN_ATTRS
1892_mm_loadr_ps(const float *__p)
1893{
1894 __m128 __a = _mm_load_ps(__p);
1895 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0);
1896}
1897
1898/// Create a 128-bit vector of [4 x float] with undefined values.
1899///
1900/// \headerfile <x86intrin.h>
1901///
1902/// This intrinsic has no corresponding instruction.
1903///
1904/// \returns A 128-bit vector of [4 x float] containing undefined values.
1905static __inline__ __m128 __DEFAULT_FN_ATTRS
1907{
1908 return (__m128)__builtin_ia32_undef128();
1909}
1910
1911/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
1912/// 32 bits of the vector are initialized with the specified single-precision
1913/// floating-point value. The upper 96 bits are set to zero.
1914///
1915/// \headerfile <x86intrin.h>
1916///
1917/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
1918///
1919/// \param __w
1920/// A single-precision floating-point value used to initialize the lower 32
1921/// bits of the result.
1922/// \returns An initialized 128-bit floating-point vector of [4 x float]. The
1923/// lower 32 bits contain the value provided in the source operand. The
1924/// upper 96 bits are set to zero.
1925static __inline__ __m128 __DEFAULT_FN_ATTRS
1926_mm_set_ss(float __w)
1927{
1928 return __extension__ (__m128){ __w, 0, 0, 0 };
1929}
1930
1931/// Constructs a 128-bit floating-point vector of [4 x float], with each
1932/// of the four single-precision floating-point vector elements set to the
1933/// specified single-precision floating-point value.
1934///
1935/// \headerfile <x86intrin.h>
1936///
1937/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction.
1938///
1939/// \param __w
1940/// A single-precision floating-point value used to initialize each vector
1941/// element of the result.
1942/// \returns An initialized 128-bit floating-point vector of [4 x float].
1943static __inline__ __m128 __DEFAULT_FN_ATTRS
1944_mm_set1_ps(float __w)
1945{
1946 return __extension__ (__m128){ __w, __w, __w, __w };
1947}
1948
1949/* Microsoft specific. */
1950/// Constructs a 128-bit floating-point vector of [4 x float], with each
1951/// of the four single-precision floating-point vector elements set to the
1952/// specified single-precision floating-point value.
1953///
1954/// \headerfile <x86intrin.h>
1955///
1956/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction.
1957///
1958/// \param __w
1959/// A single-precision floating-point value used to initialize each vector
1960/// element of the result.
1961/// \returns An initialized 128-bit floating-point vector of [4 x float].
1962static __inline__ __m128 __DEFAULT_FN_ATTRS
1963_mm_set_ps1(float __w)
1964{
1965 return _mm_set1_ps(__w);
1966}
1967
1968/// Constructs a 128-bit floating-point vector of [4 x float]
1969/// initialized with the specified single-precision floating-point values.
1970///
1971/// \headerfile <x86intrin.h>
1972///
1973/// This intrinsic is a utility function and does not correspond to a specific
1974/// instruction.
1975///
1976/// \param __z
1977/// A single-precision floating-point value used to initialize bits [127:96]
1978/// of the result.
1979/// \param __y
1980/// A single-precision floating-point value used to initialize bits [95:64]
1981/// of the result.
1982/// \param __x
1983/// A single-precision floating-point value used to initialize bits [63:32]
1984/// of the result.
1985/// \param __w
1986/// A single-precision floating-point value used to initialize bits [31:0]
1987/// of the result.
1988/// \returns An initialized 128-bit floating-point vector of [4 x float].
1989static __inline__ __m128 __DEFAULT_FN_ATTRS
1990_mm_set_ps(float __z, float __y, float __x, float __w)
1991{
1992 return __extension__ (__m128){ __w, __x, __y, __z };
1993}
1994
1995/// Constructs a 128-bit floating-point vector of [4 x float],
1996/// initialized in reverse order with the specified 32-bit single-precision
1997/// float-point values.
1998///
1999/// \headerfile <x86intrin.h>
2000///
2001/// This intrinsic is a utility function and does not correspond to a specific
2002/// instruction.
2003///
2004/// \param __z
2005/// A single-precision floating-point value used to initialize bits [31:0]
2006/// of the result.
2007/// \param __y
2008/// A single-precision floating-point value used to initialize bits [63:32]
2009/// of the result.
2010/// \param __x
2011/// A single-precision floating-point value used to initialize bits [95:64]
2012/// of the result.
2013/// \param __w
2014/// A single-precision floating-point value used to initialize bits [127:96]
2015/// of the result.
2016/// \returns An initialized 128-bit floating-point vector of [4 x float].
2017static __inline__ __m128 __DEFAULT_FN_ATTRS
2018_mm_setr_ps(float __z, float __y, float __x, float __w)
2019{
2020 return __extension__ (__m128){ __z, __y, __x, __w };
2021}
2022
2023/// Constructs a 128-bit floating-point vector of [4 x float] initialized
2024/// to zero.
2025///
2026/// \headerfile <x86intrin.h>
2027///
2028/// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
2029///
2030/// \returns An initialized 128-bit floating-point vector of [4 x float] with
2031/// all elements set to zero.
2032static __inline__ __m128 __DEFAULT_FN_ATTRS
2034{
2035 return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f };
2036}
2037
2038/// Stores the upper 64 bits of a 128-bit vector of [4 x float] to a
2039/// memory location.
2040///
2041/// \headerfile <x86intrin.h>
2042///
2043/// This intrinsic corresponds to the <c> VPEXTRQ / PEXTRQ </c> instruction.
2044///
2045/// \param __p
2046/// A pointer to a 64-bit memory location.
2047/// \param __a
2048/// A 128-bit vector of [4 x float] containing the values to be stored.
2049static __inline__ void __DEFAULT_FN_ATTRS
2050_mm_storeh_pi(__m64 *__p, __m128 __a)
2051{
2052 typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8)));
2053 struct __mm_storeh_pi_struct {
2054 __mm_storeh_pi_v2f32 __u;
2055 } __attribute__((__packed__, __may_alias__));
2056 ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 2, 3);
2057}
2058
2059/// Stores the lower 64 bits of a 128-bit vector of [4 x float] to a
2060/// memory location.
2061///
2062/// \headerfile <x86intrin.h>
2063///
2064/// This intrinsic corresponds to the <c> VMOVLPS / MOVLPS </c> instruction.
2065///
2066/// \param __p
2067/// A pointer to a memory location that will receive the float values.
2068/// \param __a
2069/// A 128-bit vector of [4 x float] containing the values to be stored.
2070static __inline__ void __DEFAULT_FN_ATTRS
2071_mm_storel_pi(__m64 *__p, __m128 __a)
2072{
2073 typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8)));
2074 struct __mm_storeh_pi_struct {
2075 __mm_storeh_pi_v2f32 __u;
2076 } __attribute__((__packed__, __may_alias__));
2077 ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 0, 1);
2078}
2079
2080/// Stores the lower 32 bits of a 128-bit vector of [4 x float] to a
2081/// memory location.
2082///
2083/// \headerfile <x86intrin.h>
2084///
2085/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
2086///
2087/// \param __p
2088/// A pointer to a 32-bit memory location.
2089/// \param __a
2090/// A 128-bit vector of [4 x float] containing the value to be stored.
2091static __inline__ void __DEFAULT_FN_ATTRS
2092_mm_store_ss(float *__p, __m128 __a)
2093{
2094 struct __mm_store_ss_struct {
2095 float __u;
2096 } __attribute__((__packed__, __may_alias__));
2097 ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
2098}
2099
2100/// Stores a 128-bit vector of [4 x float] to an unaligned memory
2101/// location.
2102///
2103/// \headerfile <x86intrin.h>
2104///
2105/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
2106///
2107/// \param __p
2108/// A pointer to a 128-bit memory location. The address of the memory
2109/// location does not have to be aligned.
2110/// \param __a
2111/// A 128-bit vector of [4 x float] containing the values to be stored.
2112static __inline__ void __DEFAULT_FN_ATTRS
2113_mm_storeu_ps(float *__p, __m128 __a)
2114{
2115 struct __storeu_ps {
2116 __m128_u __v;
2117 } __attribute__((__packed__, __may_alias__));
2118 ((struct __storeu_ps*)__p)->__v = __a;
2119}
2120
2121/// Stores a 128-bit vector of [4 x float] into an aligned memory
2122/// location.
2123///
2124/// \headerfile <x86intrin.h>
2125///
2126/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
2127///
2128/// \param __p
2129/// A pointer to a 128-bit memory location. The address of the memory
2130/// location has to be 16-byte aligned.
2131/// \param __a
2132/// A 128-bit vector of [4 x float] containing the values to be stored.
2133static __inline__ void __DEFAULT_FN_ATTRS
2134_mm_store_ps(float *__p, __m128 __a)
2135{
2136 *(__m128*)__p = __a;
2137}
2138
2139/// Stores the lower 32 bits of a 128-bit vector of [4 x float] into
2140/// four contiguous elements in an aligned memory location.
2141///
2142/// \headerfile <x86intrin.h>
2143///
2144/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c>
2145/// instruction.
2146///
2147/// \param __p
2148/// A pointer to a 128-bit memory location.
2149/// \param __a
2150/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
2151/// of the four contiguous elements pointed by \a __p.
2152static __inline__ void __DEFAULT_FN_ATTRS
2153_mm_store1_ps(float *__p, __m128 __a)
2154{
2155 __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0);
2157}
2158
2159/// Stores the lower 32 bits of a 128-bit vector of [4 x float] into
2160/// four contiguous elements in an aligned memory location.
2161///
2162/// \headerfile <x86intrin.h>
2163///
2164/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c>
2165/// instruction.
2166///
2167/// \param __p
2168/// A pointer to a 128-bit memory location.
2169/// \param __a
2170/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
2171/// of the four contiguous elements pointed by \a __p.
2172static __inline__ void __DEFAULT_FN_ATTRS
2173_mm_store_ps1(float *__p, __m128 __a)
2174{
2176}
2177
2178/// Stores float values from a 128-bit vector of [4 x float] to an
2179/// aligned memory location in reverse order.
2180///
2181/// \headerfile <x86intrin.h>
2182///
2183/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c>
2184/// instruction.
2185///
2186/// \param __p
2187/// A pointer to a 128-bit memory location. The address of the memory
2188/// location has to be 128-bit aligned.
2189/// \param __a
2190/// A 128-bit vector of [4 x float] containing the values to be stored.
2191static __inline__ void __DEFAULT_FN_ATTRS
2192_mm_storer_ps(float *__p, __m128 __a)
2193{
2194 __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0);
2196}
2197
2198#define _MM_HINT_ET0 7
2199#define _MM_HINT_ET1 6
2200#define _MM_HINT_T0 3
2201#define _MM_HINT_T1 2
2202#define _MM_HINT_T2 1
2203#define _MM_HINT_NTA 0
2204
2205#ifndef _MSC_VER
2206/* FIXME: We have to #define this because "sel" must be a constant integer, and
2207 Sema doesn't do any form of constant propagation yet. */
2208
2209/// Loads one cache line of data from the specified address to a location
2210/// closer to the processor.
2211///
2212/// \headerfile <x86intrin.h>
2213///
2214/// \code
2215/// void _mm_prefetch(const void *a, const int sel);
2216/// \endcode
2217///
2218/// This intrinsic corresponds to the <c> PREFETCHNTA </c> instruction.
2219///
2220/// \param a
2221/// A pointer to a memory location containing a cache line of data.
2222/// \param sel
2223/// A predefined integer constant specifying the type of prefetch
2224/// operation: \n
2225/// _MM_HINT_NTA: Move data using the non-temporal access (NTA) hint. The
2226/// PREFETCHNTA instruction will be generated. \n
2227/// _MM_HINT_T0: Move data using the T0 hint. The PREFETCHT0 instruction will
2228/// be generated. \n
2229/// _MM_HINT_T1: Move data using the T1 hint. The PREFETCHT1 instruction will
2230/// be generated. \n
2231/// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will
2232/// be generated.
2233#define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \
2234 ((sel) >> 2) & 1, (sel) & 0x3))
2235#endif
2236
2237/// Stores a 64-bit integer in the specified aligned memory location. To
2238/// minimize caching, the data is flagged as non-temporal (unlikely to be
2239/// used again soon).
2240///
2241/// \headerfile <x86intrin.h>
2242///
2243/// This intrinsic corresponds to the <c> MOVNTQ </c> instruction.
2244///
2245/// \param __p
2246/// A pointer to an aligned memory location used to store the register value.
2247/// \param __a
2248/// A 64-bit integer containing the value to be stored.
2249static __inline__ void __DEFAULT_FN_ATTRS
2250_mm_stream_pi(void *__p, __m64 __a)
2251{
2252 __builtin_nontemporal_store(__a, (__m64 *)__p);
2253}
2254
2255/// Moves packed float values from a 128-bit vector of [4 x float] to a
2256/// 128-bit aligned memory location. To minimize caching, the data is flagged
2257/// as non-temporal (unlikely to be used again soon).
2258///
2259/// \headerfile <x86intrin.h>
2260///
2261/// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
2262///
2263/// \param __p
2264/// A pointer to a 128-bit aligned memory location that will receive the
2265/// single-precision floating-point values.
2266/// \param __a
2267/// A 128-bit vector of [4 x float] containing the values to be moved.
2268static __inline__ void __DEFAULT_FN_ATTRS
2269_mm_stream_ps(void *__p, __m128 __a)
2270{
2271 __builtin_nontemporal_store((__v4sf)__a, (__v4sf*)__p);
2272}
2273
2274#if defined(__cplusplus)
2275extern "C" {
2276#endif
2277
2278/// Forces strong memory ordering (serialization) between store
2279/// instructions preceding this instruction and store instructions following
2280/// this instruction, ensuring the system completes all previous stores
2281/// before executing subsequent stores.
2282///
2283/// \headerfile <x86intrin.h>
2284///
2285/// This intrinsic corresponds to the <c> SFENCE </c> instruction.
2286///
2287void _mm_sfence(void);
2288
2289#if defined(__cplusplus)
2290} // extern "C"
2291#endif
2292
2293/// Extracts 16-bit element from a 64-bit vector of [4 x i16] and
2294/// returns it, as specified by the immediate integer operand.
2295///
2296/// \headerfile <x86intrin.h>
2297///
2298/// \code
2299/// int _mm_extract_pi16(__m64 a, int n);
2300/// \endcode
2301///
2302/// This intrinsic corresponds to the <c> VPEXTRW / PEXTRW </c> instruction.
2303///
2304/// \param a
2305/// A 64-bit vector of [4 x i16].
2306/// \param n
2307/// An immediate integer operand that determines which bits are extracted: \n
2308/// 0: Bits [15:0] are copied to the destination. \n
2309/// 1: Bits [31:16] are copied to the destination. \n
2310/// 2: Bits [47:32] are copied to the destination. \n
2311/// 3: Bits [63:48] are copied to the destination.
2312/// \returns A 16-bit integer containing the extracted 16 bits of packed data.
2313#define _mm_extract_pi16(a, n) \
2314 ((int)(unsigned short)__builtin_ia32_vec_ext_v4hi((__v4hi)a, (int)n))
2315
2316/// Copies data from the 64-bit vector of [4 x i16] to the destination,
2317/// and inserts the lower 16-bits of an integer operand at the 16-bit offset
2318/// specified by the immediate operand \a n.
2319///
2320/// \headerfile <x86intrin.h>
2321///
2322/// \code
2323/// __m64 _mm_insert_pi16(__m64 a, int d, int n);
2324/// \endcode
2325///
2326/// This intrinsic corresponds to the <c> PINSRW </c> instruction.
2327///
2328/// \param a
2329/// A 64-bit vector of [4 x i16].
2330/// \param d
2331/// An integer. The lower 16-bit value from this operand is written to the
2332/// destination at the offset specified by operand \a n.
2333/// \param n
2334/// An immediate integer operant that determines which the bits to be used
2335/// in the destination. \n
2336/// 0: Bits [15:0] are copied to the destination. \n
2337/// 1: Bits [31:16] are copied to the destination. \n
2338/// 2: Bits [47:32] are copied to the destination. \n
2339/// 3: Bits [63:48] are copied to the destination. \n
2340/// The remaining bits in the destination are copied from the corresponding
2341/// bits in operand \a a.
2342/// \returns A 64-bit integer vector containing the copied packed data from the
2343/// operands.
2344#define _mm_insert_pi16(a, d, n) \
2345 ((__m64)__builtin_ia32_vec_set_v4hi((__v4hi)a, (int)d, (int)n))
2346
2347/// Compares each of the corresponding packed 16-bit integer values of
2348/// the 64-bit integer vectors, and writes the greater value to the
2349/// corresponding bits in the destination.
2350///
2351/// \headerfile <x86intrin.h>
2352///
2353/// This intrinsic corresponds to the <c> PMAXSW </c> instruction.
2354///
2355/// \param __a
2356/// A 64-bit integer vector containing one of the source operands.
2357/// \param __b
2358/// A 64-bit integer vector containing one of the source operands.
2359/// \returns A 64-bit integer vector containing the comparison results.
2360static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2361_mm_max_pi16(__m64 __a, __m64 __b)
2362{
2363 return (__m64)__builtin_elementwise_max((__v4hi)__a, (__v4hi)__b);
2364}
2365
2366/// Compares each of the corresponding packed 8-bit unsigned integer
2367/// values of the 64-bit integer vectors, and writes the greater value to the
2368/// corresponding bits in the destination.
2369///
2370/// \headerfile <x86intrin.h>
2371///
2372/// This intrinsic corresponds to the <c> PMAXUB </c> instruction.
2373///
2374/// \param __a
2375/// A 64-bit integer vector containing one of the source operands.
2376/// \param __b
2377/// A 64-bit integer vector containing one of the source operands.
2378/// \returns A 64-bit integer vector containing the comparison results.
2379static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2380_mm_max_pu8(__m64 __a, __m64 __b)
2381{
2382 return (__m64)__builtin_elementwise_max((__v8qu)__a, (__v8qu)__b);
2383}
2384
2385/// Compares each of the corresponding packed 16-bit integer values of
2386/// the 64-bit integer vectors, and writes the lesser value to the
2387/// corresponding bits in the destination.
2388///
2389/// \headerfile <x86intrin.h>
2390///
2391/// This intrinsic corresponds to the <c> PMINSW </c> instruction.
2392///
2393/// \param __a
2394/// A 64-bit integer vector containing one of the source operands.
2395/// \param __b
2396/// A 64-bit integer vector containing one of the source operands.
2397/// \returns A 64-bit integer vector containing the comparison results.
2398static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2399_mm_min_pi16(__m64 __a, __m64 __b)
2400{
2401 return (__m64)__builtin_elementwise_min((__v4hi)__a, (__v4hi)__b);
2402}
2403
2404/// Compares each of the corresponding packed 8-bit unsigned integer
2405/// values of the 64-bit integer vectors, and writes the lesser value to the
2406/// corresponding bits in the destination.
2407///
2408/// \headerfile <x86intrin.h>
2409///
2410/// This intrinsic corresponds to the <c> PMINUB </c> instruction.
2411///
2412/// \param __a
2413/// A 64-bit integer vector containing one of the source operands.
2414/// \param __b
2415/// A 64-bit integer vector containing one of the source operands.
2416/// \returns A 64-bit integer vector containing the comparison results.
2417static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2418_mm_min_pu8(__m64 __a, __m64 __b)
2419{
2420 return (__m64)__builtin_elementwise_min((__v8qu)__a, (__v8qu)__b);
2421}
2422
2423/// Takes the most significant bit from each 8-bit element in a 64-bit
2424/// integer vector to create an 8-bit mask value. Zero-extends the value to
2425/// 32-bit integer and writes it to the destination.
2426///
2427/// \headerfile <x86intrin.h>
2428///
2429/// This intrinsic corresponds to the <c> PMOVMSKB </c> instruction.
2430///
2431/// \param __a
2432/// A 64-bit integer vector containing the values with bits to be extracted.
2433/// \returns The most significant bit from each 8-bit element in \a __a,
2434/// written to bits [7:0].
2435static __inline__ int __DEFAULT_FN_ATTRS_SSE2
2437{
2438 return __builtin_ia32_pmovmskb128((__v16qi)__zext128(__a));
2439}
2440
2441/// Multiplies packed 16-bit unsigned integer values and writes the
2442/// high-order 16 bits of each 32-bit product to the corresponding bits in
2443/// the destination.
2444///
2445/// \headerfile <x86intrin.h>
2446///
2447/// This intrinsic corresponds to the <c> PMULHUW </c> instruction.
2448///
2449/// \param __a
2450/// A 64-bit integer vector containing one of the source operands.
2451/// \param __b
2452/// A 64-bit integer vector containing one of the source operands.
2453/// \returns A 64-bit integer vector containing the products of both operands.
2454static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2456{
2457 return __trunc64(__builtin_ia32_pmulhuw128((__v8hi)__anyext128(__a),
2458 (__v8hi)__anyext128(__b)));
2459}
2460
2461/// Shuffles the 4 16-bit integers from a 64-bit integer vector to the
2462/// destination, as specified by the immediate value operand.
2463///
2464/// \headerfile <x86intrin.h>
2465///
2466/// \code
2467/// __m64 _mm_shuffle_pi16(__m64 a, const int n);
2468/// \endcode
2469///
2470/// This intrinsic corresponds to the <c> PSHUFW </c> instruction.
2471///
2472/// \param a
2473/// A 64-bit integer vector containing the values to be shuffled.
2474/// \param n
2475/// An immediate value containing an 8-bit value specifying which elements to
2476/// copy from \a a. The destinations within the 64-bit destination are
2477/// assigned values as follows: \n
2478/// Bits [1:0] are used to assign values to bits [15:0] in the
2479/// destination. \n
2480/// Bits [3:2] are used to assign values to bits [31:16] in the
2481/// destination. \n
2482/// Bits [5:4] are used to assign values to bits [47:32] in the
2483/// destination. \n
2484/// Bits [7:6] are used to assign values to bits [63:48] in the
2485/// destination. \n
2486/// Bit value assignments: \n
2487/// 00: assigned from bits [15:0] of \a a. \n
2488/// 01: assigned from bits [31:16] of \a a. \n
2489/// 10: assigned from bits [47:32] of \a a. \n
2490/// 11: assigned from bits [63:48] of \a a. \n
2491/// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
2492/// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
2493/// <c>[b6, b4, b2, b0]</c>.
2494/// \returns A 64-bit integer vector containing the shuffled values.
2495#define _mm_shuffle_pi16(a, n) \
2496 ((__m64)__builtin_shufflevector((__v4hi)(__m64)(a), __extension__(__v4hi){}, \
2497 (n) & 0x3, ((n) >> 2) & 0x3, \
2498 ((n) >> 4) & 0x3, ((n) >> 6) & 0x3))
2499
2500/// Conditionally copies the values from each 8-bit element in the first
2501/// 64-bit integer vector operand to the specified memory location, as
2502/// specified by the most significant bit in the corresponding element in the
2503/// second 64-bit integer vector operand.
2504///
2505/// To minimize caching, the data is flagged as non-temporal
2506/// (unlikely to be used again soon).
2507///
2508/// \headerfile <x86intrin.h>
2509///
2510/// This intrinsic corresponds to the <c> MASKMOVQ </c> instruction.
2511///
2512/// \param __d
2513/// A 64-bit integer vector containing the values with elements to be copied.
2514/// \param __n
2515/// A 64-bit integer vector operand. The most significant bit from each 8-bit
2516/// element determines whether the corresponding element in operand \a __d
2517/// is copied. If the most significant bit of a given element is 1, the
2518/// corresponding element in operand \a __d is copied.
2519/// \param __p
2520/// A pointer to a 64-bit memory location that will receive the conditionally
2521/// copied integer values. The address of the memory location does not have
2522/// to be aligned.
2523static __inline__ void __DEFAULT_FN_ATTRS_SSE2
2524_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
2525{
2526 // This is complex, because we need to support the case where __p is pointing
2527 // within the last 15 to 8 bytes of a page. In that case, using a 128-bit
2528 // write might cause a trap where a 64-bit maskmovq would not. (Memory
2529 // locations not selected by the mask bits might still cause traps.)
2530 __m128i __d128 = __anyext128(__d);
2531 __m128i __n128 = __zext128(__n);
2532 if (((__SIZE_TYPE__)__p & 0xfff) >= 4096-15 &&
2533 ((__SIZE_TYPE__)__p & 0xfff) <= 4096-8) {
2534 // If there's a risk of spurious trap due to a 128-bit write, back up the
2535 // pointer by 8 bytes and shift values in registers to match.
2536 __p -= 8;
2537 __d128 = __builtin_ia32_pslldqi128_byteshift((__v2di)__d128, 8);
2538 __n128 = __builtin_ia32_pslldqi128_byteshift((__v2di)__n128, 8);
2539 }
2540
2541 __builtin_ia32_maskmovdqu((__v16qi)__d128, (__v16qi)__n128, __p);
2542}
2543
2544/// Computes the rounded averages of the packed unsigned 8-bit integer
2545/// values and writes the averages to the corresponding bits in the
2546/// destination.
2547///
2548/// \headerfile <x86intrin.h>
2549///
2550/// This intrinsic corresponds to the <c> PAVGB </c> instruction.
2551///
2552/// \param __a
2553/// A 64-bit integer vector containing one of the source operands.
2554/// \param __b
2555/// A 64-bit integer vector containing one of the source operands.
2556/// \returns A 64-bit integer vector containing the averages of both operands.
2557static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2558_mm_avg_pu8(__m64 __a, __m64 __b)
2559{
2560 return __trunc64(__builtin_ia32_pavgb128((__v16qi)__anyext128(__a),
2561 (__v16qi)__anyext128(__b)));
2562}
2563
2564/// Computes the rounded averages of the packed unsigned 16-bit integer
2565/// values and writes the averages to the corresponding bits in the
2566/// destination.
2567///
2568/// \headerfile <x86intrin.h>
2569///
2570/// This intrinsic corresponds to the <c> PAVGW </c> instruction.
2571///
2572/// \param __a
2573/// A 64-bit integer vector containing one of the source operands.
2574/// \param __b
2575/// A 64-bit integer vector containing one of the source operands.
2576/// \returns A 64-bit integer vector containing the averages of both operands.
2577static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2578_mm_avg_pu16(__m64 __a, __m64 __b)
2579{
2580 return __trunc64(__builtin_ia32_pavgw128((__v8hi)__anyext128(__a),
2581 (__v8hi)__anyext128(__b)));
2582}
2583
2584/// Subtracts the corresponding 8-bit unsigned integer values of the two
2585/// 64-bit vector operands and computes the absolute value for each of the
2586/// difference. Then sum of the 8 absolute differences is written to the
2587/// bits [15:0] of the destination; the remaining bits [63:16] are cleared.
2588///
2589/// \headerfile <x86intrin.h>
2590///
2591/// This intrinsic corresponds to the <c> PSADBW </c> instruction.
2592///
2593/// \param __a
2594/// A 64-bit integer vector containing one of the source operands.
2595/// \param __b
2596/// A 64-bit integer vector containing one of the source operands.
2597/// \returns A 64-bit integer vector whose lower 16 bits contain the sums of the
2598/// sets of absolute differences between both operands. The upper bits are
2599/// cleared.
2600static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2601_mm_sad_pu8(__m64 __a, __m64 __b)
2602{
2603 return __trunc64(__builtin_ia32_psadbw128((__v16qi)__zext128(__a),
2604 (__v16qi)__zext128(__b)));
2605}
2606
2607#if defined(__cplusplus)
2608extern "C" {
2609#endif
2610
2611/// Returns the contents of the MXCSR register as a 32-bit unsigned
2612/// integer value.
2613///
2614/// There are several groups of macros associated with this
2615/// intrinsic, including:
2616/// <ul>
2617/// <li>
2618/// For checking exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO,
2619/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW,
2620/// _MM_EXCEPT_INEXACT. There is a convenience wrapper
2621/// _MM_GET_EXCEPTION_STATE().
2622/// </li>
2623/// <li>
2624/// For checking exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW,
2625/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT.
2626/// There is a convenience wrapper _MM_GET_EXCEPTION_MASK().
2627/// </li>
2628/// <li>
2629/// For checking rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN,
2630/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper
2631/// _MM_GET_ROUNDING_MODE().
2632/// </li>
2633/// <li>
2634/// For checking flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF.
2635/// There is a convenience wrapper _MM_GET_FLUSH_ZERO_MODE().
2636/// </li>
2637/// <li>
2638/// For checking denormals-are-zero mode: _MM_DENORMALS_ZERO_ON,
2639/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper
2640/// _MM_GET_DENORMALS_ZERO_MODE().
2641/// </li>
2642/// </ul>
2643///
2644/// For example, the following expression checks if an overflow exception has
2645/// occurred:
2646/// \code
2647/// ( _mm_getcsr() & _MM_EXCEPT_OVERFLOW )
2648/// \endcode
2649///
2650/// The following expression gets the current rounding mode:
2651/// \code
2652/// _MM_GET_ROUNDING_MODE()
2653/// \endcode
2654///
2655/// \headerfile <x86intrin.h>
2656///
2657/// This intrinsic corresponds to the <c> VSTMXCSR / STMXCSR </c> instruction.
2658///
2659/// \returns A 32-bit unsigned integer containing the contents of the MXCSR
2660/// register.
2661unsigned int _mm_getcsr(void);
2662
2663/// Sets the MXCSR register with the 32-bit unsigned integer value.
2664///
2665/// There are several groups of macros associated with this intrinsic,
2666/// including:
2667/// <ul>
2668/// <li>
2669/// For setting exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO,
2670/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW,
2671/// _MM_EXCEPT_INEXACT. There is a convenience wrapper
2672/// _MM_SET_EXCEPTION_STATE(x) where x is one of these macros.
2673/// </li>
2674/// <li>
2675/// For setting exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW,
2676/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT.
2677/// There is a convenience wrapper _MM_SET_EXCEPTION_MASK(x) where x is one
2678/// of these macros.
2679/// </li>
2680/// <li>
2681/// For setting rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN,
2682/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper
2683/// _MM_SET_ROUNDING_MODE(x) where x is one of these macros.
2684/// </li>
2685/// <li>
2686/// For setting flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF.
2687/// There is a convenience wrapper _MM_SET_FLUSH_ZERO_MODE(x) where x is
2688/// one of these macros.
2689/// </li>
2690/// <li>
2691/// For setting denormals-are-zero mode: _MM_DENORMALS_ZERO_ON,
2692/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper
2693/// _MM_SET_DENORMALS_ZERO_MODE(x) where x is one of these macros.
2694/// </li>
2695/// </ul>
2696///
2697/// For example, the following expression causes subsequent floating-point
2698/// operations to round up:
2699/// _mm_setcsr(_mm_getcsr() | _MM_ROUND_UP)
2700///
2701/// The following example sets the DAZ and FTZ flags:
2702/// \code
2703/// void setFlags() {
2704/// _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
2705/// _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
2706/// }
2707/// \endcode
2708///
2709/// \headerfile <x86intrin.h>
2710///
2711/// This intrinsic corresponds to the <c> VLDMXCSR / LDMXCSR </c> instruction.
2712///
2713/// \param __i
2714/// A 32-bit unsigned integer value to be written to the MXCSR register.
2715void _mm_setcsr(unsigned int __i);
2716
2717#if defined(__cplusplus)
2718} // extern "C"
2719#endif
2720
2721/// Selects 4 float values from the 128-bit operands of [4 x float], as
2722/// specified by the immediate value operand.
2723///
2724/// \headerfile <x86intrin.h>
2725///
2726/// \code
2727/// __m128 _mm_shuffle_ps(__m128 a, __m128 b, const int mask);
2728/// \endcode
2729///
2730/// This intrinsic corresponds to the <c> VSHUFPS / SHUFPS </c> instruction.
2731///
2732/// \param a
2733/// A 128-bit vector of [4 x float].
2734/// \param b
2735/// A 128-bit vector of [4 x float].
2736/// \param mask
2737/// An immediate value containing an 8-bit value specifying which elements to
2738/// copy from \a a and \a b. \n
2739/// Bits [3:0] specify the values copied from operand \a a. \n
2740/// Bits [7:4] specify the values copied from operand \a b. \n
2741/// The destinations within the 128-bit destination are assigned values as
2742/// follows: \n
2743/// Bits [1:0] are used to assign values to bits [31:0] in the
2744/// destination. \n
2745/// Bits [3:2] are used to assign values to bits [63:32] in the
2746/// destination. \n
2747/// Bits [5:4] are used to assign values to bits [95:64] in the
2748/// destination. \n
2749/// Bits [7:6] are used to assign values to bits [127:96] in the
2750/// destination. \n
2751/// Bit value assignments: \n
2752/// 00: Bits [31:0] copied from the specified operand. \n
2753/// 01: Bits [63:32] copied from the specified operand. \n
2754/// 10: Bits [95:64] copied from the specified operand. \n
2755/// 11: Bits [127:96] copied from the specified operand. \n
2756/// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
2757/// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
2758/// <c>[b6, b4, b2, b0]</c>.
2759/// \returns A 128-bit vector of [4 x float] containing the shuffled values.
2760#define _mm_shuffle_ps(a, b, mask) \
2761 ((__m128)__builtin_ia32_shufps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), \
2762 (int)(mask)))
2763
2764/// Unpacks the high-order (index 2,3) values from two 128-bit vectors of
2765/// [4 x float] and interleaves them into a 128-bit vector of [4 x float].
2766///
2767/// \headerfile <x86intrin.h>
2768///
2769/// This intrinsic corresponds to the <c> VUNPCKHPS / UNPCKHPS </c> instruction.
2770///
2771/// \param __a
2772/// A 128-bit vector of [4 x float]. \n
2773/// Bits [95:64] are written to bits [31:0] of the destination. \n
2774/// Bits [127:96] are written to bits [95:64] of the destination.
2775/// \param __b
2776/// A 128-bit vector of [4 x float].
2777/// Bits [95:64] are written to bits [63:32] of the destination. \n
2778/// Bits [127:96] are written to bits [127:96] of the destination.
2779/// \returns A 128-bit vector of [4 x float] containing the interleaved values.
2780static __inline__ __m128 __DEFAULT_FN_ATTRS
2781_mm_unpackhi_ps(__m128 __a, __m128 __b)
2782{
2783 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 2, 6, 3, 7);
2784}
2785
2786/// Unpacks the low-order (index 0,1) values from two 128-bit vectors of
2787/// [4 x float] and interleaves them into a 128-bit vector of [4 x float].
2788///
2789/// \headerfile <x86intrin.h>
2790///
2791/// This intrinsic corresponds to the <c> VUNPCKLPS / UNPCKLPS </c> instruction.
2792///
2793/// \param __a
2794/// A 128-bit vector of [4 x float]. \n
2795/// Bits [31:0] are written to bits [31:0] of the destination. \n
2796/// Bits [63:32] are written to bits [95:64] of the destination.
2797/// \param __b
2798/// A 128-bit vector of [4 x float]. \n
2799/// Bits [31:0] are written to bits [63:32] of the destination. \n
2800/// Bits [63:32] are written to bits [127:96] of the destination.
2801/// \returns A 128-bit vector of [4 x float] containing the interleaved values.
2802static __inline__ __m128 __DEFAULT_FN_ATTRS
2803_mm_unpacklo_ps(__m128 __a, __m128 __b)
2804{
2805 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 4, 1, 5);
2806}
2807
2808/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2809/// 32 bits are set to the lower 32 bits of the second parameter. The upper
2810/// 96 bits are set to the upper 96 bits of the first parameter.
2811///
2812/// \headerfile <x86intrin.h>
2813///
2814/// This intrinsic corresponds to the <c> VBLENDPS / BLENDPS / MOVSS </c>
2815/// instruction.
2816///
2817/// \param __a
2818/// A 128-bit floating-point vector of [4 x float]. The upper 96 bits are
2819/// written to the upper 96 bits of the result.
2820/// \param __b
2821/// A 128-bit floating-point vector of [4 x float]. The lower 32 bits are
2822/// written to the lower 32 bits of the result.
2823/// \returns A 128-bit floating-point vector of [4 x float].
2824static __inline__ __m128 __DEFAULT_FN_ATTRS
2825_mm_move_ss(__m128 __a, __m128 __b)
2826{
2827 __a[0] = __b[0];
2828 return __a;
2829}
2830
2831/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2832/// 64 bits are set to the upper 64 bits of the second parameter. The upper
2833/// 64 bits are set to the upper 64 bits of the first parameter.
2834///
2835/// \headerfile <x86intrin.h>
2836///
2837/// This intrinsic corresponds to the <c> VUNPCKHPD / UNPCKHPD </c> instruction.
2838///
2839/// \param __a
2840/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are
2841/// written to the upper 64 bits of the result.
2842/// \param __b
2843/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are
2844/// written to the lower 64 bits of the result.
2845/// \returns A 128-bit floating-point vector of [4 x float].
2846static __inline__ __m128 __DEFAULT_FN_ATTRS
2847_mm_movehl_ps(__m128 __a, __m128 __b)
2848{
2849 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 6, 7, 2, 3);
2850}
2851
2852/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2853/// 64 bits are set to the lower 64 bits of the first parameter. The upper
2854/// 64 bits are set to the lower 64 bits of the second parameter.
2855///
2856/// \headerfile <x86intrin.h>
2857///
2858/// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
2859///
2860/// \param __a
2861/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are
2862/// written to the lower 64 bits of the result.
2863/// \param __b
2864/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are
2865/// written to the upper 64 bits of the result.
2866/// \returns A 128-bit floating-point vector of [4 x float].
2867static __inline__ __m128 __DEFAULT_FN_ATTRS
2868_mm_movelh_ps(__m128 __a, __m128 __b)
2869{
2870 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 1, 4, 5);
2871}
2872
2873/// Converts a 64-bit vector of [4 x i16] into a 128-bit vector of [4 x
2874/// float].
2875///
2876/// \headerfile <x86intrin.h>
2877///
2878/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2879///
2880/// \param __a
2881/// A 64-bit vector of [4 x i16]. The elements of the destination are copied
2882/// from the corresponding elements in this operand.
2883/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2884/// values from the operand.
2885static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2887{
2888 return __builtin_convertvector((__v4hi)__a, __v4sf);
2889}
2890
2891/// Converts a 64-bit vector of 16-bit unsigned integer values into a
2892/// 128-bit vector of [4 x float].
2893///
2894/// \headerfile <x86intrin.h>
2895///
2896/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2897///
2898/// \param __a
2899/// A 64-bit vector of 16-bit unsigned integer values. The elements of the
2900/// destination are copied from the corresponding elements in this operand.
2901/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2902/// values from the operand.
2903static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2905{
2906 return __builtin_convertvector((__v4hu)__a, __v4sf);
2907}
2908
2909/// Converts the lower four 8-bit values from a 64-bit vector of [8 x i8]
2910/// into a 128-bit vector of [4 x float].
2911///
2912/// \headerfile <x86intrin.h>
2913///
2914/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2915///
2916/// \param __a
2917/// A 64-bit vector of [8 x i8]. The elements of the destination are copied
2918/// from the corresponding lower 4 elements in this operand.
2919/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2920/// values from the operand.
2921static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2923{
2924 return __builtin_convertvector(
2925 __builtin_shufflevector((__v8qs)__a, __extension__ (__v8qs){},
2926 0, 1, 2, 3), __v4sf);
2927}
2928
2929/// Converts the lower four unsigned 8-bit integer values from a 64-bit
2930/// vector of [8 x u8] into a 128-bit vector of [4 x float].
2931///
2932/// \headerfile <x86intrin.h>
2933///
2934/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2935///
2936/// \param __a
2937/// A 64-bit vector of unsigned 8-bit integer values. The elements of the
2938/// destination are copied from the corresponding lower 4 elements in this
2939/// operand.
2940/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2941/// values from the source operand.
2942static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2944{
2945 return __builtin_convertvector(
2946 __builtin_shufflevector((__v8qu)__a, __extension__ (__v8qu){},
2947 0, 1, 2, 3), __v4sf);
2948}
2949
2950/// Converts the two 32-bit signed integer values from each 64-bit vector
2951/// operand of [2 x i32] into a 128-bit vector of [4 x float].
2952///
2953/// \headerfile <x86intrin.h>
2954///
2955/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2956///
2957/// \param __a
2958/// A 64-bit vector of [2 x i32]. The lower elements of the destination are
2959/// copied from the elements in this operand.
2960/// \param __b
2961/// A 64-bit vector of [2 x i32]. The upper elements of the destination are
2962/// copied from the elements in this operand.
2963/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
2964/// copied and converted values from the first operand. The upper 64 bits
2965/// contain the copied and converted values from the second operand.
2966static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2
2968{
2969 return __builtin_convertvector(
2970 __builtin_shufflevector((__v2si)__a, (__v2si)__b,
2971 0, 1, 2, 3), __v4sf);
2972}
2973
2974/// Converts each single-precision floating-point element of a 128-bit
2975/// floating-point vector of [4 x float] into a 16-bit signed integer, and
2976/// packs the results into a 64-bit integer vector of [4 x i16].
2977///
2978/// If the floating-point element is NaN or infinity, or if the
2979/// floating-point element is greater than 0x7FFFFFFF or less than -0x8000,
2980/// it is converted to 0x8000. Otherwise if the floating-point element is
2981/// greater than 0x7FFF, it is converted to 0x7FFF.
2982///
2983/// \headerfile <x86intrin.h>
2984///
2985/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction.
2986///
2987/// \param __a
2988/// A 128-bit floating-point vector of [4 x float].
2989/// \returns A 64-bit integer vector of [4 x i16] containing the converted
2990/// values.
2991static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2993{
2994 return __trunc64(__builtin_ia32_packssdw128(
2995 (__v4si)__builtin_ia32_cvtps2dq((__v4sf)__a), (__v4si)_mm_setzero_ps()));
2996}
2997
2998/// Converts each single-precision floating-point element of a 128-bit
2999/// floating-point vector of [4 x float] into an 8-bit signed integer, and
3000/// packs the results into the lower 32 bits of a 64-bit integer vector of
3001/// [8 x i8]. The upper 32 bits of the vector are set to 0.
3002///
3003/// If the floating-point element is NaN or infinity, or if the
3004/// floating-point element is greater than 0x7FFFFFFF or less than -0x80, it
3005/// is converted to 0x80. Otherwise if the floating-point element is greater
3006/// than 0x7F, it is converted to 0x7F.
3007///
3008/// \headerfile <x86intrin.h>
3009///
3010/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction.
3011///
3012/// \param __a
3013/// 128-bit floating-point vector of [4 x float].
3014/// \returns A 64-bit integer vector of [8 x i8]. The lower 32 bits contain the
3015/// converted values and the uppper 32 bits are set to zero.
3016static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
3018{
3019 __m64 __b, __c;
3020
3023
3024 return _mm_packs_pi16(__b, __c);
3025}
3026
3027/// Extracts the sign bits from each single-precision floating-point
3028/// element of a 128-bit floating-point vector of [4 x float] and returns the
3029/// sign bits in bits [0:3] of the result. Bits [31:4] of the result are set
3030/// to zero.
3031///
3032/// \headerfile <x86intrin.h>
3033///
3034/// This intrinsic corresponds to the <c> VMOVMSKPS / MOVMSKPS </c> instruction.
3035///
3036/// \param __a
3037/// A 128-bit floating-point vector of [4 x float].
3038/// \returns A 32-bit integer value. Bits [3:0] contain the sign bits from each
3039/// single-precision floating-point element of the parameter. Bits [31:4] are
3040/// set to zero.
3041static __inline__ int __DEFAULT_FN_ATTRS
3043{
3044 return __builtin_ia32_movmskps((__v4sf)__a);
3045}
3046
3047/* Compare */
3048#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
3049#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */
3050#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */
3051#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */
3052#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */
3053#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */
3054#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */
3055#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */
3056
3057/// Compares each of the corresponding values of two 128-bit vectors of
3058/// [4 x float], using the operation specified by the immediate integer
3059/// operand.
3060///
3061/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
3062/// If either value in a comparison is NaN, comparisons that are ordered
3063/// return false, and comparisons that are unordered return true.
3064///
3065/// \headerfile <x86intrin.h>
3066///
3067/// \code
3068/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
3069/// \endcode
3070///
3071/// This intrinsic corresponds to the <c> (V)CMPPS </c> instruction.
3072///
3073/// \param a
3074/// A 128-bit vector of [4 x float].
3075/// \param b
3076/// A 128-bit vector of [4 x float].
3077/// \param c
3078/// An immediate integer operand, with bits [4:0] specifying which comparison
3079/// operation to use: \n
3080/// 0x00: Equal (ordered, non-signaling) \n
3081/// 0x01: Less-than (ordered, signaling) \n
3082/// 0x02: Less-than-or-equal (ordered, signaling) \n
3083/// 0x03: Unordered (non-signaling) \n
3084/// 0x04: Not-equal (unordered, non-signaling) \n
3085/// 0x05: Not-less-than (unordered, signaling) \n
3086/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
3087/// 0x07: Ordered (non-signaling) \n
3088/// \returns A 128-bit vector of [4 x float] containing the comparison results.
3089#define _mm_cmp_ps(a, b, c) \
3090 ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c)))
3091
3092/// Compares each of the corresponding scalar values of two 128-bit
3093/// vectors of [4 x float], using the operation specified by the immediate
3094/// integer operand.
3095///
3096/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
3097/// If either value in a comparison is NaN, comparisons that are ordered
3098/// return false, and comparisons that are unordered return true.
3099///
3100/// \headerfile <x86intrin.h>
3101///
3102/// \code
3103/// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c);
3104/// \endcode
3105///
3106/// This intrinsic corresponds to the <c> (V)CMPSS </c> instruction.
3107///
3108/// \param a
3109/// A 128-bit vector of [4 x float].
3110/// \param b
3111/// A 128-bit vector of [4 x float].
3112/// \param c
3113/// An immediate integer operand, with bits [4:0] specifying which comparison
3114/// operation to use: \n
3115/// 0x00: Equal (ordered, non-signaling) \n
3116/// 0x01: Less-than (ordered, signaling) \n
3117/// 0x02: Less-than-or-equal (ordered, signaling) \n
3118/// 0x03: Unordered (non-signaling) \n
3119/// 0x04: Not-equal (unordered, non-signaling) \n
3120/// 0x05: Not-less-than (unordered, signaling) \n
3121/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
3122/// 0x07: Ordered (non-signaling) \n
3123/// \returns A 128-bit vector of [4 x float] containing the comparison results.
3124#define _mm_cmp_ss(a, b, c) \
3125 ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c)))
3126
3127#define _MM_ALIGN16 __attribute__((aligned(16)))
3128
3129#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
3130
3131#define _MM_EXCEPT_INVALID (0x0001U)
3132#define _MM_EXCEPT_DENORM (0x0002U)
3133#define _MM_EXCEPT_DIV_ZERO (0x0004U)
3134#define _MM_EXCEPT_OVERFLOW (0x0008U)
3135#define _MM_EXCEPT_UNDERFLOW (0x0010U)
3136#define _MM_EXCEPT_INEXACT (0x0020U)
3137#define _MM_EXCEPT_MASK (0x003fU)
3138
3139#define _MM_MASK_INVALID (0x0080U)
3140#define _MM_MASK_DENORM (0x0100U)
3141#define _MM_MASK_DIV_ZERO (0x0200U)
3142#define _MM_MASK_OVERFLOW (0x0400U)
3143#define _MM_MASK_UNDERFLOW (0x0800U)
3144#define _MM_MASK_INEXACT (0x1000U)
3145#define _MM_MASK_MASK (0x1f80U)
3146
3147#define _MM_ROUND_NEAREST (0x0000U)
3148#define _MM_ROUND_DOWN (0x2000U)
3149#define _MM_ROUND_UP (0x4000U)
3150#define _MM_ROUND_TOWARD_ZERO (0x6000U)
3151#define _MM_ROUND_MASK (0x6000U)
3152
3153#define _MM_FLUSH_ZERO_MASK (0x8000U)
3154#define _MM_FLUSH_ZERO_ON (0x8000U)
3155#define _MM_FLUSH_ZERO_OFF (0x0000U)
3156
3157#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)
3158#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)
3159#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)
3160#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)
3161
3162#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))
3163#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))
3164#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))
3165#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))
3166
3167#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
3168do { \
3169 __m128 tmp3, tmp2, tmp1, tmp0; \
3170 tmp0 = _mm_unpacklo_ps((row0), (row1)); \
3171 tmp2 = _mm_unpacklo_ps((row2), (row3)); \
3172 tmp1 = _mm_unpackhi_ps((row0), (row1)); \
3173 tmp3 = _mm_unpackhi_ps((row2), (row3)); \
3174 (row0) = _mm_movelh_ps(tmp0, tmp2); \
3175 (row1) = _mm_movehl_ps(tmp2, tmp0); \
3176 (row2) = _mm_movelh_ps(tmp1, tmp3); \
3177 (row3) = _mm_movehl_ps(tmp3, tmp1); \
3178} while (0)
3179
3180/* Aliases for compatibility. */
3181#define _m_pextrw _mm_extract_pi16
3182#define _m_pinsrw _mm_insert_pi16
3183#define _m_pmaxsw _mm_max_pi16
3184#define _m_pmaxub _mm_max_pu8
3185#define _m_pminsw _mm_min_pi16
3186#define _m_pminub _mm_min_pu8
3187#define _m_pmovmskb _mm_movemask_pi8
3188#define _m_pmulhuw _mm_mulhi_pu16
3189#define _m_pshufw _mm_shuffle_pi16
3190#define _m_maskmovq _mm_maskmove_si64
3191#define _m_pavgb _mm_avg_pu8
3192#define _m_pavgw _mm_avg_pu16
3193#define _m_psadbw _mm_sad_pu8
3194#define _m_ _mm_
3195
3196#undef __trunc64
3197#undef __zext128
3198#undef __anyext128
3199#undef __zeroupper64
3200#undef __DEFAULT_FN_ATTRS
3201#undef __DEFAULT_FN_ATTRS_SSE2
3202
3203/* Ugly hack for backwards-compatibility (compatible with gcc) */
3204#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics)
3205#include <emmintrin.h>
3206#endif
3207
3208#endif /* __XMMINTRIN_H */
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
static __inline__ vector float vector float vector float __c
Definition: altivec.h:4800
static __inline__ vector float vector float __b
Definition: altivec.h:578
static __inline__ uint32_t volatile uint32_t * __p
Definition: arm_acle.h:88
static __inline__ uint32_t uint32_t __y
Definition: arm_acle.h:130
static __inline__ void int __a
Definition: emmintrin.h:4058
struct __storeu_i16 *__P __v
Definition: immintrin.h:472
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_packs_pi16(__m64 __m1, __m64 __m2)
Converts, with saturation, 16-bit signed integers from both 64-bit integer vector parameters of [4 x ...
Definition: mmintrin.h:151
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_setzero_si64(void)
Constructs a 64-bit integer vector initialized to zero.
Definition: mmintrin.h:1330
static __inline__ int __DEFAULT_FN_ATTRS _mm_comigt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the first ope...
Definition: xmmintrin.h:1184
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvttss_si32(__m128 __a)
Converts the lower (first) element of a vector of [4 x float] into a signed truncated (rounded toward...
Definition: xmmintrin.h:1506
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rcp_ss(__m128 __a)
Calculates the approximate reciprocal of the value stored in the low-order bits of a 128-bit vector o...
Definition: xmmintrin.h:269
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_min_pu8(__m64 __a, __m64 __b)
Compares each of the corresponding packed 8-bit unsigned integer values of the 64-bit integer vectors...
Definition: xmmintrin.h:2418
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmplt_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:585
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_avg_pu16(__m64 __a, __m64 __b)
Computes the rounded averages of the packed unsigned 16-bit integer values and writes the averages to...
Definition: xmmintrin.h:2578
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sqrt_ss(__m128 __a)
Calculates the square root of the value stored in the low-order bits of a 128-bit vector of [4 x floa...
Definition: xmmintrin.h:234
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_div_ps(__m128 __a, __m128 __b)
Divides two 128-bit vectors of [4 x float].
Definition: xmmintrin.h:216
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnge_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:960
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpeq_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] for equa...
Definition: xmmintrin.h:537
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_setzero_ps(void)
Constructs a 128-bit floating-point vector of [4 x float] initialized to zero.
Definition: xmmintrin.h:2033
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set_ss(float __w)
Constructs a 128-bit floating-point vector of [4 x float].
Definition: xmmintrin.h:1926
#define __anyext128(x)
Definition: xmmintrin.h:47
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_and_ps(__m128 __a, __m128 __b)
Performs a bitwise AND of two 128-bit vectors of [4 x float].
Definition: xmmintrin.h:432
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmplt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:563
static __inline__ int __DEFAULT_FN_ATTRS_SSE2 _mm_movemask_pi8(__m64 __a)
Takes the most significant bit from each 8-bit element in a 64-bit integer vector to create an 8-bit ...
Definition: xmmintrin.h:2436
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvt_ps2pi(__m128 __a)
Converts two low-order float values in a 128-bit vector of [4 x float] into a 64-bit vector of [2 x i...
Definition: xmmintrin.h:1484
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvt_ss2si(__m128 __a)
Converts a float value contained in the lower 32 bits of a vector of [4 x float] into a 32-bit intege...
Definition: xmmintrin.h:1418
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpeq_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands for equality.
Definition: xmmintrin.h:516
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_add_ps(__m128 __a, __m128 __b)
Adds two 128-bit vectors of [4 x float], and returns the results of the addition.
Definition: xmmintrin.h:90
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_load_ps(const float *__p)
Loads a 128-bit floating-point vector of [4 x float] from an aligned memory location.
Definition: xmmintrin.h:1853
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpneq_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] for ineq...
Definition: xmmintrin.h:781
static __inline__ int __DEFAULT_FN_ATTRS _mm_comile_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the first ope...
Definition: xmmintrin.h:1160
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_andnot_ps(__m128 __a, __m128 __b)
Performs a bitwise AND of two 128-bit vectors of [4 x float], using the one's complement of the value...
Definition: xmmintrin.h:454
static __inline__ void __DEFAULT_FN_ATTRS _mm_storer_ps(float *__p, __m128 __a)
Stores float values from a 128-bit vector of [4 x float] to an aligned memory location in reverse ord...
Definition: xmmintrin.h:2192
#define __zeroupper64(x)
Definition: xmmintrin.h:50
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_undefined_ps(void)
Create a 128-bit vector of [4 x float] with undefined values.
Definition: xmmintrin.h:1906
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnle_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:858
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomilt_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1279
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmple_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:611
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sad_pu8(__m64 __a, __m64 __b)
Subtracts the corresponding 8-bit unsigned integer values of the two 64-bit vector operands and compu...
Definition: xmmintrin.h:2601
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cvt_si2ss(__m128 __a, int __b)
Converts a 32-bit signed integer value into a floating point value and writes it to the lower 32 bits...
Definition: xmmintrin.h:1640
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpu8_ps(__m64 __a)
Converts the lower four unsigned 8-bit integer values from a 64-bit vector of [8 x u8] into a 128-bit...
Definition: xmmintrin.h:2943
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rsqrt_ps(__m128 __a)
Calculates the approximate reciprocals of the square roots of the values stored in a 128-bit vector o...
Definition: xmmintrin.h:322
static __inline__ void __DEFAULT_FN_ATTRS _mm_storel_pi(__m64 *__p, __m128 __a)
Stores the lower 64 bits of a 128-bit vector of [4 x float] to a memory location.
Definition: xmmintrin.h:2071
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomile_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1303
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpge_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:733
static __inline__ int __DEFAULT_FN_ATTRS _mm_comieq_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands for equality.
Definition: xmmintrin.h:1111
static __inline__ void __DEFAULT_FN_ATTRS _mm_store1_ps(float *__p, __m128 __a)
Stores the lower 32 bits of a 128-bit vector of [4 x float] into four contiguous elements in an align...
Definition: xmmintrin.h:2153
void _mm_sfence(void)
Forces strong memory ordering (serialization) between store instructions preceding this instruction a...
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set_ps1(float __w)
Constructs a 128-bit floating-point vector of [4 x float], with each of the four single-precision flo...
Definition: xmmintrin.h:1963
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_mul_ps(__m128 __a, __m128 __b)
Multiplies two 128-bit vectors of [4 x float] and returns the results of the multiplication.
Definition: xmmintrin.h:175
#define __DEFAULT_FN_ATTRS
Definition: xmmintrin.h:35
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_max_ps(__m128 __a, __m128 __b)
Compares two 128-bit vectors of [4 x float] and returns the greater of each pair of values.
Definition: xmmintrin.h:414
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rsqrt_ss(__m128 __a)
Calculates the approximate reciprocal of the square root of the value stored in the low-order bits of...
Definition: xmmintrin.h:305
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomige_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1351
static __inline__ int __DEFAULT_FN_ATTRS _mm_comilt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the first ope...
Definition: xmmintrin.h:1136
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_loadl_pi(__m128 __a, const __m64 *__p)
Loads two packed float values from the address __p into the low-order bits of a 128-bit vector of [4 ...
Definition: xmmintrin.h:1781
static __inline__ void __DEFAULT_FN_ATTRS _mm_storeu_ps(float *__p, __m128 __a)
Stores a 128-bit vector of [4 x float] to an unaligned memory location.
Definition: xmmintrin.h:2113
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sub_ss(__m128 __a, __m128 __b)
Subtracts the 32-bit float value in the low-order bits of the second operand from the corresponding v...
Definition: xmmintrin.h:112
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sub_ps(__m128 __a, __m128 __b)
Subtracts each of the values of the second operand from the first operand, both of which are 128-bit ...
Definition: xmmintrin.h:133
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_load1_ps(const float *__p)
Loads a 32-bit float value and duplicates it to all four vector elements of a 128-bit vector of [4 x ...
Definition: xmmintrin.h:1830
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_movelh_ps(__m128 __a, __m128 __b)
Constructs a 128-bit floating-point vector of [4 x float].
Definition: xmmintrin.h:2868
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_min_ps(__m128 __a, __m128 __b)
Compares two 128-bit vectors of [4 x float] and returns the lesser of each pair of values.
Definition: xmmintrin.h:368
static __inline__ void __DEFAULT_FN_ATTRS _mm_stream_ps(void *__p, __m128 __a)
Moves packed float values from a 128-bit vector of [4 x float] to a 128-bit aligned memory location.
Definition: xmmintrin.h:2269
static __inline__ void __DEFAULT_FN_ATTRS _mm_stream_pi(void *__p, __m64 __a)
Stores a 64-bit integer in the specified aligned memory location.
Definition: xmmintrin.h:2250
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvt_pi2ps(__m128 __a, __m64 __b)
Converts two elements of a 64-bit vector of [2 x i32] into two floating point values and writes them ...
Definition: xmmintrin.h:1716
static __inline__ int __DEFAULT_FN_ATTRS _mm_comige_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the first ope...
Definition: xmmintrin.h:1208
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtss_si32(__m128 __a)
Converts a float value contained in the lower 32 bits of a vector of [4 x float] into a 32-bit intege...
Definition: xmmintrin.h:1396
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpgt_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:683
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_setr_ps(float __z, float __y, float __x, float __w)
Constructs a 128-bit floating-point vector of [4 x float], initialized in reverse order with the spec...
Definition: xmmintrin.h:2018
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomigt_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1327
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpi32x2_ps(__m64 __a, __m64 __b)
Converts the two 32-bit signed integer values from each 64-bit vector operand of [2 x i32] into a 128...
Definition: xmmintrin.h:2967
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi16(__m128 __a)
Converts each single-precision floating-point element of a 128-bit floating-point vector of [4 x floa...
Definition: xmmintrin.h:2992
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_unpackhi_ps(__m128 __a, __m128 __b)
Unpacks the high-order (index 2,3) values from two 128-bit vectors of [4 x float] and interleaves the...
Definition: xmmintrin.h:2781
static __inline__ void __DEFAULT_FN_ATTRS _mm_store_ss(float *__p, __m128 __a)
Stores the lower 32 bits of a 128-bit vector of [4 x float] to a memory location.
Definition: xmmintrin.h:2092
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpngt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:908
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_loadh_pi(__m128 __a, const __m64 *__p)
Loads two packed float values from the address __p into the high-order bits of a 128-bit vector of [4...
Definition: xmmintrin.h:1754
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_xor_ps(__m128 __a, __m128 __b)
Performs a bitwise exclusive OR of two 128-bit vectors of [4 x float].
Definition: xmmintrin.h:491
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rcp_ps(__m128 __a)
Calculates the approximate reciprocals of the values stored in a 128-bit vector of [4 x float].
Definition: xmmintrin.h:286
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_move_ss(__m128 __a, __m128 __b)
Constructs a 128-bit floating-point vector of [4 x float].
Definition: xmmintrin.h:2825
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set1_ps(float __w)
Constructs a 128-bit floating-point vector of [4 x float], with each of the four single-precision flo...
Definition: xmmintrin.h:1944
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_min_pi16(__m64 __a, __m64 __b)
Compares each of the corresponding packed 16-bit integer values of the 64-bit integer vectors,...
Definition: xmmintrin.h:2399
static __inline__ void __DEFAULT_FN_ATTRS _mm_store_ps(float *__p, __m128 __a)
Stores a 128-bit vector of [4 x float] into an aligned memory location.
Definition: xmmintrin.h:2134
void _mm_setcsr(unsigned int __i)
Sets the MXCSR register with the 32-bit unsigned integer value.
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_or_ps(__m128 __a, __m128 __b)
Performs a bitwise OR of two 128-bit vectors of [4 x float].
Definition: xmmintrin.h:472
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_sqrt_ps(__m128 __a)
Calculates the square roots of the values stored in a 128-bit vector of [4 x float].
Definition: xmmintrin.h:251
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpneq_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands for inequality.
Definition: xmmintrin.h:759
static __inline__ float __DEFAULT_FN_ATTRS _mm_cvtss_f32(__m128 __a)
Extracts a float value contained in the lower 32 bits of a vector of [4 x float].
Definition: xmmintrin.h:1733
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpi32_ps(__m128 __a, __m64 __b)
Converts two elements of a 64-bit vector of [2 x i32] into two floating point values and writes them ...
Definition: xmmintrin.h:1690
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_mul_ss(__m128 __a, __m128 __b)
Multiplies two 32-bit float values in the low-order bits of the operands.
Definition: xmmintrin.h:155
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvttps_pi32(__m128 __a)
Converts the lower (first) two elements of a 128-bit vector of [4 x float] into two signed truncated ...
Definition: xmmintrin.h:1574
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi32(__m128 __a)
Converts two low-order float values in a 128-bit vector of [4 x float] into a 64-bit vector of [2 x i...
Definition: xmmintrin.h:1464
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cvtsi32_ss(__m128 __a, int __b)
Converts a 32-bit signed integer value into a floating point value and writes it to the lower 32 bits...
Definition: xmmintrin.h:1617
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtt_ss2si(__m128 __a)
Converts the lower (first) element of a vector of [4 x float] into a signed truncated (rounded toward...
Definition: xmmintrin.h:1528
static __inline__ int __DEFAULT_FN_ATTRS _mm_movemask_ps(__m128 __a)
Extracts the sign bits from each single-precision floating-point element of a 128-bit floating-point ...
Definition: xmmintrin.h:3042
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_movehl_ps(__m128 __a, __m128 __b)
Constructs a 128-bit floating-point vector of [4 x float].
Definition: xmmintrin.h:2847
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi8(__m128 __a)
Converts each single-precision floating-point element of a 128-bit floating-point vector of [4 x floa...
Definition: xmmintrin.h:3017
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_max_pi16(__m64 __a, __m64 __b)
Compares each of the corresponding packed 16-bit integer values of the 64-bit integer vectors,...
Definition: xmmintrin.h:2361
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_loadr_ps(const float *__p)
Loads four packed float values, in reverse order, from an aligned memory location to 32-bit elements ...
Definition: xmmintrin.h:1892
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpord_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:1012
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_avg_pu8(__m64 __a, __m64 __b)
Computes the rounded averages of the packed unsigned 8-bit integer values and writes the averages to ...
Definition: xmmintrin.h:2558
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnlt_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:831
static __inline__ void __DEFAULT_FN_ATTRS _mm_storeh_pi(__m64 *__p, __m128 __a)
Stores the upper 64 bits of a 128-bit vector of [4 x float] to a memory location.
Definition: xmmintrin.h:2050
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpngt_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:933
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnge_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:985
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpord_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:1036
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpgt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:659
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpi8_ps(__m64 __a)
Converts the lower four 8-bit values from a 64-bit vector of [8 x i8] into a 128-bit vector of [4 x f...
Definition: xmmintrin.h:2922
#define __trunc64(x)
Definition: xmmintrin.h:42
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomieq_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1255
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_add_ss(__m128 __a, __m128 __b)
Adds the 32-bit float values in the low-order bits of the operands.
Definition: xmmintrin.h:70
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set_ps(float __z, float __y, float __x, float __w)
Constructs a 128-bit floating-point vector of [4 x float] initialized with the specified single-preci...
Definition: xmmintrin.h:1990
static __inline__ void __DEFAULT_FN_ATTRS_SSE2 _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
Conditionally copies the values from each 8-bit element in the first 64-bit integer vector operand to...
Definition: xmmintrin.h:2524
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnlt_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:808
static __inline__ void __DEFAULT_FN_ATTRS _mm_store_ps1(float *__p, __m128 __a)
Stores the lower 32 bits of a 128-bit vector of [4 x float] into four contiguous elements in an align...
Definition: xmmintrin.h:2173
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_min_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands and returns the lesser value ...
Definition: xmmintrin.h:347
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpu16_ps(__m64 __a)
Converts a 64-bit vector of 16-bit unsigned integer values into a 128-bit vector of [4 x float].
Definition: xmmintrin.h:2904
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_mulhi_pu16(__m64 __a, __m64 __b)
Multiplies packed 16-bit unsigned integer values and writes the high-order 16 bits of each 32-bit pro...
Definition: xmmintrin.h:2455
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmple_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:633
unsigned int _mm_getcsr(void)
Returns the contents of the MXCSR register as a 32-bit unsigned integer value.
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_unpacklo_ps(__m128 __a, __m128 __b)
Unpacks the low-order (index 0,1) values from two 128-bit vectors of [4 x float] and interleaves them...
Definition: xmmintrin.h:2803
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_max_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands and returns the greater value...
Definition: xmmintrin.h:393
static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtpi16_ps(__m64 __a)
Converts a 64-bit vector of [4 x i16] into a 128-bit vector of [4 x float].
Definition: xmmintrin.h:2886
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomineq_ss(__m128 __a, __m128 __b)
Performs an unordered comparison of two 32-bit float values using the low-order bits of both operands...
Definition: xmmintrin.h:1374
#define __zext128(x)
Definition: xmmintrin.h:44
static __inline__ int __DEFAULT_FN_ATTRS _mm_comineq_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the first ope...
Definition: xmmintrin.h:1232
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtt_ps2pi(__m128 __a)
Converts the lower (first) two elements of a 128-bit vector of [4 x float] into two signed truncated ...
Definition: xmmintrin.h:1595
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpnle_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:881
#define __DEFAULT_FN_ATTRS_SSE2
Definition: xmmintrin.h:38
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpunord_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:1063
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpge_ss(__m128 __a, __m128 __b)
Compares two 32-bit float values in the low-order bits of both operands to determine if the value in ...
Definition: xmmintrin.h:709
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_max_pu8(__m64 __a, __m64 __b)
Compares each of the corresponding packed 8-bit unsigned integer values of the 64-bit integer vectors...
Definition: xmmintrin.h:2380
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_cmpunord_ps(__m128 __a, __m128 __b)
Compares each of the corresponding 32-bit float values of the 128-bit vectors of [4 x float] to deter...
Definition: xmmintrin.h:1087
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_loadu_ps(const float *__p)
Loads a 128-bit floating-point vector of [4 x float] from an unaligned memory location.
Definition: xmmintrin.h:1870
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_load_ss(const float *__p)
Constructs a 128-bit floating-point vector of [4 x float].
Definition: xmmintrin.h:1808
static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_div_ss(__m128 __a, __m128 __b)
Divides the value in the low-order 32 bits of the first operand by the corresponding value in the sec...
Definition: xmmintrin.h:197