clang 23.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
1387{
1388 return __builtin_ia32_cvtss2si((__v4sf)__a);
1389}
1390
1391/// Converts a float value contained in the lower 32 bits of a vector of
1392/// [4 x float] into a 32-bit integer.
1393///
1394/// If the converted value does not fit in a 32-bit integer, raises a
1395/// floating-point invalid exception. If the exception is masked, returns
1396/// the most negative integer.
1397///
1398/// \headerfile <x86intrin.h>
1399///
1400/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c>
1401/// instructions.
1402///
1403/// \param __a
1404/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1405/// used in the conversion.
1406/// \returns A 32-bit integer containing the converted value.
1407static __inline__ int __DEFAULT_FN_ATTRS
1409{
1410 return _mm_cvtss_si32(__a);
1411}
1412
1413#ifdef __x86_64__
1414
1415/// Converts a float value contained in the lower 32 bits of a vector of
1416/// [4 x float] into a 64-bit integer.
1417///
1418/// If the converted value does not fit in a 32-bit integer, raises a
1419/// floating-point invalid exception. If the exception is masked, returns
1420/// the most negative integer.
1421///
1422/// \headerfile <x86intrin.h>
1423///
1424/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c>
1425/// instructions.
1426///
1427/// \param __a
1428/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1429/// used in the conversion.
1430/// \returns A 64-bit integer containing the converted value.
1431static __inline__ long long __DEFAULT_FN_ATTRS
1432_mm_cvtss_si64(__m128 __a)
1433{
1434 return __builtin_ia32_cvtss2si64((__v4sf)__a);
1435}
1436
1437#endif
1438
1439/// Converts two low-order float values in a 128-bit vector of
1440/// [4 x float] into a 64-bit vector of [2 x i32].
1441///
1442/// If a converted value does not fit in a 32-bit integer, raises a
1443/// floating-point invalid exception. If the exception is masked, returns
1444/// the most negative integer.
1445///
1446/// \headerfile <x86intrin.h>
1447///
1448/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction.
1449///
1450/// \param __a
1451/// A 128-bit vector of [4 x float].
1452/// \returns A 64-bit integer vector containing the converted values.
1453static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1455{
1456 return __trunc64(__builtin_ia32_cvtps2dq((__v4sf)__zeroupper64(__a)));
1457}
1458
1459/// Converts two low-order float values in a 128-bit vector of
1460/// [4 x float] into a 64-bit vector of [2 x i32].
1461///
1462/// If a converted value does not fit in a 32-bit integer, raises a
1463/// floating-point invalid exception. If the exception is masked, returns
1464/// the most negative integer.
1465///
1466/// \headerfile <x86intrin.h>
1467///
1468/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction.
1469///
1470/// \param __a
1471/// A 128-bit vector of [4 x float].
1472/// \returns A 64-bit integer vector containing the converted values.
1473static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1475{
1476 return _mm_cvtps_pi32(__a);
1477}
1478
1479/// Converts the lower (first) element of a vector of [4 x float] into a signed
1480/// truncated (rounded toward zero) 32-bit integer.
1481///
1482/// If the converted value does not fit in a 32-bit integer, raises a
1483/// floating-point invalid exception. If the exception is masked, returns
1484/// the most negative integer.
1485///
1486/// \headerfile <x86intrin.h>
1487///
1488/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1489/// instructions.
1490///
1491/// \param __a
1492/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1493/// used in the conversion.
1494/// \returns A 32-bit integer containing the converted value.
1495static __inline__ int __DEFAULT_FN_ATTRS
1497{
1498 return __builtin_ia32_cvttss2si((__v4sf)__a);
1499}
1500
1501/// Converts the lower (first) element of a vector of [4 x float] into a signed
1502/// truncated (rounded toward zero) 32-bit integer.
1503///
1504/// If the converted value does not fit in a 32-bit integer, raises a
1505/// floating-point invalid exception. If the exception is masked, returns
1506/// the most negative integer.
1507///
1508/// \headerfile <x86intrin.h>
1509///
1510/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1511/// instructions.
1512///
1513/// \param __a
1514/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1515/// used in the conversion.
1516/// \returns A 32-bit integer containing the converted value.
1517static __inline__ int __DEFAULT_FN_ATTRS
1519{
1520 return _mm_cvttss_si32(__a);
1521}
1522
1523#ifdef __x86_64__
1524/// Converts the lower (first) element of a vector of [4 x float] into a signed
1525/// truncated (rounded toward zero) 64-bit integer.
1526///
1527/// If the converted value does not fit in a 64-bit integer, raises a
1528/// floating-point invalid exception. If the exception is masked, returns
1529/// the most negative integer.
1530///
1531/// \headerfile <x86intrin.h>
1532///
1533/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c>
1534/// instructions.
1535///
1536/// \param __a
1537/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1538/// used in the conversion.
1539/// \returns A 64-bit integer containing the converted value.
1540static __inline__ long long __DEFAULT_FN_ATTRS
1541_mm_cvttss_si64(__m128 __a)
1542{
1543 return __builtin_ia32_cvttss2si64((__v4sf)__a);
1544}
1545#endif
1546
1547/// Converts the lower (first) two elements of a 128-bit vector of [4 x float]
1548/// into two signed truncated (rounded toward zero) 32-bit integers,
1549/// returned in a 64-bit vector of [2 x i32].
1550///
1551/// If a converted value does not fit in a 32-bit integer, raises a
1552/// floating-point invalid exception. If the exception is masked, returns
1553/// the most negative integer.
1554///
1555/// \headerfile <x86intrin.h>
1556///
1557/// This intrinsic corresponds to the <c> CVTTPS2PI / VTTPS2PI </c>
1558/// instructions.
1559///
1560/// \param __a
1561/// A 128-bit vector of [4 x float].
1562/// \returns A 64-bit integer vector containing the converted values.
1563static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1565{
1566 return __trunc64(__builtin_ia32_cvttps2dq((__v4sf)__zeroupper64(__a)));
1567}
1568
1569/// Converts the lower (first) two elements of a 128-bit vector of [4 x float]
1570/// into two signed truncated (rounded toward zero) 64-bit integers,
1571/// returned in a 64-bit vector of [2 x i32].
1572///
1573/// If a converted value does not fit in a 32-bit integer, raises a
1574/// floating-point invalid exception. If the exception is masked, returns
1575/// the most negative integer.
1576///
1577/// \headerfile <x86intrin.h>
1578///
1579/// This intrinsic corresponds to the <c> CVTTPS2PI </c> instruction.
1580///
1581/// \param __a
1582/// A 128-bit vector of [4 x float].
1583/// \returns A 64-bit integer vector containing the converted values.
1584static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1586{
1587 return _mm_cvttps_pi32(__a);
1588}
1589
1590/// Converts a 32-bit signed integer value into a floating point value
1591/// and writes it to the lower 32 bits of the destination. The remaining
1592/// higher order elements of the destination vector are copied from the
1593/// corresponding elements in the first operand.
1594///
1595/// \headerfile <x86intrin.h>
1596///
1597/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1598///
1599/// \param __a
1600/// A 128-bit vector of [4 x float].
1601/// \param __b
1602/// A 32-bit signed integer operand containing the value to be converted.
1603/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1604/// converted value of the second operand. The upper 96 bits are copied from
1605/// the upper 96 bits of the first operand.
1606static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_cvtsi32_ss(__m128 __a,
1607 int __b) {
1608 __a[0] = __b;
1609 return __a;
1610}
1611
1612/// Converts a 32-bit signed integer value into a floating point value
1613/// and writes it to the lower 32 bits of the destination. The remaining
1614/// higher order elements of the destination are copied from the
1615/// corresponding elements in the first operand.
1616///
1617/// \headerfile <x86intrin.h>
1618///
1619/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1620///
1621/// \param __a
1622/// A 128-bit vector of [4 x float].
1623/// \param __b
1624/// A 32-bit signed integer operand containing the value to be converted.
1625/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1626/// converted value of the second operand. The upper 96 bits are copied from
1627/// the upper 96 bits of the first operand.
1628static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_cvt_si2ss(__m128 __a,
1629 int __b) {
1630 return _mm_cvtsi32_ss(__a, __b);
1631}
1632
1633#ifdef __x86_64__
1634
1635/// Converts a 64-bit signed integer value into a floating point value
1636/// and writes it to the lower 32 bits of the destination. The remaining
1637/// higher order elements of the destination are copied from the
1638/// corresponding elements in the first operand.
1639///
1640/// \headerfile <x86intrin.h>
1641///
1642/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction.
1643///
1644/// \param __a
1645/// A 128-bit vector of [4 x float].
1646/// \param __b
1647/// A 64-bit signed integer operand containing the value to be converted.
1648/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
1649/// converted value of the second operand. The upper 96 bits are copied from
1650/// the upper 96 bits of the first operand.
1651static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1652_mm_cvtsi64_ss(__m128 __a, long long __b) {
1653 __a[0] = __b;
1654 return __a;
1655}
1656
1657#endif
1658
1659/// Converts two elements of a 64-bit vector of [2 x i32] into two
1660/// floating point values and writes them to the lower 64-bits of the
1661/// destination. The remaining higher order elements of the destination are
1662/// copied from the corresponding elements in the first operand.
1663///
1664/// \headerfile <x86intrin.h>
1665///
1666/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction.
1667///
1668/// \param __a
1669/// A 128-bit vector of [4 x float].
1670/// \param __b
1671/// A 64-bit vector of [2 x i32]. The elements in this vector are converted
1672/// and written to the corresponding low-order elements in the destination.
1673/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
1674/// converted value of the second operand. The upper 64 bits are copied from
1675/// the upper 64 bits of the first operand.
1676static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1677_mm_cvtpi32_ps(__m128 __a, __m64 __b)
1678{
1679 return (__m128)__builtin_shufflevector(
1680 (__v4sf)__a,
1681 __builtin_convertvector((__v4si)__zext128(__b), __v4sf),
1682 4, 5, 2, 3);
1683}
1684
1685/// Converts two elements of a 64-bit vector of [2 x i32] into two
1686/// floating point values and writes them to the lower 64-bits of the
1687/// destination. The remaining higher order elements of the destination are
1688/// copied from the corresponding elements in the first operand.
1689///
1690/// \headerfile <x86intrin.h>
1691///
1692/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction.
1693///
1694/// \param __a
1695/// A 128-bit vector of [4 x float].
1696/// \param __b
1697/// A 64-bit vector of [2 x i32]. The elements in this vector are converted
1698/// and written to the corresponding low-order elements in the destination.
1699/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
1700/// converted value from the second operand. The upper 64 bits are copied
1701/// from the upper 64 bits of the first operand.
1702static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1703_mm_cvt_pi2ps(__m128 __a, __m64 __b)
1704{
1705 return _mm_cvtpi32_ps(__a, __b);
1706}
1707
1708/// Extracts a float value contained in the lower 32 bits of a vector of
1709/// [4 x float].
1710///
1711/// \headerfile <x86intrin.h>
1712///
1713/// This intrinsic has no corresponding instruction.
1714///
1715/// \param __a
1716/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are
1717/// used in the extraction.
1718/// \returns A 32-bit float containing the extracted value.
1719static __inline__ float __DEFAULT_FN_ATTRS_CONSTEXPR
1721 return __a[0];
1722}
1723
1724/// Loads two packed float values from the address \a __p into the
1725/// high-order bits of a 128-bit vector of [4 x float]. The low-order bits
1726/// are copied from the low-order bits of the first operand.
1727///
1728/// \headerfile <x86intrin.h>
1729///
1730/// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction.
1731///
1732/// \param __a
1733/// A 128-bit vector of [4 x float]. Bits [63:0] are written to bits [63:0]
1734/// of the destination.
1735/// \param __p
1736/// A pointer to two packed float values. Bits [63:0] are written to bits
1737/// [127:64] of the destination.
1738/// \returns A 128-bit vector of [4 x float] containing the moved values.
1739static __inline__ __m128 __DEFAULT_FN_ATTRS
1740_mm_loadh_pi(__m128 __a, const __m64 *__p)
1741{
1742 typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));
1743 struct __mm_loadh_pi_struct {
1744 __mm_loadh_pi_v2f32 __u;
1745 } __attribute__((__packed__, __may_alias__));
1746 __mm_loadh_pi_v2f32 __b = ((const struct __mm_loadh_pi_struct*)__p)->__u;
1747 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
1748 return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
1749}
1750
1751/// Loads two packed float values from the address \a __p into the
1752/// low-order bits of a 128-bit vector of [4 x float]. The high-order bits
1753/// are copied from the high-order bits of the first operand.
1754///
1755/// \headerfile <x86intrin.h>
1756///
1757/// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction.
1758///
1759/// \param __a
1760/// A 128-bit vector of [4 x float]. Bits [127:64] are written to bits
1761/// [127:64] of the destination.
1762/// \param __p
1763/// A pointer to two packed float values. Bits [63:0] are written to bits
1764/// [63:0] of the destination.
1765/// \returns A 128-bit vector of [4 x float] containing the moved values.
1766static __inline__ __m128 __DEFAULT_FN_ATTRS
1767_mm_loadl_pi(__m128 __a, const __m64 *__p)
1768{
1769 typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));
1770 struct __mm_loadl_pi_struct {
1771 __mm_loadl_pi_v2f32 __u;
1772 } __attribute__((__packed__, __may_alias__));
1773 __mm_loadl_pi_v2f32 __b = ((const struct __mm_loadl_pi_struct*)__p)->__u;
1774 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
1775 return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
1776}
1777
1778/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
1779/// 32 bits of the vector are initialized with the single-precision
1780/// floating-point value loaded from a specified memory location. The upper
1781/// 96 bits are set to zero.
1782///
1783/// \headerfile <x86intrin.h>
1784///
1785/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
1786///
1787/// \param __p
1788/// A pointer to a 32-bit memory location containing a single-precision
1789/// floating-point value.
1790/// \returns An initialized 128-bit floating-point vector of [4 x float]. The
1791/// lower 32 bits contain the value loaded from the memory location. The
1792/// upper 96 bits are set to zero.
1793static __inline__ __m128 __DEFAULT_FN_ATTRS
1794_mm_load_ss(const float *__p)
1795{
1796 struct __mm_load_ss_struct {
1797 float __u;
1798 } __attribute__((__packed__, __may_alias__));
1799 float __u = ((const struct __mm_load_ss_struct*)__p)->__u;
1800 return __extension__ (__m128){ __u, 0, 0, 0 };
1801}
1802
1803/// Loads a 32-bit float value and duplicates it to all four vector
1804/// elements of a 128-bit vector of [4 x float].
1805///
1806/// \headerfile <x86intrin.h>
1807///
1808/// This intrinsic corresponds to the <c> VBROADCASTSS / MOVSS + shuffling </c>
1809/// instruction.
1810///
1811/// \param __p
1812/// A pointer to a float value to be loaded and duplicated.
1813/// \returns A 128-bit vector of [4 x float] containing the loaded and
1814/// duplicated values.
1815static __inline__ __m128 __DEFAULT_FN_ATTRS
1816_mm_load1_ps(const float *__p)
1817{
1818 struct __mm_load1_ps_struct {
1819 float __u;
1820 } __attribute__((__packed__, __may_alias__));
1821 float __u = ((const struct __mm_load1_ps_struct*)__p)->__u;
1822 return __extension__ (__m128){ __u, __u, __u, __u };
1823}
1824
1825#define _mm_load_ps1(p) _mm_load1_ps(p)
1826
1827/// Loads a 128-bit floating-point vector of [4 x float] from an aligned
1828/// memory location.
1829///
1830/// \headerfile <x86intrin.h>
1831///
1832/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
1833///
1834/// \param __p
1835/// A pointer to a 128-bit memory location. The address of the memory
1836/// location has to be 128-bit aligned.
1837/// \returns A 128-bit vector of [4 x float] containing the loaded values.
1838static __inline__ __m128 __DEFAULT_FN_ATTRS
1839_mm_load_ps(const float *__p)
1840{
1841 return *(const __m128*)__p;
1842}
1843
1844/// Loads a 128-bit floating-point vector of [4 x float] from an
1845/// unaligned memory location.
1846///
1847/// \headerfile <x86intrin.h>
1848///
1849/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
1850///
1851/// \param __p
1852/// A pointer to a 128-bit memory location. The address of the memory
1853/// location does not have to be aligned.
1854/// \returns A 128-bit vector of [4 x float] containing the loaded values.
1855static __inline__ __m128 __DEFAULT_FN_ATTRS
1856_mm_loadu_ps(const float *__p)
1857{
1858 struct __loadu_ps {
1859 __m128_u __v;
1860 } __attribute__((__packed__, __may_alias__));
1861 return ((const struct __loadu_ps*)__p)->__v;
1862}
1863
1864/// Loads four packed float values, in reverse order, from an aligned
1865/// memory location to 32-bit elements in a 128-bit vector of [4 x float].
1866///
1867/// \headerfile <x86intrin.h>
1868///
1869/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c>
1870/// instruction.
1871///
1872/// \param __p
1873/// A pointer to a 128-bit memory location. The address of the memory
1874/// location has to be 128-bit aligned.
1875/// \returns A 128-bit vector of [4 x float] containing the moved values, loaded
1876/// in reverse order.
1877static __inline__ __m128 __DEFAULT_FN_ATTRS
1878_mm_loadr_ps(const float *__p)
1879{
1880 __m128 __a = _mm_load_ps(__p);
1881 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0);
1882}
1883
1884/// Create a 128-bit vector of [4 x float] with undefined values.
1885///
1886/// \headerfile <x86intrin.h>
1887///
1888/// This intrinsic has no corresponding instruction.
1889///
1890/// \returns A 128-bit vector of [4 x float] containing undefined values.
1891static __inline__ __m128 __DEFAULT_FN_ATTRS
1893{
1894 return (__m128)__builtin_ia32_undef128();
1895}
1896
1897/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
1898/// 32 bits of the vector are initialized with the specified single-precision
1899/// floating-point value. The upper 96 bits are set to zero.
1900///
1901/// \headerfile <x86intrin.h>
1902///
1903/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
1904///
1905/// \param __w
1906/// A single-precision floating-point value used to initialize the lower 32
1907/// bits of the result.
1908/// \returns An initialized 128-bit floating-point vector of [4 x float]. The
1909/// lower 32 bits contain the value provided in the source operand. The
1910/// upper 96 bits are set to zero.
1911static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1912_mm_set_ss(float __w) {
1913 return __extension__ (__m128){ __w, 0.0f, 0.0f, 0.0f };
1914}
1915
1916/// Constructs a 128-bit floating-point vector of [4 x float], with each
1917/// of the four single-precision floating-point vector elements set to the
1918/// specified single-precision floating-point value.
1919///
1920/// \headerfile <x86intrin.h>
1921///
1922/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction.
1923///
1924/// \param __w
1925/// A single-precision floating-point value used to initialize each vector
1926/// element of the result.
1927/// \returns An initialized 128-bit floating-point vector of [4 x float].
1928static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1929_mm_set1_ps(float __w) {
1930 return __extension__ (__m128){ __w, __w, __w, __w };
1931}
1932
1933/* Microsoft specific. */
1934/// Constructs a 128-bit floating-point vector of [4 x float], with each
1935/// of the four single-precision floating-point vector elements set to the
1936/// specified single-precision floating-point value.
1937///
1938/// \headerfile <x86intrin.h>
1939///
1940/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction.
1941///
1942/// \param __w
1943/// A single-precision floating-point value used to initialize each vector
1944/// element of the result.
1945/// \returns An initialized 128-bit floating-point vector of [4 x float].
1946static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1947_mm_set_ps1(float __w) {
1948 return _mm_set1_ps(__w);
1949}
1950
1951/// Constructs a 128-bit floating-point vector of [4 x float]
1952/// initialized with the specified single-precision floating-point values.
1953///
1954/// \headerfile <x86intrin.h>
1955///
1956/// This intrinsic is a utility function and does not correspond to a specific
1957/// instruction.
1958///
1959/// \param __z
1960/// A single-precision floating-point value used to initialize bits [127:96]
1961/// of the result.
1962/// \param __y
1963/// A single-precision floating-point value used to initialize bits [95:64]
1964/// of the result.
1965/// \param __x
1966/// A single-precision floating-point value used to initialize bits [63:32]
1967/// of the result.
1968/// \param __w
1969/// A single-precision floating-point value used to initialize bits [31:0]
1970/// of the result.
1971/// \returns An initialized 128-bit floating-point vector of [4 x float].
1972static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
1973_mm_set_ps(float __z, float __y, float __x, float __w) {
1974 return __extension__ (__m128){ __w, __x, __y, __z };
1975}
1976
1977/// Constructs a 128-bit floating-point vector of [4 x float],
1978/// initialized in reverse order with the specified 32-bit single-precision
1979/// float-point values.
1980///
1981/// \headerfile <x86intrin.h>
1982///
1983/// This intrinsic is a utility function and does not correspond to a specific
1984/// instruction.
1985///
1986/// \param __z
1987/// A single-precision floating-point value used to initialize bits [31:0]
1988/// of the result.
1989/// \param __y
1990/// A single-precision floating-point value used to initialize bits [63:32]
1991/// of the result.
1992/// \param __x
1993/// A single-precision floating-point value used to initialize bits [95:64]
1994/// of the result.
1995/// \param __w
1996/// A single-precision floating-point value used to initialize bits [127:96]
1997/// of the result.
1998/// \returns An initialized 128-bit floating-point vector of [4 x float].
1999static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2000_mm_setr_ps(float __z, float __y, float __x, float __w) {
2001 return __extension__ (__m128){ __z, __y, __x, __w };
2002}
2003
2004/// Constructs a 128-bit floating-point vector of [4 x float] initialized
2005/// to zero.
2006///
2007/// \headerfile <x86intrin.h>
2008///
2009/// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction.
2010///
2011/// \returns An initialized 128-bit floating-point vector of [4 x float] with
2012/// all elements set to zero.
2013static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2015 return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f };
2016}
2017
2018/// Stores the upper 64 bits of a 128-bit vector of [4 x float] to a
2019/// memory location.
2020///
2021/// \headerfile <x86intrin.h>
2022///
2023/// This intrinsic corresponds to the <c> VPEXTRQ / PEXTRQ </c> instruction.
2024///
2025/// \param __p
2026/// A pointer to a 64-bit memory location.
2027/// \param __a
2028/// A 128-bit vector of [4 x float] containing the values to be stored.
2029static __inline__ void __DEFAULT_FN_ATTRS
2030_mm_storeh_pi(__m64 *__p, __m128 __a)
2031{
2032 typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8)));
2033 struct __mm_storeh_pi_struct {
2034 __mm_storeh_pi_v2f32 __u;
2035 } __attribute__((__packed__, __may_alias__));
2036 ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 2, 3);
2037}
2038
2039/// Stores the lower 64 bits of a 128-bit vector of [4 x float] to a
2040/// memory location.
2041///
2042/// \headerfile <x86intrin.h>
2043///
2044/// This intrinsic corresponds to the <c> VMOVLPS / MOVLPS </c> instruction.
2045///
2046/// \param __p
2047/// A pointer to a memory location that will receive the float values.
2048/// \param __a
2049/// A 128-bit vector of [4 x float] containing the values to be stored.
2050static __inline__ void __DEFAULT_FN_ATTRS
2051_mm_storel_pi(__m64 *__p, __m128 __a)
2052{
2053 typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8)));
2054 struct __mm_storeh_pi_struct {
2055 __mm_storeh_pi_v2f32 __u;
2056 } __attribute__((__packed__, __may_alias__));
2057 ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 0, 1);
2058}
2059
2060/// Stores the lower 32 bits of a 128-bit vector of [4 x float] to a
2061/// memory location.
2062///
2063/// \headerfile <x86intrin.h>
2064///
2065/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction.
2066///
2067/// \param __p
2068/// A pointer to a 32-bit memory location.
2069/// \param __a
2070/// A 128-bit vector of [4 x float] containing the value to be stored.
2071static __inline__ void __DEFAULT_FN_ATTRS
2072_mm_store_ss(float *__p, __m128 __a)
2073{
2074 struct __mm_store_ss_struct {
2075 float __u;
2076 } __attribute__((__packed__, __may_alias__));
2077 ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
2078}
2079
2080/// Stores a 128-bit vector of [4 x float] to an unaligned memory
2081/// location.
2082///
2083/// \headerfile <x86intrin.h>
2084///
2085/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction.
2086///
2087/// \param __p
2088/// A pointer to a 128-bit memory location. The address of the memory
2089/// location does not have to be aligned.
2090/// \param __a
2091/// A 128-bit vector of [4 x float] containing the values to be stored.
2092static __inline__ void __DEFAULT_FN_ATTRS
2093_mm_storeu_ps(float *__p, __m128 __a)
2094{
2095 struct __storeu_ps {
2096 __m128_u __v;
2097 } __attribute__((__packed__, __may_alias__));
2098 ((struct __storeu_ps*)__p)->__v = __a;
2099}
2100
2101/// Stores a 128-bit vector of [4 x float] into an aligned memory
2102/// location.
2103///
2104/// \headerfile <x86intrin.h>
2105///
2106/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction.
2107///
2108/// \param __p
2109/// A pointer to a 128-bit memory location. The address of the memory
2110/// location has to be 16-byte aligned.
2111/// \param __a
2112/// A 128-bit vector of [4 x float] containing the values to be stored.
2113static __inline__ void __DEFAULT_FN_ATTRS
2114_mm_store_ps(float *__p, __m128 __a)
2115{
2116 *(__m128*)__p = __a;
2117}
2118
2119/// Stores the lower 32 bits of a 128-bit vector of [4 x float] into
2120/// four contiguous elements in an aligned memory location.
2121///
2122/// \headerfile <x86intrin.h>
2123///
2124/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c>
2125/// instruction.
2126///
2127/// \param __p
2128/// A pointer to a 128-bit memory location.
2129/// \param __a
2130/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
2131/// of the four contiguous elements pointed by \a __p.
2132static __inline__ void __DEFAULT_FN_ATTRS
2133_mm_store1_ps(float *__p, __m128 __a)
2134{
2135 __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0);
2137}
2138
2139/// Stores the lower 32 bits of a 128-bit vector of [4 x float] into
2140/// four contiguous elements in an aligned memory location.
2141///
2142/// \headerfile <x86intrin.h>
2143///
2144/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c>
2145/// instruction.
2146///
2147/// \param __p
2148/// A pointer to a 128-bit memory location.
2149/// \param __a
2150/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
2151/// of the four contiguous elements pointed by \a __p.
2152static __inline__ void __DEFAULT_FN_ATTRS
2153_mm_store_ps1(float *__p, __m128 __a)
2154{
2156}
2157
2158/// Stores float values from a 128-bit vector of [4 x float] to an
2159/// aligned memory location in reverse order.
2160///
2161/// \headerfile <x86intrin.h>
2162///
2163/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c>
2164/// instruction.
2165///
2166/// \param __p
2167/// A pointer to a 128-bit memory location. The address of the memory
2168/// location has to be 128-bit aligned.
2169/// \param __a
2170/// A 128-bit vector of [4 x float] containing the values to be stored.
2171static __inline__ void __DEFAULT_FN_ATTRS
2172_mm_storer_ps(float *__p, __m128 __a)
2173{
2174 __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0);
2176}
2177
2178#define _MM_HINT_ET0 7
2179#define _MM_HINT_ET1 6
2180#define _MM_HINT_T0 3
2181#define _MM_HINT_T1 2
2182#define _MM_HINT_T2 1
2183#define _MM_HINT_NTA 0
2184
2185#ifndef _MSC_VER
2186// If _MSC_VER is defined, we use the builtin variant of _mm_prefetch.
2187// Otherwise, we provide this macro, which includes a cast, allowing the user
2188// to pass a pointer of any time. The _mm_prefetch accepts char to match MSVC.
2189
2190/// Loads one cache line of data from the specified address to a location
2191/// closer to the processor.
2192///
2193/// \headerfile <x86intrin.h>
2194///
2195/// \code
2196/// void _mm_prefetch(const void *a, const int sel);
2197/// \endcode
2198///
2199/// This intrinsic corresponds to the <c> PREFETCHNTA </c> instruction.
2200///
2201/// \param a
2202/// A pointer to a memory location containing a cache line of data.
2203/// \param sel
2204/// A predefined integer constant specifying the type of prefetch
2205/// operation: \n
2206/// _MM_HINT_NTA: Move data using the non-temporal access (NTA) hint. The
2207/// PREFETCHNTA instruction will be generated. \n
2208/// _MM_HINT_T0: Move data using the T0 hint. The PREFETCHT0 instruction will
2209/// be generated. \n
2210/// _MM_HINT_T1: Move data using the T1 hint. The PREFETCHT1 instruction will
2211/// be generated. \n
2212/// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will
2213/// be generated.
2214#define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \
2215 ((sel) >> 2) & 1, (sel) & 0x3))
2216#endif
2217
2218/// Stores a 64-bit integer in the specified aligned memory location. To
2219/// minimize caching, the data is flagged as non-temporal (unlikely to be
2220/// used again soon).
2221///
2222/// \headerfile <x86intrin.h>
2223///
2224/// This intrinsic corresponds to the <c> MOVNTQ </c> instruction.
2225///
2226/// \param __p
2227/// A pointer to an aligned memory location used to store the register value.
2228/// \param __a
2229/// A 64-bit integer containing the value to be stored.
2230static __inline__ void __DEFAULT_FN_ATTRS
2231_mm_stream_pi(void *__p, __m64 __a)
2232{
2233 __builtin_nontemporal_store(__a, (__m64 *)__p);
2234}
2235
2236/// Moves packed float values from a 128-bit vector of [4 x float] to a
2237/// 128-bit aligned memory location. To minimize caching, the data is flagged
2238/// as non-temporal (unlikely to be used again soon).
2239///
2240/// \headerfile <x86intrin.h>
2241///
2242/// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction.
2243///
2244/// \param __p
2245/// A pointer to a 128-bit aligned memory location that will receive the
2246/// single-precision floating-point values.
2247/// \param __a
2248/// A 128-bit vector of [4 x float] containing the values to be moved.
2249static __inline__ void __DEFAULT_FN_ATTRS
2250_mm_stream_ps(void *__p, __m128 __a)
2251{
2252 __builtin_nontemporal_store((__v4sf)__a, (__v4sf*)__p);
2253}
2254
2255#if defined(__cplusplus)
2256extern "C" {
2257#endif
2258
2259/// Forces strong memory ordering (serialization) between store
2260/// instructions preceding this instruction and store instructions following
2261/// this instruction, ensuring the system completes all previous stores
2262/// before executing subsequent stores.
2263///
2264/// \headerfile <x86intrin.h>
2265///
2266/// This intrinsic corresponds to the <c> SFENCE </c> instruction.
2267///
2268void _mm_sfence(void);
2269
2270#if defined(__cplusplus)
2271} // extern "C"
2272#endif
2273
2274/// Extracts 16-bit element from a 64-bit vector of [4 x i16] and
2275/// returns it, as specified by the immediate integer operand.
2276///
2277/// \headerfile <x86intrin.h>
2278///
2279/// \code
2280/// int _mm_extract_pi16(__m64 a, int n);
2281/// \endcode
2282///
2283/// This intrinsic corresponds to the <c> VPEXTRW / PEXTRW </c> instruction.
2284///
2285/// \param a
2286/// A 64-bit vector of [4 x i16].
2287/// \param n
2288/// An immediate integer operand that determines which bits are extracted: \n
2289/// 0: Bits [15:0] are copied to the destination. \n
2290/// 1: Bits [31:16] are copied to the destination. \n
2291/// 2: Bits [47:32] are copied to the destination. \n
2292/// 3: Bits [63:48] are copied to the destination.
2293/// \returns A 16-bit integer containing the extracted 16 bits of packed data.
2294#define _mm_extract_pi16(a, n) \
2295 ((int)(unsigned short)__builtin_ia32_vec_ext_v4hi((__v4hi)a, (int)n))
2296
2297/// Copies data from the 64-bit vector of [4 x i16] to the destination,
2298/// and inserts the lower 16-bits of an integer operand at the 16-bit offset
2299/// specified by the immediate operand \a n.
2300///
2301/// \headerfile <x86intrin.h>
2302///
2303/// \code
2304/// __m64 _mm_insert_pi16(__m64 a, int d, int n);
2305/// \endcode
2306///
2307/// This intrinsic corresponds to the <c> PINSRW </c> instruction.
2308///
2309/// \param a
2310/// A 64-bit vector of [4 x i16].
2311/// \param d
2312/// An integer. The lower 16-bit value from this operand is written to the
2313/// destination at the offset specified by operand \a n.
2314/// \param n
2315/// An immediate integer operant that determines which the bits to be used
2316/// in the destination. \n
2317/// 0: Bits [15:0] are copied to the destination. \n
2318/// 1: Bits [31:16] are copied to the destination. \n
2319/// 2: Bits [47:32] are copied to the destination. \n
2320/// 3: Bits [63:48] are copied to the destination. \n
2321/// The remaining bits in the destination are copied from the corresponding
2322/// bits in operand \a a.
2323/// \returns A 64-bit integer vector containing the copied packed data from the
2324/// operands.
2325#define _mm_insert_pi16(a, d, n) \
2326 ((__m64)__builtin_ia32_vec_set_v4hi((__v4hi)a, (int)d, (int)n))
2327
2328/// Compares each of the corresponding packed 16-bit integer values of
2329/// the 64-bit integer vectors, and writes the greater value to the
2330/// corresponding bits in the destination.
2331///
2332/// \headerfile <x86intrin.h>
2333///
2334/// This intrinsic corresponds to the <c> PMAXSW </c> instruction.
2335///
2336/// \param __a
2337/// A 64-bit integer vector containing one of the source operands.
2338/// \param __b
2339/// A 64-bit integer vector containing one of the source operands.
2340/// \returns A 64-bit integer vector containing the comparison results.
2341static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2342_mm_max_pi16(__m64 __a, __m64 __b) {
2343 return (__m64)__builtin_elementwise_max((__v4hi)__a, (__v4hi)__b);
2344}
2345
2346/// Compares each of the corresponding packed 8-bit unsigned integer
2347/// values of the 64-bit integer vectors, and writes the greater value to the
2348/// corresponding bits in the destination.
2349///
2350/// \headerfile <x86intrin.h>
2351///
2352/// This intrinsic corresponds to the <c> PMAXUB </c> instruction.
2353///
2354/// \param __a
2355/// A 64-bit integer vector containing one of the source operands.
2356/// \param __b
2357/// A 64-bit integer vector containing one of the source operands.
2358/// \returns A 64-bit integer vector containing the comparison results.
2359static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2360_mm_max_pu8(__m64 __a, __m64 __b) {
2361 return (__m64)__builtin_elementwise_max((__v8qu)__a, (__v8qu)__b);
2362}
2363
2364/// Compares each of the corresponding packed 16-bit integer values of
2365/// the 64-bit integer vectors, and writes the lesser value to the
2366/// corresponding bits in the destination.
2367///
2368/// \headerfile <x86intrin.h>
2369///
2370/// This intrinsic corresponds to the <c> PMINSW </c> instruction.
2371///
2372/// \param __a
2373/// A 64-bit integer vector containing one of the source operands.
2374/// \param __b
2375/// A 64-bit integer vector containing one of the source operands.
2376/// \returns A 64-bit integer vector containing the comparison results.
2377static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2378_mm_min_pi16(__m64 __a, __m64 __b) {
2379 return (__m64)__builtin_elementwise_min((__v4hi)__a, (__v4hi)__b);
2380}
2381
2382/// Compares each of the corresponding packed 8-bit unsigned integer
2383/// values of the 64-bit integer vectors, and writes the lesser value to the
2384/// corresponding bits in the destination.
2385///
2386/// \headerfile <x86intrin.h>
2387///
2388/// This intrinsic corresponds to the <c> PMINUB </c> instruction.
2389///
2390/// \param __a
2391/// A 64-bit integer vector containing one of the source operands.
2392/// \param __b
2393/// A 64-bit integer vector containing one of the source operands.
2394/// \returns A 64-bit integer vector containing the comparison results.
2395static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2396_mm_min_pu8(__m64 __a, __m64 __b) {
2397 return (__m64)__builtin_elementwise_min((__v8qu)__a, (__v8qu)__b);
2398}
2399
2400/// Takes the most significant bit from each 8-bit element in a 64-bit
2401/// integer vector to create an 8-bit mask value. Zero-extends the value to
2402/// 32-bit integer and writes it to the destination.
2403///
2404/// \headerfile <x86intrin.h>
2405///
2406/// This intrinsic corresponds to the <c> PMOVMSKB </c> instruction.
2407///
2408/// \param __a
2409/// A 64-bit integer vector containing the values with bits to be extracted.
2410/// \returns The most significant bit from each 8-bit element in \a __a,
2411/// written to bits [7:0].
2412static __inline__ int __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2414 return __builtin_ia32_pmovmskb128((__v16qi)__zext128(__a));
2415}
2416
2417/// Multiplies packed 16-bit unsigned integer values and writes the
2418/// high-order 16 bits of each 32-bit product to the corresponding bits in
2419/// the destination.
2420///
2421/// \headerfile <x86intrin.h>
2422///
2423/// This intrinsic corresponds to the <c> PMULHUW </c> instruction.
2424///
2425/// \param __a
2426/// A 64-bit integer vector containing one of the source operands.
2427/// \param __b
2428/// A 64-bit integer vector containing one of the source operands.
2429/// \returns A 64-bit integer vector containing the products of both operands.
2430static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2432{
2433 return __trunc64(__builtin_ia32_pmulhuw128((__v8hu)__zext128(__a),
2434 (__v8hu)__zext128(__b)));
2435}
2436
2437/// Shuffles the 4 16-bit integers from a 64-bit integer vector to the
2438/// destination, as specified by the immediate value operand.
2439///
2440/// \headerfile <x86intrin.h>
2441///
2442/// \code
2443/// __m64 _mm_shuffle_pi16(__m64 a, const int n);
2444/// \endcode
2445///
2446/// This intrinsic corresponds to the <c> PSHUFW </c> instruction.
2447///
2448/// \param a
2449/// A 64-bit integer vector containing the values to be shuffled.
2450/// \param n
2451/// An immediate value containing an 8-bit value specifying which elements to
2452/// copy from \a a. The destinations within the 64-bit destination are
2453/// assigned values as follows: \n
2454/// Bits [1:0] are used to assign values to bits [15:0] in the
2455/// destination. \n
2456/// Bits [3:2] are used to assign values to bits [31:16] in the
2457/// destination. \n
2458/// Bits [5:4] are used to assign values to bits [47:32] in the
2459/// destination. \n
2460/// Bits [7:6] are used to assign values to bits [63:48] in the
2461/// destination. \n
2462/// Bit value assignments: \n
2463/// 00: assigned from bits [15:0] of \a a. \n
2464/// 01: assigned from bits [31:16] of \a a. \n
2465/// 10: assigned from bits [47:32] of \a a. \n
2466/// 11: assigned from bits [63:48] of \a a. \n
2467/// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
2468/// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
2469/// <c>[b6, b4, b2, b0]</c>.
2470/// \returns A 64-bit integer vector containing the shuffled values.
2471#define _mm_shuffle_pi16(a, n) \
2472 ((__m64)__builtin_shufflevector((__v4hi)(__m64)(a), __extension__(__v4hi){}, \
2473 (n) & 0x3, ((n) >> 2) & 0x3, \
2474 ((n) >> 4) & 0x3, ((n) >> 6) & 0x3))
2475
2476/// Conditionally copies the values from each 8-bit element in the first
2477/// 64-bit integer vector operand to the specified memory location, as
2478/// specified by the most significant bit in the corresponding element in the
2479/// second 64-bit integer vector operand.
2480///
2481/// To minimize caching, the data is flagged as non-temporal
2482/// (unlikely to be used again soon).
2483///
2484/// \headerfile <x86intrin.h>
2485///
2486/// This intrinsic corresponds to the <c> MASKMOVQ </c> instruction.
2487///
2488/// \param __d
2489/// A 64-bit integer vector containing the values with elements to be copied.
2490/// \param __n
2491/// A 64-bit integer vector operand. The most significant bit from each 8-bit
2492/// element determines whether the corresponding element in operand \a __d
2493/// is copied. If the most significant bit of a given element is 1, the
2494/// corresponding element in operand \a __d is copied.
2495/// \param __p
2496/// A pointer to a 64-bit memory location that will receive the conditionally
2497/// copied integer values. The address of the memory location does not have
2498/// to be aligned.
2499static __inline__ void __DEFAULT_FN_ATTRS_SSE2
2500_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
2501{
2502 // This is complex, because we need to support the case where __p is pointing
2503 // within the last 15 to 8 bytes of a page. In that case, using a 128-bit
2504 // write might cause a trap where a 64-bit maskmovq would not. (Memory
2505 // locations not selected by the mask bits might still cause traps.)
2506 __m128i __d128 = __anyext128(__d);
2507 __m128i __n128 = __zext128(__n);
2508 if (((__SIZE_TYPE__)__p & 0xfff) >= 4096-15 &&
2509 ((__SIZE_TYPE__)__p & 0xfff) <= 4096-8) {
2510 // If there's a risk of spurious trap due to a 128-bit write, back up the
2511 // pointer by 8 bytes and shift values in registers to match.
2512 __p -= 8;
2513 __d128 = (__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)__d128, 8);
2514 __n128 = (__m128i)__builtin_ia32_pslldqi128_byteshift((__v16qi)__n128, 8);
2515 }
2516
2517 __builtin_ia32_maskmovdqu((__v16qi)__d128, (__v16qi)__n128, __p);
2518}
2519
2520/// Computes the rounded averages of the packed unsigned 8-bit integer
2521/// values and writes the averages to the corresponding bits in the
2522/// destination.
2523///
2524/// \headerfile <x86intrin.h>
2525///
2526/// This intrinsic corresponds to the <c> PAVGB </c> instruction.
2527///
2528/// \param __a
2529/// A 64-bit integer vector containing one of the source operands.
2530/// \param __b
2531/// A 64-bit integer vector containing one of the source operands.
2532/// \returns A 64-bit integer vector containing the averages of both operands.
2533static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2534_mm_avg_pu8(__m64 __a, __m64 __b) {
2535 return __trunc64(__builtin_ia32_pavgb128((__v16qu)__zext128(__a),
2536 (__v16qu)__zext128(__b)));
2537}
2538
2539/// Computes the rounded averages of the packed unsigned 16-bit integer
2540/// values and writes the averages to the corresponding bits in the
2541/// destination.
2542///
2543/// \headerfile <x86intrin.h>
2544///
2545/// This intrinsic corresponds to the <c> PAVGW </c> instruction.
2546///
2547/// \param __a
2548/// A 64-bit integer vector containing one of the source operands.
2549/// \param __b
2550/// A 64-bit integer vector containing one of the source operands.
2551/// \returns A 64-bit integer vector containing the averages of both operands.
2552static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2553_mm_avg_pu16(__m64 __a, __m64 __b) {
2554 return __trunc64(
2555 __builtin_ia32_pavgw128((__v8hu)__zext128(__a), (__v8hu)__zext128(__b)));
2556}
2557
2558/// Subtracts the corresponding 8-bit unsigned integer values of the two
2559/// 64-bit vector operands and computes the absolute value for each of the
2560/// difference. Then sum of the 8 absolute differences is written to the
2561/// bits [15:0] of the destination; the remaining bits [63:16] are cleared.
2562///
2563/// \headerfile <x86intrin.h>
2564///
2565/// This intrinsic corresponds to the <c> PSADBW </c> instruction.
2566///
2567/// \param __a
2568/// A 64-bit integer vector containing one of the source operands.
2569/// \param __b
2570/// A 64-bit integer vector containing one of the source operands.
2571/// \returns A 64-bit integer vector whose lower 16 bits contain the sums of the
2572/// sets of absolute differences between both operands. The upper bits are
2573/// cleared.
2574static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2575_mm_sad_pu8(__m64 __a, __m64 __b)
2576{
2577 return __trunc64(__builtin_ia32_psadbw128((__v16qi)__zext128(__a),
2578 (__v16qi)__zext128(__b)));
2579}
2580
2581#if defined(__cplusplus)
2582extern "C" {
2583#endif
2584
2585/// Returns the contents of the MXCSR register as a 32-bit unsigned
2586/// integer value.
2587///
2588/// There are several groups of macros associated with this
2589/// intrinsic, including:
2590/// <ul>
2591/// <li>
2592/// For checking exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO,
2593/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW,
2594/// _MM_EXCEPT_INEXACT. There is a convenience wrapper
2595/// _MM_GET_EXCEPTION_STATE().
2596/// </li>
2597/// <li>
2598/// For checking exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW,
2599/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT.
2600/// There is a convenience wrapper _MM_GET_EXCEPTION_MASK().
2601/// </li>
2602/// <li>
2603/// For checking rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN,
2604/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper
2605/// _MM_GET_ROUNDING_MODE().
2606/// </li>
2607/// <li>
2608/// For checking flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF.
2609/// There is a convenience wrapper _MM_GET_FLUSH_ZERO_MODE().
2610/// </li>
2611/// <li>
2612/// For checking denormals-are-zero mode: _MM_DENORMALS_ZERO_ON,
2613/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper
2614/// _MM_GET_DENORMALS_ZERO_MODE().
2615/// </li>
2616/// </ul>
2617///
2618/// For example, the following expression checks if an overflow exception has
2619/// occurred:
2620/// \code
2621/// ( _mm_getcsr() & _MM_EXCEPT_OVERFLOW )
2622/// \endcode
2623///
2624/// The following expression gets the current rounding mode:
2625/// \code
2626/// _MM_GET_ROUNDING_MODE()
2627/// \endcode
2628///
2629/// \headerfile <x86intrin.h>
2630///
2631/// This intrinsic corresponds to the <c> VSTMXCSR / STMXCSR </c> instruction.
2632///
2633/// \returns A 32-bit unsigned integer containing the contents of the MXCSR
2634/// register.
2635unsigned int _mm_getcsr(void);
2636
2637/// Sets the MXCSR register with the 32-bit unsigned integer value.
2638///
2639/// There are several groups of macros associated with this intrinsic,
2640/// including:
2641/// <ul>
2642/// <li>
2643/// For setting exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO,
2644/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW,
2645/// _MM_EXCEPT_INEXACT. There is a convenience wrapper
2646/// _MM_SET_EXCEPTION_STATE(x) where x is one of these macros.
2647/// </li>
2648/// <li>
2649/// For setting exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW,
2650/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT.
2651/// There is a convenience wrapper _MM_SET_EXCEPTION_MASK(x) where x is one
2652/// of these macros.
2653/// </li>
2654/// <li>
2655/// For setting rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN,
2656/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper
2657/// _MM_SET_ROUNDING_MODE(x) where x is one of these macros.
2658/// </li>
2659/// <li>
2660/// For setting flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF.
2661/// There is a convenience wrapper _MM_SET_FLUSH_ZERO_MODE(x) where x is
2662/// one of these macros.
2663/// </li>
2664/// <li>
2665/// For setting denormals-are-zero mode: _MM_DENORMALS_ZERO_ON,
2666/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper
2667/// _MM_SET_DENORMALS_ZERO_MODE(x) where x is one of these macros.
2668/// </li>
2669/// </ul>
2670///
2671/// For example, the following expression causes subsequent floating-point
2672/// operations to round up:
2673/// _mm_setcsr(_mm_getcsr() | _MM_ROUND_UP)
2674///
2675/// The following example sets the DAZ and FTZ flags:
2676/// \code
2677/// void setFlags() {
2678/// _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
2679/// _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
2680/// }
2681/// \endcode
2682///
2683/// \headerfile <x86intrin.h>
2684///
2685/// This intrinsic corresponds to the <c> VLDMXCSR / LDMXCSR </c> instruction.
2686///
2687/// \param __i
2688/// A 32-bit unsigned integer value to be written to the MXCSR register.
2689void _mm_setcsr(unsigned int __i);
2690
2691#if defined(__cplusplus)
2692} // extern "C"
2693#endif
2694
2695/// Selects 4 float values from the 128-bit operands of [4 x float], as
2696/// specified by the immediate value operand.
2697///
2698/// \headerfile <x86intrin.h>
2699///
2700/// \code
2701/// __m128 _mm_shuffle_ps(__m128 a, __m128 b, const int mask);
2702/// \endcode
2703///
2704/// This intrinsic corresponds to the <c> VSHUFPS / SHUFPS </c> instruction.
2705///
2706/// \param a
2707/// A 128-bit vector of [4 x float].
2708/// \param b
2709/// A 128-bit vector of [4 x float].
2710/// \param mask
2711/// An immediate value containing an 8-bit value specifying which elements to
2712/// copy from \a a and \a b. \n
2713/// Bits [3:0] specify the values copied from operand \a a. \n
2714/// Bits [7:4] specify the values copied from operand \a b. \n
2715/// The destinations within the 128-bit destination are assigned values as
2716/// follows: \n
2717/// Bits [1:0] are used to assign values to bits [31:0] in the
2718/// destination. \n
2719/// Bits [3:2] are used to assign values to bits [63:32] in the
2720/// destination. \n
2721/// Bits [5:4] are used to assign values to bits [95:64] in the
2722/// destination. \n
2723/// Bits [7:6] are used to assign values to bits [127:96] in the
2724/// destination. \n
2725/// Bit value assignments: \n
2726/// 00: Bits [31:0] copied from the specified operand. \n
2727/// 01: Bits [63:32] copied from the specified operand. \n
2728/// 10: Bits [95:64] copied from the specified operand. \n
2729/// 11: Bits [127:96] copied from the specified operand. \n
2730/// Note: To generate a mask, you can use the \c _MM_SHUFFLE macro.
2731/// <c>_MM_SHUFFLE(b6, b4, b2, b0)</c> can create an 8-bit mask of the form
2732/// <c>[b6, b4, b2, b0]</c>.
2733/// \returns A 128-bit vector of [4 x float] containing the shuffled values.
2734#define _mm_shuffle_ps(a, b, mask) \
2735 ((__m128)__builtin_ia32_shufps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), \
2736 (int)(mask)))
2737
2738/// Unpacks the high-order (index 2,3) values from two 128-bit vectors of
2739/// [4 x float] and interleaves them into a 128-bit vector of [4 x float].
2740///
2741/// \headerfile <x86intrin.h>
2742///
2743/// This intrinsic corresponds to the <c> VUNPCKHPS / UNPCKHPS </c> instruction.
2744///
2745/// \param __a
2746/// A 128-bit vector of [4 x float]. \n
2747/// Bits [95:64] are written to bits [31:0] of the destination. \n
2748/// Bits [127:96] are written to bits [95:64] of the destination.
2749/// \param __b
2750/// A 128-bit vector of [4 x float].
2751/// Bits [95:64] are written to bits [63:32] of the destination. \n
2752/// Bits [127:96] are written to bits [127:96] of the destination.
2753/// \returns A 128-bit vector of [4 x float] containing the interleaved values.
2754static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2755_mm_unpackhi_ps(__m128 __a, __m128 __b) {
2756 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 2, 6, 3, 7);
2757}
2758
2759/// Unpacks the low-order (index 0,1) values from two 128-bit vectors of
2760/// [4 x float] and interleaves them into a 128-bit vector of [4 x float].
2761///
2762/// \headerfile <x86intrin.h>
2763///
2764/// This intrinsic corresponds to the <c> VUNPCKLPS / UNPCKLPS </c> instruction.
2765///
2766/// \param __a
2767/// A 128-bit vector of [4 x float]. \n
2768/// Bits [31:0] are written to bits [31:0] of the destination. \n
2769/// Bits [63:32] are written to bits [95:64] of the destination.
2770/// \param __b
2771/// A 128-bit vector of [4 x float]. \n
2772/// Bits [31:0] are written to bits [63:32] of the destination. \n
2773/// Bits [63:32] are written to bits [127:96] of the destination.
2774/// \returns A 128-bit vector of [4 x float] containing the interleaved values.
2775static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2776_mm_unpacklo_ps(__m128 __a, __m128 __b) {
2777 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 4, 1, 5);
2778}
2779
2780/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2781/// 32 bits are set to the lower 32 bits of the second parameter. The upper
2782/// 96 bits are set to the upper 96 bits of the first parameter.
2783///
2784/// \headerfile <x86intrin.h>
2785///
2786/// This intrinsic corresponds to the <c> VBLENDPS / BLENDPS / MOVSS </c>
2787/// instruction.
2788///
2789/// \param __a
2790/// A 128-bit floating-point vector of [4 x float]. The upper 96 bits are
2791/// written to the upper 96 bits of the result.
2792/// \param __b
2793/// A 128-bit floating-point vector of [4 x float]. The lower 32 bits are
2794/// written to the lower 32 bits of the result.
2795/// \returns A 128-bit floating-point vector of [4 x float].
2796static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2797_mm_move_ss(__m128 __a, __m128 __b) {
2798 __a[0] = __b[0];
2799 return __a;
2800}
2801
2802/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2803/// 64 bits are set to the upper 64 bits of the second parameter. The upper
2804/// 64 bits are set to the upper 64 bits of the first parameter.
2805///
2806/// \headerfile <x86intrin.h>
2807///
2808/// This intrinsic corresponds to the <c> VUNPCKHPD / UNPCKHPD </c> instruction.
2809///
2810/// \param __a
2811/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are
2812/// written to the upper 64 bits of the result.
2813/// \param __b
2814/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are
2815/// written to the lower 64 bits of the result.
2816/// \returns A 128-bit floating-point vector of [4 x float].
2817static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2818_mm_movehl_ps(__m128 __a, __m128 __b) {
2819 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 6, 7, 2, 3);
2820}
2821
2822/// Constructs a 128-bit floating-point vector of [4 x float]. The lower
2823/// 64 bits are set to the lower 64 bits of the first parameter. The upper
2824/// 64 bits are set to the lower 64 bits of the second parameter.
2825///
2826/// \headerfile <x86intrin.h>
2827///
2828/// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction.
2829///
2830/// \param __a
2831/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are
2832/// written to the lower 64 bits of the result.
2833/// \param __b
2834/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are
2835/// written to the upper 64 bits of the result.
2836/// \returns A 128-bit floating-point vector of [4 x float].
2837static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
2838_mm_movelh_ps(__m128 __a, __m128 __b) {
2839 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 1, 4, 5);
2840}
2841
2842/// Converts a 64-bit vector of [4 x i16] into a 128-bit vector of [4 x
2843/// float].
2844///
2845/// \headerfile <x86intrin.h>
2846///
2847/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2848///
2849/// \param __a
2850/// A 64-bit vector of [4 x i16]. The elements of the destination are copied
2851/// from the corresponding elements in this operand.
2852/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2853/// values from the operand.
2854static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2856{
2857 return __builtin_convertvector((__v4hi)__a, __v4sf);
2858}
2859
2860/// Converts a 64-bit vector of 16-bit unsigned integer values into a
2861/// 128-bit vector of [4 x float].
2862///
2863/// \headerfile <x86intrin.h>
2864///
2865/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2866///
2867/// \param __a
2868/// A 64-bit vector of 16-bit unsigned integer values. The elements of the
2869/// destination are copied from the corresponding elements in this operand.
2870/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2871/// values from the operand.
2872static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2874{
2875 return __builtin_convertvector((__v4hu)__a, __v4sf);
2876}
2877
2878/// Converts the lower four 8-bit values from a 64-bit vector of [8 x i8]
2879/// into a 128-bit vector of [4 x float].
2880///
2881/// \headerfile <x86intrin.h>
2882///
2883/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2884///
2885/// \param __a
2886/// A 64-bit vector of [8 x i8]. The elements of the destination are copied
2887/// from the corresponding lower 4 elements in this operand.
2888/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2889/// values from the operand.
2890static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2892{
2893 return __builtin_convertvector(
2894 __builtin_shufflevector((__v8qs)__a, __extension__ (__v8qs){},
2895 0, 1, 2, 3), __v4sf);
2896}
2897
2898/// Converts the lower four unsigned 8-bit integer values from a 64-bit
2899/// vector of [8 x u8] into a 128-bit vector of [4 x float].
2900///
2901/// \headerfile <x86intrin.h>
2902///
2903/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2904///
2905/// \param __a
2906/// A 64-bit vector of unsigned 8-bit integer values. The elements of the
2907/// destination are copied from the corresponding lower 4 elements in this
2908/// operand.
2909/// \returns A 128-bit vector of [4 x float] containing the copied and converted
2910/// values from the source operand.
2911static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2913{
2914 return __builtin_convertvector(
2915 __builtin_shufflevector((__v8qu)__a, __extension__ (__v8qu){},
2916 0, 1, 2, 3), __v4sf);
2917}
2918
2919/// Converts the two 32-bit signed integer values from each 64-bit vector
2920/// operand of [2 x i32] into a 128-bit vector of [4 x float].
2921///
2922/// \headerfile <x86intrin.h>
2923///
2924/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction.
2925///
2926/// \param __a
2927/// A 64-bit vector of [2 x i32]. The lower elements of the destination are
2928/// copied from the elements in this operand.
2929/// \param __b
2930/// A 64-bit vector of [2 x i32]. The upper elements of the destination are
2931/// copied from the elements in this operand.
2932/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the
2933/// copied and converted values from the first operand. The upper 64 bits
2934/// contain the copied and converted values from the second operand.
2935static __inline__ __m128 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2937{
2938 return __builtin_convertvector(
2939 __builtin_shufflevector((__v2si)__a, (__v2si)__b,
2940 0, 1, 2, 3), __v4sf);
2941}
2942
2943/// Converts each single-precision floating-point element of a 128-bit
2944/// floating-point vector of [4 x float] into a 16-bit signed integer, and
2945/// packs the results into a 64-bit integer vector of [4 x i16].
2946///
2947/// If the floating-point element is NaN or infinity, or if the
2948/// floating-point element is greater than 0x7FFFFFFF or less than -0x8000,
2949/// it is converted to 0x8000. Otherwise if the floating-point element is
2950/// greater than 0x7FFF, it is converted to 0x7FFF.
2951///
2952/// \headerfile <x86intrin.h>
2953///
2954/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction.
2955///
2956/// \param __a
2957/// A 128-bit floating-point vector of [4 x float].
2958/// \returns A 64-bit integer vector of [4 x i16] containing the converted
2959/// values.
2960static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2962{
2963 return __trunc64(__builtin_ia32_packssdw128(
2964 (__v4si)__builtin_ia32_cvtps2dq((__v4sf)__a), (__v4si)_mm_setzero_ps()));
2965}
2966
2967/// Converts each single-precision floating-point element of a 128-bit
2968/// floating-point vector of [4 x float] into an 8-bit signed integer, and
2969/// packs the results into the lower 32 bits of a 64-bit integer vector of
2970/// [8 x i8]. The upper 32 bits of the vector are set to 0.
2971///
2972/// If the floating-point element is NaN or infinity, or if the
2973/// floating-point element is greater than 0x7FFFFFFF or less than -0x80, it
2974/// is converted to 0x80. Otherwise if the floating-point element is greater
2975/// than 0x7F, it is converted to 0x7F.
2976///
2977/// \headerfile <x86intrin.h>
2978///
2979/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction.
2980///
2981/// \param __a
2982/// 128-bit floating-point vector of [4 x float].
2983/// \returns A 64-bit integer vector of [8 x i8]. The lower 32 bits contain the
2984/// converted values and the uppper 32 bits are set to zero.
2985static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2987{
2988 __m64 __b, __c;
2989
2992
2993 return _mm_packs_pi16(__b, __c);
2994}
2995
2996/// Extracts the sign bits from each single-precision floating-point
2997/// element of a 128-bit floating-point vector of [4 x float] and returns the
2998/// sign bits in bits [0:3] of the result. Bits [31:4] of the result are set
2999/// to zero.
3000///
3001/// \headerfile <x86intrin.h>
3002///
3003/// This intrinsic corresponds to the <c> VMOVMSKPS / MOVMSKPS </c> instruction.
3004///
3005/// \param __a
3006/// A 128-bit floating-point vector of [4 x float].
3007/// \returns A 32-bit integer value. Bits [3:0] contain the sign bits from each
3008/// single-precision floating-point element of the parameter. Bits [31:4] are
3009/// set to zero.
3010static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR _mm_movemask_ps(__m128 __a) {
3011 return __builtin_ia32_movmskps((__v4sf)__a);
3012}
3013
3014/* Compare */
3015#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
3016#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */
3017#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */
3018#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */
3019#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */
3020#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */
3021#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */
3022#define _CMP_ORD_Q 0x07 /* Ordered (non-signaling) */
3023
3024/// Compares each of the corresponding values of two 128-bit vectors of
3025/// [4 x float], using the operation specified by the immediate integer
3026/// operand.
3027///
3028/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
3029/// If either value in a comparison is NaN, comparisons that are ordered
3030/// return false, and comparisons that are unordered return true.
3031///
3032/// \headerfile <x86intrin.h>
3033///
3034/// \code
3035/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
3036/// \endcode
3037///
3038/// This intrinsic corresponds to the <c> (V)CMPPS </c> instruction.
3039///
3040/// \param a
3041/// A 128-bit vector of [4 x float].
3042/// \param b
3043/// A 128-bit vector of [4 x float].
3044/// \param c
3045/// An immediate integer operand, with bits [4:0] specifying which comparison
3046/// operation to use: \n
3047/// 0x00: Equal (ordered, non-signaling) \n
3048/// 0x01: Less-than (ordered, signaling) \n
3049/// 0x02: Less-than-or-equal (ordered, signaling) \n
3050/// 0x03: Unordered (non-signaling) \n
3051/// 0x04: Not-equal (unordered, non-signaling) \n
3052/// 0x05: Not-less-than (unordered, signaling) \n
3053/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
3054/// 0x07: Ordered (non-signaling) \n
3055/// \returns A 128-bit vector of [4 x float] containing the comparison results.
3056#define _mm_cmp_ps(a, b, c) \
3057 ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c)))
3058
3059/// Compares each of the corresponding scalar values of two 128-bit
3060/// vectors of [4 x float], using the operation specified by the immediate
3061/// integer operand.
3062///
3063/// Each comparison returns 0x0 for false, 0xFFFFFFFF for true.
3064/// If either value in a comparison is NaN, comparisons that are ordered
3065/// return false, and comparisons that are unordered return true.
3066///
3067/// \headerfile <x86intrin.h>
3068///
3069/// \code
3070/// __m128 _mm_cmp_ss(__m128 a, __m128 b, const int c);
3071/// \endcode
3072///
3073/// This intrinsic corresponds to the <c> (V)CMPSS </c> instruction.
3074///
3075/// \param a
3076/// A 128-bit vector of [4 x float].
3077/// \param b
3078/// A 128-bit vector of [4 x float].
3079/// \param c
3080/// An immediate integer operand, with bits [4:0] specifying which comparison
3081/// operation to use: \n
3082/// 0x00: Equal (ordered, non-signaling) \n
3083/// 0x01: Less-than (ordered, signaling) \n
3084/// 0x02: Less-than-or-equal (ordered, signaling) \n
3085/// 0x03: Unordered (non-signaling) \n
3086/// 0x04: Not-equal (unordered, non-signaling) \n
3087/// 0x05: Not-less-than (unordered, signaling) \n
3088/// 0x06: Not-less-than-or-equal (unordered, signaling) \n
3089/// 0x07: Ordered (non-signaling) \n
3090/// \returns A 128-bit vector of [4 x float] containing the comparison results.
3091#define _mm_cmp_ss(a, b, c) \
3092 ((__m128)__builtin_ia32_cmpss((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c)))
3093
3094#define _MM_ALIGN16 __attribute__((aligned(16)))
3095
3096#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
3097
3098#define _MM_EXCEPT_INVALID (0x0001U)
3099#define _MM_EXCEPT_DENORM (0x0002U)
3100#define _MM_EXCEPT_DIV_ZERO (0x0004U)
3101#define _MM_EXCEPT_OVERFLOW (0x0008U)
3102#define _MM_EXCEPT_UNDERFLOW (0x0010U)
3103#define _MM_EXCEPT_INEXACT (0x0020U)
3104#define _MM_EXCEPT_MASK (0x003fU)
3105
3106#define _MM_MASK_INVALID (0x0080U)
3107#define _MM_MASK_DENORM (0x0100U)
3108#define _MM_MASK_DIV_ZERO (0x0200U)
3109#define _MM_MASK_OVERFLOW (0x0400U)
3110#define _MM_MASK_UNDERFLOW (0x0800U)
3111#define _MM_MASK_INEXACT (0x1000U)
3112#define _MM_MASK_MASK (0x1f80U)
3113
3114#define _MM_ROUND_NEAREST (0x0000U)
3115#define _MM_ROUND_DOWN (0x2000U)
3116#define _MM_ROUND_UP (0x4000U)
3117#define _MM_ROUND_TOWARD_ZERO (0x6000U)
3118#define _MM_ROUND_MASK (0x6000U)
3119
3120#define _MM_FLUSH_ZERO_MASK (0x8000U)
3121#define _MM_FLUSH_ZERO_ON (0x8000U)
3122#define _MM_FLUSH_ZERO_OFF (0x0000U)
3123
3124#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)
3125#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)
3126#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)
3127#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)
3128
3129#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))
3130#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))
3131#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))
3132#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))
3133
3134#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
3135do { \
3136 __m128 tmp3, tmp2, tmp1, tmp0; \
3137 tmp0 = _mm_unpacklo_ps((row0), (row1)); \
3138 tmp2 = _mm_unpacklo_ps((row2), (row3)); \
3139 tmp1 = _mm_unpackhi_ps((row0), (row1)); \
3140 tmp3 = _mm_unpackhi_ps((row2), (row3)); \
3141 (row0) = _mm_movelh_ps(tmp0, tmp2); \
3142 (row1) = _mm_movehl_ps(tmp2, tmp0); \
3143 (row2) = _mm_movelh_ps(tmp1, tmp3); \
3144 (row3) = _mm_movehl_ps(tmp3, tmp1); \
3145} while (0)
3146
3147/* Aliases for compatibility. */
3148#define _m_pextrw _mm_extract_pi16
3149#define _m_pinsrw _mm_insert_pi16
3150#define _m_pmaxsw _mm_max_pi16
3151#define _m_pmaxub _mm_max_pu8
3152#define _m_pminsw _mm_min_pi16
3153#define _m_pminub _mm_min_pu8
3154#define _m_pmovmskb _mm_movemask_pi8
3155#define _m_pmulhuw _mm_mulhi_pu16
3156#define _m_pshufw _mm_shuffle_pi16
3157#define _m_maskmovq _mm_maskmove_si64
3158#define _m_pavgb _mm_avg_pu8
3159#define _m_pavgw _mm_avg_pu16
3160#define _m_psadbw _mm_sad_pu8
3161#define _m_ _mm_
3162
3163#undef __trunc64
3164#undef __zext128
3165#undef __anyext128
3166#undef __zeroupper64
3167#undef __DEFAULT_FN_ATTRS
3168#undef __DEFAULT_FN_ATTRS_CONSTEXPR
3169#undef __DEFAULT_FN_ATTRS_SSE2
3170#undef __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
3171
3172/* Ugly hack for backwards-compatibility (compatible with gcc) */
3173#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics)
3174#include <emmintrin.h>
3175#endif
3176
3177#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 vector float __c
Definition altivec.h:4800
static __inline__ vector float vector float __b
Definition altivec.h:578
static __inline__ uint32_t volatile uint32_t * __p
Definition arm_acle.h: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:4077
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__ int __DEFAULT_FN_ATTRS _mm_cvttss_si32(__m128 __a)
Converts the lower (first) element of a vector of [4 x float] into a signed truncated (rounded toward...
Definition xmmintrin.h:1496
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:2553
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:2413
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:2797
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:1703
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__ __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:2855
#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:2534
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvt_ps2pi(__m128 __a)
Converts two low-order float values in a 128-bit vector of [4 x float] into a 64-bit vector of [2 x i...
Definition xmmintrin.h:1474
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvt_ss2si(__m128 __a)
Converts a float value contained in the lower 32 bits of a vector of [4 x float] into a 32-bit intege...
Definition xmmintrin.h:1408
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:1677
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:2431
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:1839
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:2936
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:2172
#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:1892
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:1973
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:1606
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:2776
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:1720
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__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sad_pu8(__m64 __a, __m64 __b)
Subtracts the corresponding 8-bit unsigned integer values of the two 64-bit vector operands and compu...
Definition xmmintrin.h:2575
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:2051
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:1947
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:2133
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:1628
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:1929
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:2755
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:2378
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:1767
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:2093
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:2818
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:1816
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:2250
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:2231
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__ int __DEFAULT_FN_ATTRS _mm_cvtss_si32(__m128 __a)
Converts a float value contained in the lower 32 bits of a vector of [4 x float] into a 32-bit intege...
Definition xmmintrin.h:1386
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:2342
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__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi16(__m128 __a)
Converts each single-precision floating-point element of a 128-bit floating-point vector of [4 x floa...
Definition xmmintrin.h:2961
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:2838
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:2072
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:1740
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:2891
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__ 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:2114
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:3010
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:2912
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:2873
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvttps_pi32(__m128 __a)
Converts the lower (first) two elements of a 128-bit vector of [4 x float] into two signed truncated ...
Definition xmmintrin.h:1564
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi32(__m128 __a)
Converts two low-order float values in a 128-bit vector of [4 x float] into a 64-bit vector of [2 x i...
Definition xmmintrin.h:1454
static __inline__ int __DEFAULT_FN_ATTRS _mm_cvtt_ss2si(__m128 __a)
Converts the lower (first) element of a vector of [4 x float] into a signed truncated (rounded toward...
Definition xmmintrin.h:1518
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtps_pi8(__m128 __a)
Converts each single-precision floating-point element of a 128-bit floating-point vector of [4 x floa...
Definition xmmintrin.h:2986
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:2360
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:1878
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:2030
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:2014
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
#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:2500
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:2153
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:2000
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__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_cvtt_ps2pi(__m128 __a)
Converts the lower (first) two elements of a 128-bit vector of [4 x float] into two signed truncated ...
Definition xmmintrin.h:1585
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:1912
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:2396
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__ __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__ __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:1856
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:1794
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