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