blob: b3b23cb7d0d4d6efc676c3296fa8f1ed5c45e4af [file] [log] [blame]
Ying Wanga6720142011-12-20 14:43:20 -08001/*===---- xmmintrin.h - SSE intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __XMMINTRIN_H
25#define __XMMINTRIN_H
26
27#ifndef __SSE__
28#error "SSE instruction set not enabled"
29#else
30
31#include <mmintrin.h>
32
33typedef int __v4si __attribute__((__vector_size__(16)));
34typedef float __v4sf __attribute__((__vector_size__(16)));
35typedef float __m128 __attribute__((__vector_size__(16)));
36
37// This header should only be included in a hosted environment as it depends on
38// a standard library to provide allocation routines.
39#if __STDC_HOSTED__
40#include <mm_malloc.h>
41#endif
42
43static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070044_mm_add_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080045{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070046 __a[0] += __b[0];
47 return __a;
Ying Wanga6720142011-12-20 14:43:20 -080048}
49
50static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070051_mm_add_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080052{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070053 return __a + __b;
Ying Wanga6720142011-12-20 14:43:20 -080054}
55
56static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070057_mm_sub_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080058{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070059 __a[0] -= __b[0];
60 return __a;
Ying Wanga6720142011-12-20 14:43:20 -080061}
62
63static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070064_mm_sub_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080065{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070066 return __a - __b;
Ying Wanga6720142011-12-20 14:43:20 -080067}
68
69static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070070_mm_mul_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080071{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070072 __a[0] *= __b[0];
73 return __a;
Ying Wanga6720142011-12-20 14:43:20 -080074}
75
76static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070077_mm_mul_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080078{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070079 return __a * __b;
Ying Wanga6720142011-12-20 14:43:20 -080080}
81
82static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070083_mm_div_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080084{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070085 __a[0] /= __b[0];
86 return __a;
Ying Wanga6720142011-12-20 14:43:20 -080087}
88
89static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070090_mm_div_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -080091{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070092 return __a / __b;
Ying Wanga6720142011-12-20 14:43:20 -080093}
94
95static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070096_mm_sqrt_ss(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -080097{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070098 __m128 __c = __builtin_ia32_sqrtss(__a);
99 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
Ying Wanga6720142011-12-20 14:43:20 -0800100}
101
102static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700103_mm_sqrt_ps(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800104{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700105 return __builtin_ia32_sqrtps(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800106}
107
108static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700109_mm_rcp_ss(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800110{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700111 __m128 __c = __builtin_ia32_rcpss(__a);
112 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
Ying Wanga6720142011-12-20 14:43:20 -0800113}
114
115static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700116_mm_rcp_ps(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800117{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700118 return __builtin_ia32_rcpps(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800119}
120
121static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700122_mm_rsqrt_ss(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800123{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700124 __m128 __c = __builtin_ia32_rsqrtss(__a);
125 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
Ying Wanga6720142011-12-20 14:43:20 -0800126}
127
128static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700129_mm_rsqrt_ps(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800130{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700131 return __builtin_ia32_rsqrtps(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800132}
133
134static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700135_mm_min_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800136{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700137 return __builtin_ia32_minss(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800138}
139
140static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700141_mm_min_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800142{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700143 return __builtin_ia32_minps(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800144}
145
146static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700147_mm_max_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800148{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700149 return __builtin_ia32_maxss(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800150}
151
152static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700153_mm_max_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800154{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700155 return __builtin_ia32_maxps(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800156}
157
158static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700159_mm_and_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800160{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700161 return (__m128)((__v4si)__a & (__v4si)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800162}
163
164static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700165_mm_andnot_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800166{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700167 return (__m128)(~(__v4si)__a & (__v4si)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800168}
169
170static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700171_mm_or_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800172{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700173 return (__m128)((__v4si)__a | (__v4si)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800174}
175
176static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700177_mm_xor_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800178{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700179 return (__m128)((__v4si)__a ^ (__v4si)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800180}
181
182static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700183_mm_cmpeq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800184{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700185 return (__m128)__builtin_ia32_cmpss(__a, __b, 0);
Ying Wanga6720142011-12-20 14:43:20 -0800186}
187
188static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700189_mm_cmpeq_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800190{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700191 return (__m128)__builtin_ia32_cmpps(__a, __b, 0);
Ying Wanga6720142011-12-20 14:43:20 -0800192}
193
194static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700195_mm_cmplt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800196{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700197 return (__m128)__builtin_ia32_cmpss(__a, __b, 1);
Ying Wanga6720142011-12-20 14:43:20 -0800198}
199
200static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700201_mm_cmplt_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800202{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700203 return (__m128)__builtin_ia32_cmpps(__a, __b, 1);
Ying Wanga6720142011-12-20 14:43:20 -0800204}
205
206static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700207_mm_cmple_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800208{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700209 return (__m128)__builtin_ia32_cmpss(__a, __b, 2);
Ying Wanga6720142011-12-20 14:43:20 -0800210}
211
212static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700213_mm_cmple_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800214{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700215 return (__m128)__builtin_ia32_cmpps(__a, __b, 2);
Ying Wanga6720142011-12-20 14:43:20 -0800216}
217
218static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700219_mm_cmpgt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800220{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700221 return (__m128)__builtin_ia32_cmpss(__b, __a, 1);
Ying Wanga6720142011-12-20 14:43:20 -0800222}
223
224static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700225_mm_cmpgt_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800226{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700227 return (__m128)__builtin_ia32_cmpps(__b, __a, 1);
Ying Wanga6720142011-12-20 14:43:20 -0800228}
229
230static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700231_mm_cmpge_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700233 return (__m128)__builtin_ia32_cmpss(__b, __a, 2);
Ying Wanga6720142011-12-20 14:43:20 -0800234}
235
236static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700237_mm_cmpge_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800238{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700239 return (__m128)__builtin_ia32_cmpps(__b, __a, 2);
Ying Wanga6720142011-12-20 14:43:20 -0800240}
241
242static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700243_mm_cmpneq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800244{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700245 return (__m128)__builtin_ia32_cmpss(__a, __b, 4);
Ying Wanga6720142011-12-20 14:43:20 -0800246}
247
248static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700249_mm_cmpneq_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800250{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700251 return (__m128)__builtin_ia32_cmpps(__a, __b, 4);
Ying Wanga6720142011-12-20 14:43:20 -0800252}
253
254static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700255_mm_cmpnlt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800256{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700257 return (__m128)__builtin_ia32_cmpss(__a, __b, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800258}
259
260static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700261_mm_cmpnlt_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800262{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700263 return (__m128)__builtin_ia32_cmpps(__a, __b, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800264}
265
266static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700267_mm_cmpnle_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800268{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700269 return (__m128)__builtin_ia32_cmpss(__a, __b, 6);
Ying Wanga6720142011-12-20 14:43:20 -0800270}
271
272static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700273_mm_cmpnle_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800274{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700275 return (__m128)__builtin_ia32_cmpps(__a, __b, 6);
Ying Wanga6720142011-12-20 14:43:20 -0800276}
277
278static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700279_mm_cmpngt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800280{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700281 return (__m128)__builtin_ia32_cmpss(__b, __a, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800282}
283
284static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700285_mm_cmpngt_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800286{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700287 return (__m128)__builtin_ia32_cmpps(__b, __a, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800288}
289
290static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700291_mm_cmpnge_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800292{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700293 return (__m128)__builtin_ia32_cmpss(__b, __a, 6);
Ying Wanga6720142011-12-20 14:43:20 -0800294}
295
296static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700297_mm_cmpnge_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800298{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700299 return (__m128)__builtin_ia32_cmpps(__b, __a, 6);
Ying Wanga6720142011-12-20 14:43:20 -0800300}
301
302static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700303_mm_cmpord_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800304{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700305 return (__m128)__builtin_ia32_cmpss(__a, __b, 7);
Ying Wanga6720142011-12-20 14:43:20 -0800306}
307
308static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700309_mm_cmpord_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800310{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700311 return (__m128)__builtin_ia32_cmpps(__a, __b, 7);
Ying Wanga6720142011-12-20 14:43:20 -0800312}
313
314static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700315_mm_cmpunord_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800316{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700317 return (__m128)__builtin_ia32_cmpss(__a, __b, 3);
Ying Wanga6720142011-12-20 14:43:20 -0800318}
319
320static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700321_mm_cmpunord_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800322{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700323 return (__m128)__builtin_ia32_cmpps(__a, __b, 3);
Ying Wanga6720142011-12-20 14:43:20 -0800324}
325
326static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700327_mm_comieq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800328{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700329 return __builtin_ia32_comieq(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800330}
331
332static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700333_mm_comilt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800334{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700335 return __builtin_ia32_comilt(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800336}
337
338static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700339_mm_comile_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800340{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700341 return __builtin_ia32_comile(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800342}
343
344static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700345_mm_comigt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800346{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700347 return __builtin_ia32_comigt(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800348}
349
350static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700351_mm_comige_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800352{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700353 return __builtin_ia32_comige(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800354}
355
356static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700357_mm_comineq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800358{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700359 return __builtin_ia32_comineq(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800360}
361
362static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700363_mm_ucomieq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800364{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700365 return __builtin_ia32_ucomieq(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800366}
367
368static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700369_mm_ucomilt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800370{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700371 return __builtin_ia32_ucomilt(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800372}
373
374static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700375_mm_ucomile_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800376{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700377 return __builtin_ia32_ucomile(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800378}
379
380static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700381_mm_ucomigt_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800382{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700383 return __builtin_ia32_ucomigt(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800384}
385
386static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700387_mm_ucomige_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800388{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700389 return __builtin_ia32_ucomige(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800390}
391
392static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700393_mm_ucomineq_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800394{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700395 return __builtin_ia32_ucomineq(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800396}
397
398static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700399_mm_cvtss_si32(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800400{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700401 return __builtin_ia32_cvtss2si(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800402}
403
404static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700405_mm_cvt_ss2si(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800406{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700407 return _mm_cvtss_si32(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800408}
409
410#ifdef __x86_64__
411
412static __inline__ long long __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700413_mm_cvtss_si64(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800414{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700415 return __builtin_ia32_cvtss2si64(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800416}
417
418#endif
419
420static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700421_mm_cvtps_pi32(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800422{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700423 return (__m64)__builtin_ia32_cvtps2pi(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800424}
425
426static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700427_mm_cvt_ps2pi(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800428{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700429 return _mm_cvtps_pi32(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800430}
431
432static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700433_mm_cvttss_si32(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800434{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700435 return __a[0];
Ying Wanga6720142011-12-20 14:43:20 -0800436}
437
438static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700439_mm_cvtt_ss2si(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800440{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700441 return _mm_cvttss_si32(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800442}
443
444static __inline__ long long __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700445_mm_cvttss_si64(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800446{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700447 return __a[0];
Ying Wanga6720142011-12-20 14:43:20 -0800448}
449
450static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700451_mm_cvttps_pi32(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800452{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700453 return (__m64)__builtin_ia32_cvttps2pi(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800454}
455
456static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700457_mm_cvtt_ps2pi(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800458{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700459 return _mm_cvttps_pi32(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800460}
461
462static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700463_mm_cvtsi32_ss(__m128 __a, int __b)
Ying Wanga6720142011-12-20 14:43:20 -0800464{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700465 __a[0] = __b;
466 return __a;
Ying Wanga6720142011-12-20 14:43:20 -0800467}
468
469static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700470_mm_cvt_si2ss(__m128 __a, int __b)
Ying Wanga6720142011-12-20 14:43:20 -0800471{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700472 return _mm_cvtsi32_ss(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800473}
474
475#ifdef __x86_64__
476
477static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700478_mm_cvtsi64_ss(__m128 __a, long long __b)
Ying Wanga6720142011-12-20 14:43:20 -0800479{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700480 __a[0] = __b;
481 return __a;
Ying Wanga6720142011-12-20 14:43:20 -0800482}
483
484#endif
485
486static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700487_mm_cvtpi32_ps(__m128 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800488{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700489 return __builtin_ia32_cvtpi2ps(__a, (__v2si)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800490}
491
492static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700493_mm_cvt_pi2ps(__m128 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800494{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700495 return _mm_cvtpi32_ps(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800496}
497
498static __inline__ float __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700499_mm_cvtss_f32(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800500{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700501 return __a[0];
Ying Wanga6720142011-12-20 14:43:20 -0800502}
503
504static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700505_mm_loadh_pi(__m128 __a, const __m64 *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800506{
507 typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));
508 struct __mm_loadh_pi_struct {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700509 __mm_loadh_pi_v2f32 __u;
Ying Wanga6720142011-12-20 14:43:20 -0800510 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700511 __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u;
512 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
513 return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800514}
515
516static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700517_mm_loadl_pi(__m128 __a, const __m64 *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800518{
519 typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));
520 struct __mm_loadl_pi_struct {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700521 __mm_loadl_pi_v2f32 __u;
Ying Wanga6720142011-12-20 14:43:20 -0800522 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700523 __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u;
524 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
525 return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
Ying Wanga6720142011-12-20 14:43:20 -0800526}
527
528static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700529_mm_load_ss(const float *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800530{
531 struct __mm_load_ss_struct {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700532 float __u;
Ying Wanga6720142011-12-20 14:43:20 -0800533 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700534 float __u = ((struct __mm_load_ss_struct*)__p)->__u;
535 return (__m128){ __u, 0, 0, 0 };
Ying Wanga6720142011-12-20 14:43:20 -0800536}
537
538static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700539_mm_load1_ps(const float *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800540{
541 struct __mm_load1_ps_struct {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700542 float __u;
Ying Wanga6720142011-12-20 14:43:20 -0800543 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700544 float __u = ((struct __mm_load1_ps_struct*)__p)->__u;
545 return (__m128){ __u, __u, __u, __u };
Ying Wanga6720142011-12-20 14:43:20 -0800546}
547
548#define _mm_load_ps1(p) _mm_load1_ps(p)
549
550static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700551_mm_load_ps(const float *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800552{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700553 return *(__m128*)__p;
Ying Wanga6720142011-12-20 14:43:20 -0800554}
555
556static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700557_mm_loadu_ps(const float *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800558{
559 struct __loadu_ps {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700560 __m128 __v;
Ying Wanga6720142011-12-20 14:43:20 -0800561 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700562 return ((struct __loadu_ps*)__p)->__v;
Ying Wanga6720142011-12-20 14:43:20 -0800563}
564
565static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700566_mm_loadr_ps(const float *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800567{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700568 __m128 __a = _mm_load_ps(__p);
569 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
Ying Wanga6720142011-12-20 14:43:20 -0800570}
571
572static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700573_mm_set_ss(float __w)
Ying Wanga6720142011-12-20 14:43:20 -0800574{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700575 return (__m128){ __w, 0, 0, 0 };
Ying Wanga6720142011-12-20 14:43:20 -0800576}
577
578static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700579_mm_set1_ps(float __w)
Ying Wanga6720142011-12-20 14:43:20 -0800580{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700581 return (__m128){ __w, __w, __w, __w };
Ying Wanga6720142011-12-20 14:43:20 -0800582}
583
584// Microsoft specific.
585static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700586_mm_set_ps1(float __w)
Ying Wanga6720142011-12-20 14:43:20 -0800587{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700588 return _mm_set1_ps(__w);
Ying Wanga6720142011-12-20 14:43:20 -0800589}
590
591static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700592_mm_set_ps(float __z, float __y, float __x, float __w)
Ying Wanga6720142011-12-20 14:43:20 -0800593{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700594 return (__m128){ __w, __x, __y, __z };
Ying Wanga6720142011-12-20 14:43:20 -0800595}
596
597static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700598_mm_setr_ps(float __z, float __y, float __x, float __w)
Ying Wanga6720142011-12-20 14:43:20 -0800599{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700600 return (__m128){ __z, __y, __x, __w };
Ying Wanga6720142011-12-20 14:43:20 -0800601}
602
603static __inline__ __m128 __attribute__((__always_inline__))
604_mm_setzero_ps(void)
605{
606 return (__m128){ 0, 0, 0, 0 };
607}
608
609static __inline__ void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700610_mm_storeh_pi(__m64 *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800611{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700612 __builtin_ia32_storehps((__v2si *)__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800613}
614
615static __inline__ void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700616_mm_storel_pi(__m64 *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800617{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700618 __builtin_ia32_storelps((__v2si *)__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800619}
620
621static __inline__ void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700622_mm_store_ss(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800623{
624 struct __mm_store_ss_struct {
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700625 float __u;
Ying Wanga6720142011-12-20 14:43:20 -0800626 } __attribute__((__packed__, __may_alias__));
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700627 ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
Ying Wanga6720142011-12-20 14:43:20 -0800628}
629
630static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700631_mm_storeu_ps(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800632{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700633 __builtin_ia32_storeups(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800634}
635
636static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700637_mm_store1_ps(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800638{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700639 __a = __builtin_shufflevector(__a, __a, 0, 0, 0, 0);
640 _mm_storeu_ps(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800641}
642
643static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700644_mm_store_ps1(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800645{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700646 return _mm_store1_ps(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800647}
648
649static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700650_mm_store_ps(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800651{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700652 *(__m128 *)__p = __a;
Ying Wanga6720142011-12-20 14:43:20 -0800653}
654
655static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700656_mm_storer_ps(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800657{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700658 __a = __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
659 _mm_store_ps(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800660}
661
662#define _MM_HINT_T0 3
663#define _MM_HINT_T1 2
664#define _MM_HINT_T2 1
665#define _MM_HINT_NTA 0
666
667/* FIXME: We have to #define this because "sel" must be a constant integer, and
668 Sema doesn't do any form of constant propagation yet. */
669
Ying Wang60999142013-01-07 13:59:36 -0800670#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
Ying Wanga6720142011-12-20 14:43:20 -0800671
672static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700673_mm_stream_pi(__m64 *__p, __m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800674{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700675 __builtin_ia32_movntq(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800676}
677
678static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700679_mm_stream_ps(float *__p, __m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800680{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700681 __builtin_ia32_movntps(__p, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800682}
683
684static __inline__ void __attribute__((__always_inline__, __nodebug__))
685_mm_sfence(void)
686{
687 __builtin_ia32_sfence();
688}
689
690static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700691_mm_extract_pi16(__m64 __a, int __n)
Ying Wanga6720142011-12-20 14:43:20 -0800692{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700693 __v4hi __b = (__v4hi)__a;
694 return (unsigned short)__b[__n & 3];
Ying Wanga6720142011-12-20 14:43:20 -0800695}
696
697static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700698_mm_insert_pi16(__m64 __a, int __d, int __n)
Ying Wanga6720142011-12-20 14:43:20 -0800699{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700700 __v4hi __b = (__v4hi)__a;
701 __b[__n & 3] = __d;
702 return (__m64)__b;
Ying Wanga6720142011-12-20 14:43:20 -0800703}
704
705static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700706_mm_max_pi16(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800707{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700708 return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800709}
710
711static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700712_mm_max_pu8(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800713{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700714 return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800715}
716
717static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700718_mm_min_pi16(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800719{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700720 return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800721}
722
723static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700724_mm_min_pu8(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800725{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700726 return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800727}
728
729static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700730_mm_movemask_pi8(__m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800731{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700732 return __builtin_ia32_pmovmskb((__v8qi)__a);
Ying Wanga6720142011-12-20 14:43:20 -0800733}
734
735static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700736_mm_mulhi_pu16(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800737{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700738 return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800739}
740
Ying Wang60999142013-01-07 13:59:36 -0800741#define _mm_shuffle_pi16(a, n) __extension__ ({ \
742 __m64 __a = (a); \
743 (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); })
Ying Wanga6720142011-12-20 14:43:20 -0800744
745static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700746_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
Ying Wanga6720142011-12-20 14:43:20 -0800747{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700748 __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p);
Ying Wanga6720142011-12-20 14:43:20 -0800749}
750
751static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700752_mm_avg_pu8(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800753{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700754 return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800755}
756
757static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700758_mm_avg_pu16(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800759{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700760 return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800761}
762
763static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700764_mm_sad_pu8(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800765{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700766 return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b);
Ying Wanga6720142011-12-20 14:43:20 -0800767}
768
769static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
770_mm_getcsr(void)
771{
772 return __builtin_ia32_stmxcsr();
773}
774
775static __inline__ void __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700776_mm_setcsr(unsigned int __i)
Ying Wanga6720142011-12-20 14:43:20 -0800777{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700778 __builtin_ia32_ldmxcsr(__i);
Ying Wanga6720142011-12-20 14:43:20 -0800779}
780
Ying Wang60999142013-01-07 13:59:36 -0800781#define _mm_shuffle_ps(a, b, mask) __extension__ ({ \
782 __m128 __a = (a); \
783 __m128 __b = (b); \
784 (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \
785 (mask) & 0x3, ((mask) & 0xc) >> 2, \
786 (((mask) & 0x30) >> 4) + 4, \
787 (((mask) & 0xc0) >> 6) + 4); })
Ying Wanga6720142011-12-20 14:43:20 -0800788
789static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700790_mm_unpackhi_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800791{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700792 return __builtin_shufflevector(__a, __b, 2, 6, 3, 7);
Ying Wanga6720142011-12-20 14:43:20 -0800793}
794
795static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700796_mm_unpacklo_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800797{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700798 return __builtin_shufflevector(__a, __b, 0, 4, 1, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800799}
800
801static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700802_mm_move_ss(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800803{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700804 return __builtin_shufflevector(__a, __b, 4, 1, 2, 3);
Ying Wanga6720142011-12-20 14:43:20 -0800805}
806
807static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700808_mm_movehl_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800809{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700810 return __builtin_shufflevector(__a, __b, 6, 7, 2, 3);
Ying Wanga6720142011-12-20 14:43:20 -0800811}
812
813static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700814_mm_movelh_ps(__m128 __a, __m128 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800815{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700816 return __builtin_shufflevector(__a, __b, 0, 1, 4, 5);
Ying Wanga6720142011-12-20 14:43:20 -0800817}
818
819static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700820_mm_cvtpi16_ps(__m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800821{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700822 __m64 __b, __c;
823 __m128 __r;
Ying Wanga6720142011-12-20 14:43:20 -0800824
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700825 __b = _mm_setzero_si64();
826 __b = _mm_cmpgt_pi16(__b, __a);
827 __c = _mm_unpackhi_pi16(__a, __b);
828 __r = _mm_setzero_ps();
829 __r = _mm_cvtpi32_ps(__r, __c);
830 __r = _mm_movelh_ps(__r, __r);
831 __c = _mm_unpacklo_pi16(__a, __b);
832 __r = _mm_cvtpi32_ps(__r, __c);
Ying Wanga6720142011-12-20 14:43:20 -0800833
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700834 return __r;
Ying Wanga6720142011-12-20 14:43:20 -0800835}
836
837static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700838_mm_cvtpu16_ps(__m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800839{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700840 __m64 __b, __c;
841 __m128 __r;
Ying Wanga6720142011-12-20 14:43:20 -0800842
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700843 __b = _mm_setzero_si64();
844 __c = _mm_unpackhi_pi16(__a, __b);
845 __r = _mm_setzero_ps();
846 __r = _mm_cvtpi32_ps(__r, __c);
847 __r = _mm_movelh_ps(__r, __r);
848 __c = _mm_unpacklo_pi16(__a, __b);
849 __r = _mm_cvtpi32_ps(__r, __c);
Ying Wanga6720142011-12-20 14:43:20 -0800850
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700851 return __r;
Ying Wanga6720142011-12-20 14:43:20 -0800852}
853
854static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700855_mm_cvtpi8_ps(__m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800856{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700857 __m64 __b;
Ying Wanga6720142011-12-20 14:43:20 -0800858
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700859 __b = _mm_setzero_si64();
860 __b = _mm_cmpgt_pi8(__b, __a);
861 __b = _mm_unpacklo_pi8(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800862
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700863 return _mm_cvtpi16_ps(__b);
Ying Wanga6720142011-12-20 14:43:20 -0800864}
865
866static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700867_mm_cvtpu8_ps(__m64 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800868{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700869 __m64 __b;
Ying Wanga6720142011-12-20 14:43:20 -0800870
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700871 __b = _mm_setzero_si64();
872 __b = _mm_unpacklo_pi8(__a, __b);
Ying Wanga6720142011-12-20 14:43:20 -0800873
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700874 return _mm_cvtpi16_ps(__b);
Ying Wanga6720142011-12-20 14:43:20 -0800875}
876
877static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700878_mm_cvtpi32x2_ps(__m64 __a, __m64 __b)
Ying Wanga6720142011-12-20 14:43:20 -0800879{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700880 __m128 __c;
Ying Wanga6720142011-12-20 14:43:20 -0800881
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700882 __c = _mm_setzero_ps();
883 __c = _mm_cvtpi32_ps(__c, __b);
884 __c = _mm_movelh_ps(__c, __c);
Ying Wanga6720142011-12-20 14:43:20 -0800885
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700886 return _mm_cvtpi32_ps(__c, __a);
Ying Wanga6720142011-12-20 14:43:20 -0800887}
888
889static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700890_mm_cvtps_pi16(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800891{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700892 __m64 __b, __c;
Ying Wanga6720142011-12-20 14:43:20 -0800893
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700894 __b = _mm_cvtps_pi32(__a);
895 __a = _mm_movehl_ps(__a, __a);
896 __c = _mm_cvtps_pi32(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800897
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700898 return _mm_packs_pi16(__b, __c);
Ying Wanga6720142011-12-20 14:43:20 -0800899}
900
901static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700902_mm_cvtps_pi8(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800903{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700904 __m64 __b, __c;
Ying Wanga6720142011-12-20 14:43:20 -0800905
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700906 __b = _mm_cvtps_pi16(__a);
907 __c = _mm_setzero_si64();
Ying Wanga6720142011-12-20 14:43:20 -0800908
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700909 return _mm_packs_pi16(__b, __c);
Ying Wanga6720142011-12-20 14:43:20 -0800910}
911
912static __inline__ int __attribute__((__always_inline__, __nodebug__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700913_mm_movemask_ps(__m128 __a)
Ying Wanga6720142011-12-20 14:43:20 -0800914{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700915 return __builtin_ia32_movmskps(__a);
Ying Wanga6720142011-12-20 14:43:20 -0800916}
917
918#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
919
920#define _MM_EXCEPT_INVALID (0x0001)
921#define _MM_EXCEPT_DENORM (0x0002)
922#define _MM_EXCEPT_DIV_ZERO (0x0004)
923#define _MM_EXCEPT_OVERFLOW (0x0008)
924#define _MM_EXCEPT_UNDERFLOW (0x0010)
925#define _MM_EXCEPT_INEXACT (0x0020)
926#define _MM_EXCEPT_MASK (0x003f)
927
928#define _MM_MASK_INVALID (0x0080)
929#define _MM_MASK_DENORM (0x0100)
930#define _MM_MASK_DIV_ZERO (0x0200)
931#define _MM_MASK_OVERFLOW (0x0400)
932#define _MM_MASK_UNDERFLOW (0x0800)
933#define _MM_MASK_INEXACT (0x1000)
934#define _MM_MASK_MASK (0x1f80)
935
936#define _MM_ROUND_NEAREST (0x0000)
937#define _MM_ROUND_DOWN (0x2000)
938#define _MM_ROUND_UP (0x4000)
939#define _MM_ROUND_TOWARD_ZERO (0x6000)
940#define _MM_ROUND_MASK (0x6000)
941
942#define _MM_FLUSH_ZERO_MASK (0x8000)
943#define _MM_FLUSH_ZERO_ON (0x8000)
Ying Wang60999142013-01-07 13:59:36 -0800944#define _MM_FLUSH_ZERO_OFF (0x0000)
Ying Wanga6720142011-12-20 14:43:20 -0800945
946#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)
947#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)
948#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)
949#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)
950
951#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))
952#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))
953#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))
954#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))
955
956#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
957do { \
958 __m128 tmp3, tmp2, tmp1, tmp0; \
959 tmp0 = _mm_unpacklo_ps((row0), (row1)); \
960 tmp2 = _mm_unpacklo_ps((row2), (row3)); \
961 tmp1 = _mm_unpackhi_ps((row0), (row1)); \
962 tmp3 = _mm_unpackhi_ps((row2), (row3)); \
963 (row0) = _mm_movelh_ps(tmp0, tmp2); \
964 (row1) = _mm_movehl_ps(tmp2, tmp0); \
965 (row2) = _mm_movelh_ps(tmp1, tmp3); \
966 (row3) = _mm_movehl_ps(tmp3, tmp1); \
967} while (0)
968
969/* Aliases for compatibility. */
970#define _m_pextrw _mm_extract_pi16
971#define _m_pinsrw _mm_insert_pi16
972#define _m_pmaxsw _mm_max_pi16
973#define _m_pmaxub _mm_max_pu8
974#define _m_pminsw _mm_min_pi16
975#define _m_pminub _mm_min_pu8
976#define _m_pmovmskb _mm_movemask_pi8
977#define _m_pmulhuw _mm_mulhi_pu16
978#define _m_pshufw _mm_shuffle_pi16
979#define _m_maskmovq _mm_maskmove_si64
980#define _m_pavgb _mm_avg_pu8
981#define _m_pavgw _mm_avg_pu16
982#define _m_psadbw _mm_sad_pu8
983#define _m_ _mm_
984#define _m_ _mm_
985
986/* Ugly hack for backwards-compatibility (compatible with gcc) */
987#ifdef __SSE2__
988#include <emmintrin.h>
989#endif
990
991#endif /* __SSE__ */
992
993#endif /* __XMMINTRIN_H */