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