1 /* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING. If not, write to
17 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. */
20 /* As a special exception, if you include this header file into source
21 files compiled by GCC, this header file does not by itself cause
22 the resulting executable to be covered by the GNU General Public
23 License. This exception does not however invalidate any other
24 reasons why the executable file might be covered by the GNU General
27 /* Implemented from the specification included in the Intel C++ Compiler
28 User Guide and Reference, version 9.0. */
30 #ifndef _EMMINTRIN_H_INCLUDED
31 #define _EMMINTRIN_H_INCLUDED
34 # error "SSE2 instruction set not enabled"
37 /* We need definitions from the SSE header files*/
38 #include <xmmintrin.h>
41 typedef double __v2df
__attribute__ ((__vector_size__ (16)));
42 typedef long long __v2di
__attribute__ ((__vector_size__ (16)));
43 typedef int __v4si
__attribute__ ((__vector_size__ (16)));
44 typedef short __v8hi
__attribute__ ((__vector_size__ (16)));
45 typedef char __v16qi
__attribute__ ((__vector_size__ (16)));
47 /* The Intel API is flexible enough that we must allow aliasing with other
48 vector types, and their scalar components. */
49 typedef long long __m128i
__attribute__ ((__vector_size__ (16), __may_alias__
));
50 typedef double __m128d
__attribute__ ((__vector_size__ (16), __may_alias__
));
52 /* Create a selector for use with the SHUFPD instruction. */
53 #define _MM_SHUFFLE2(fp1,fp0) \
54 (((fp1) << 1) | (fp0))
56 /* Create a vector with element 0 as F and the rest zero. */
57 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
58 _mm_set_sd (double __F
)
60 return __extension__ (__m128d
){ __F
, 0.0 };
63 /* Create a vector with both elements equal to F. */
64 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
65 _mm_set1_pd (double __F
)
67 return __extension__ (__m128d
){ __F
, __F
};
70 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
71 _mm_set_pd1 (double __F
)
73 return _mm_set1_pd (__F
);
76 /* Create a vector with the lower value X and upper value W. */
77 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
78 _mm_set_pd (double __W
, double __X
)
80 return __extension__ (__m128d
){ __X
, __W
};
83 /* Create a vector with the lower value W and upper value X. */
84 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
85 _mm_setr_pd (double __W
, double __X
)
87 return __extension__ (__m128d
){ __W
, __X
};
90 /* Create a vector of zeros. */
91 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
94 return __extension__ (__m128d
){ 0.0, 0.0 };
97 /* Sets the low DPFP value of A from the low value of B. */
98 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
99 _mm_move_sd (__m128d __A
, __m128d __B
)
101 return (__m128d
) __builtin_ia32_movsd ((__v2df
)__A
, (__v2df
)__B
);
104 /* Load two DPFP values from P. The address must be 16-byte aligned. */
105 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
106 _mm_load_pd (double const *__P
)
108 return *(__m128d
*)__P
;
111 /* Load two DPFP values from P. The address need not be 16-byte aligned. */
112 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
113 _mm_loadu_pd (double const *__P
)
115 return __builtin_ia32_loadupd (__P
);
118 /* Create a vector with all two elements equal to *P. */
119 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
120 _mm_load1_pd (double const *__P
)
122 return _mm_set1_pd (*__P
);
125 /* Create a vector with element 0 as *P and the rest zero. */
126 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
127 _mm_load_sd (double const *__P
)
129 return _mm_set_sd (*__P
);
132 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
133 _mm_load_pd1 (double const *__P
)
135 return _mm_load1_pd (__P
);
138 /* Load two DPFP values in reverse order. The address must be aligned. */
139 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
140 _mm_loadr_pd (double const *__P
)
142 __m128d __tmp
= _mm_load_pd (__P
);
143 return __builtin_ia32_shufpd (__tmp
, __tmp
, _MM_SHUFFLE2 (0,1));
146 /* Store two DPFP values. The address must be 16-byte aligned. */
147 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
148 _mm_store_pd (double *__P
, __m128d __A
)
150 *(__m128d
*)__P
= __A
;
153 /* Store two DPFP values. The address need not be 16-byte aligned. */
154 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
155 _mm_storeu_pd (double *__P
, __m128d __A
)
157 __builtin_ia32_storeupd (__P
, __A
);
160 /* Stores the lower DPFP value. */
161 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
162 _mm_store_sd (double *__P
, __m128d __A
)
164 *__P
= __builtin_ia32_vec_ext_v2df (__A
, 0);
167 extern __inline
double __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
168 _mm_cvtsd_f64 (__m128d __A
)
170 return __builtin_ia32_vec_ext_v2df (__A
, 0);
173 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
174 _mm_storel_pd (double *__P
, __m128d __A
)
176 _mm_store_sd (__P
, __A
);
179 /* Stores the upper DPFP value. */
180 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
181 _mm_storeh_pd (double *__P
, __m128d __A
)
183 *__P
= __builtin_ia32_vec_ext_v2df (__A
, 1);
186 /* Store the lower DPFP value across two words.
187 The address must be 16-byte aligned. */
188 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
189 _mm_store1_pd (double *__P
, __m128d __A
)
191 _mm_store_pd (__P
, __builtin_ia32_shufpd (__A
, __A
, _MM_SHUFFLE2 (0,0)));
194 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
195 _mm_store_pd1 (double *__P
, __m128d __A
)
197 _mm_store1_pd (__P
, __A
);
200 /* Store two DPFP values in reverse order. The address must be aligned. */
201 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
202 _mm_storer_pd (double *__P
, __m128d __A
)
204 _mm_store_pd (__P
, __builtin_ia32_shufpd (__A
, __A
, _MM_SHUFFLE2 (0,1)));
207 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
208 _mm_cvtsi128_si32 (__m128i __A
)
210 return __builtin_ia32_vec_ext_v4si ((__v4si
)__A
, 0);
214 /* Intel intrinsic. */
215 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
216 _mm_cvtsi128_si64 (__m128i __A
)
218 return __builtin_ia32_vec_ext_v2di ((__v2di
)__A
, 0);
221 /* Microsoft intrinsic. */
222 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
223 _mm_cvtsi128_si64x (__m128i __A
)
225 return __builtin_ia32_vec_ext_v2di ((__v2di
)__A
, 0);
229 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
230 _mm_add_pd (__m128d __A
, __m128d __B
)
232 return (__m128d
)__builtin_ia32_addpd ((__v2df
)__A
, (__v2df
)__B
);
235 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
236 _mm_add_sd (__m128d __A
, __m128d __B
)
238 return (__m128d
)__builtin_ia32_addsd ((__v2df
)__A
, (__v2df
)__B
);
241 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
242 _mm_sub_pd (__m128d __A
, __m128d __B
)
244 return (__m128d
)__builtin_ia32_subpd ((__v2df
)__A
, (__v2df
)__B
);
247 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
248 _mm_sub_sd (__m128d __A
, __m128d __B
)
250 return (__m128d
)__builtin_ia32_subsd ((__v2df
)__A
, (__v2df
)__B
);
253 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
254 _mm_mul_pd (__m128d __A
, __m128d __B
)
256 return (__m128d
)__builtin_ia32_mulpd ((__v2df
)__A
, (__v2df
)__B
);
259 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
260 _mm_mul_sd (__m128d __A
, __m128d __B
)
262 return (__m128d
)__builtin_ia32_mulsd ((__v2df
)__A
, (__v2df
)__B
);
265 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
266 _mm_div_pd (__m128d __A
, __m128d __B
)
268 return (__m128d
)__builtin_ia32_divpd ((__v2df
)__A
, (__v2df
)__B
);
271 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
272 _mm_div_sd (__m128d __A
, __m128d __B
)
274 return (__m128d
)__builtin_ia32_divsd ((__v2df
)__A
, (__v2df
)__B
);
277 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
278 _mm_sqrt_pd (__m128d __A
)
280 return (__m128d
)__builtin_ia32_sqrtpd ((__v2df
)__A
);
283 /* Return pair {sqrt (A[0), B[1]}. */
284 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
285 _mm_sqrt_sd (__m128d __A
, __m128d __B
)
287 __v2df __tmp
= __builtin_ia32_movsd ((__v2df
)__A
, (__v2df
)__B
);
288 return (__m128d
)__builtin_ia32_sqrtsd ((__v2df
)__tmp
);
291 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
292 _mm_min_pd (__m128d __A
, __m128d __B
)
294 return (__m128d
)__builtin_ia32_minpd ((__v2df
)__A
, (__v2df
)__B
);
297 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
298 _mm_min_sd (__m128d __A
, __m128d __B
)
300 return (__m128d
)__builtin_ia32_minsd ((__v2df
)__A
, (__v2df
)__B
);
303 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
304 _mm_max_pd (__m128d __A
, __m128d __B
)
306 return (__m128d
)__builtin_ia32_maxpd ((__v2df
)__A
, (__v2df
)__B
);
309 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
310 _mm_max_sd (__m128d __A
, __m128d __B
)
312 return (__m128d
)__builtin_ia32_maxsd ((__v2df
)__A
, (__v2df
)__B
);
315 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
316 _mm_and_pd (__m128d __A
, __m128d __B
)
318 return (__m128d
)__builtin_ia32_andpd ((__v2df
)__A
, (__v2df
)__B
);
321 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
322 _mm_andnot_pd (__m128d __A
, __m128d __B
)
324 return (__m128d
)__builtin_ia32_andnpd ((__v2df
)__A
, (__v2df
)__B
);
327 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
328 _mm_or_pd (__m128d __A
, __m128d __B
)
330 return (__m128d
)__builtin_ia32_orpd ((__v2df
)__A
, (__v2df
)__B
);
333 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
334 _mm_xor_pd (__m128d __A
, __m128d __B
)
336 return (__m128d
)__builtin_ia32_xorpd ((__v2df
)__A
, (__v2df
)__B
);
339 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
340 _mm_cmpeq_pd (__m128d __A
, __m128d __B
)
342 return (__m128d
)__builtin_ia32_cmpeqpd ((__v2df
)__A
, (__v2df
)__B
);
345 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
346 _mm_cmplt_pd (__m128d __A
, __m128d __B
)
348 return (__m128d
)__builtin_ia32_cmpltpd ((__v2df
)__A
, (__v2df
)__B
);
351 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
352 _mm_cmple_pd (__m128d __A
, __m128d __B
)
354 return (__m128d
)__builtin_ia32_cmplepd ((__v2df
)__A
, (__v2df
)__B
);
357 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
358 _mm_cmpgt_pd (__m128d __A
, __m128d __B
)
360 return (__m128d
)__builtin_ia32_cmpgtpd ((__v2df
)__A
, (__v2df
)__B
);
363 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
364 _mm_cmpge_pd (__m128d __A
, __m128d __B
)
366 return (__m128d
)__builtin_ia32_cmpgepd ((__v2df
)__A
, (__v2df
)__B
);
369 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
370 _mm_cmpneq_pd (__m128d __A
, __m128d __B
)
372 return (__m128d
)__builtin_ia32_cmpneqpd ((__v2df
)__A
, (__v2df
)__B
);
375 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
376 _mm_cmpnlt_pd (__m128d __A
, __m128d __B
)
378 return (__m128d
)__builtin_ia32_cmpnltpd ((__v2df
)__A
, (__v2df
)__B
);
381 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
382 _mm_cmpnle_pd (__m128d __A
, __m128d __B
)
384 return (__m128d
)__builtin_ia32_cmpnlepd ((__v2df
)__A
, (__v2df
)__B
);
387 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
388 _mm_cmpngt_pd (__m128d __A
, __m128d __B
)
390 return (__m128d
)__builtin_ia32_cmpngtpd ((__v2df
)__A
, (__v2df
)__B
);
393 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
394 _mm_cmpnge_pd (__m128d __A
, __m128d __B
)
396 return (__m128d
)__builtin_ia32_cmpngepd ((__v2df
)__A
, (__v2df
)__B
);
399 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
400 _mm_cmpord_pd (__m128d __A
, __m128d __B
)
402 return (__m128d
)__builtin_ia32_cmpordpd ((__v2df
)__A
, (__v2df
)__B
);
405 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
406 _mm_cmpunord_pd (__m128d __A
, __m128d __B
)
408 return (__m128d
)__builtin_ia32_cmpunordpd ((__v2df
)__A
, (__v2df
)__B
);
411 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
412 _mm_cmpeq_sd (__m128d __A
, __m128d __B
)
414 return (__m128d
)__builtin_ia32_cmpeqsd ((__v2df
)__A
, (__v2df
)__B
);
417 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
418 _mm_cmplt_sd (__m128d __A
, __m128d __B
)
420 return (__m128d
)__builtin_ia32_cmpltsd ((__v2df
)__A
, (__v2df
)__B
);
423 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
424 _mm_cmple_sd (__m128d __A
, __m128d __B
)
426 return (__m128d
)__builtin_ia32_cmplesd ((__v2df
)__A
, (__v2df
)__B
);
429 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
430 _mm_cmpgt_sd (__m128d __A
, __m128d __B
)
432 return (__m128d
) __builtin_ia32_movsd ((__v2df
) __A
,
434 __builtin_ia32_cmpltsd ((__v2df
) __B
,
439 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
440 _mm_cmpge_sd (__m128d __A
, __m128d __B
)
442 return (__m128d
) __builtin_ia32_movsd ((__v2df
) __A
,
444 __builtin_ia32_cmplesd ((__v2df
) __B
,
449 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
450 _mm_cmpneq_sd (__m128d __A
, __m128d __B
)
452 return (__m128d
)__builtin_ia32_cmpneqsd ((__v2df
)__A
, (__v2df
)__B
);
455 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
456 _mm_cmpnlt_sd (__m128d __A
, __m128d __B
)
458 return (__m128d
)__builtin_ia32_cmpnltsd ((__v2df
)__A
, (__v2df
)__B
);
461 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
462 _mm_cmpnle_sd (__m128d __A
, __m128d __B
)
464 return (__m128d
)__builtin_ia32_cmpnlesd ((__v2df
)__A
, (__v2df
)__B
);
467 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
468 _mm_cmpngt_sd (__m128d __A
, __m128d __B
)
470 return (__m128d
) __builtin_ia32_movsd ((__v2df
) __A
,
472 __builtin_ia32_cmpnltsd ((__v2df
) __B
,
477 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
478 _mm_cmpnge_sd (__m128d __A
, __m128d __B
)
480 return (__m128d
) __builtin_ia32_movsd ((__v2df
) __A
,
482 __builtin_ia32_cmpnlesd ((__v2df
) __B
,
487 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
488 _mm_cmpord_sd (__m128d __A
, __m128d __B
)
490 return (__m128d
)__builtin_ia32_cmpordsd ((__v2df
)__A
, (__v2df
)__B
);
493 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
494 _mm_cmpunord_sd (__m128d __A
, __m128d __B
)
496 return (__m128d
)__builtin_ia32_cmpunordsd ((__v2df
)__A
, (__v2df
)__B
);
499 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
500 _mm_comieq_sd (__m128d __A
, __m128d __B
)
502 return __builtin_ia32_comisdeq ((__v2df
)__A
, (__v2df
)__B
);
505 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
506 _mm_comilt_sd (__m128d __A
, __m128d __B
)
508 return __builtin_ia32_comisdlt ((__v2df
)__A
, (__v2df
)__B
);
511 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
512 _mm_comile_sd (__m128d __A
, __m128d __B
)
514 return __builtin_ia32_comisdle ((__v2df
)__A
, (__v2df
)__B
);
517 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
518 _mm_comigt_sd (__m128d __A
, __m128d __B
)
520 return __builtin_ia32_comisdgt ((__v2df
)__A
, (__v2df
)__B
);
523 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
524 _mm_comige_sd (__m128d __A
, __m128d __B
)
526 return __builtin_ia32_comisdge ((__v2df
)__A
, (__v2df
)__B
);
529 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
530 _mm_comineq_sd (__m128d __A
, __m128d __B
)
532 return __builtin_ia32_comisdneq ((__v2df
)__A
, (__v2df
)__B
);
535 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
536 _mm_ucomieq_sd (__m128d __A
, __m128d __B
)
538 return __builtin_ia32_ucomisdeq ((__v2df
)__A
, (__v2df
)__B
);
541 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
542 _mm_ucomilt_sd (__m128d __A
, __m128d __B
)
544 return __builtin_ia32_ucomisdlt ((__v2df
)__A
, (__v2df
)__B
);
547 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
548 _mm_ucomile_sd (__m128d __A
, __m128d __B
)
550 return __builtin_ia32_ucomisdle ((__v2df
)__A
, (__v2df
)__B
);
553 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
554 _mm_ucomigt_sd (__m128d __A
, __m128d __B
)
556 return __builtin_ia32_ucomisdgt ((__v2df
)__A
, (__v2df
)__B
);
559 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
560 _mm_ucomige_sd (__m128d __A
, __m128d __B
)
562 return __builtin_ia32_ucomisdge ((__v2df
)__A
, (__v2df
)__B
);
565 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
566 _mm_ucomineq_sd (__m128d __A
, __m128d __B
)
568 return __builtin_ia32_ucomisdneq ((__v2df
)__A
, (__v2df
)__B
);
571 /* Create a vector of Qi, where i is the element number. */
573 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
574 _mm_set_epi64x (long long __q1
, long long __q0
)
576 return __extension__ (__m128i
)(__v2di
){ __q0
, __q1
};
579 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
580 _mm_set_epi64 (__m64 __q1
, __m64 __q0
)
582 return _mm_set_epi64x ((long long)__q1
, (long long)__q0
);
585 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
586 _mm_set_epi32 (int __q3
, int __q2
, int __q1
, int __q0
)
588 return __extension__ (__m128i
)(__v4si
){ __q0
, __q1
, __q2
, __q3
};
591 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
592 _mm_set_epi16 (short __q7
, short __q6
, short __q5
, short __q4
,
593 short __q3
, short __q2
, short __q1
, short __q0
)
595 return __extension__ (__m128i
)(__v8hi
){
596 __q0
, __q1
, __q2
, __q3
, __q4
, __q5
, __q6
, __q7
};
599 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
600 _mm_set_epi8 (char __q15
, char __q14
, char __q13
, char __q12
,
601 char __q11
, char __q10
, char __q09
, char __q08
,
602 char __q07
, char __q06
, char __q05
, char __q04
,
603 char __q03
, char __q02
, char __q01
, char __q00
)
605 return __extension__ (__m128i
)(__v16qi
){
606 __q00
, __q01
, __q02
, __q03
, __q04
, __q05
, __q06
, __q07
,
607 __q08
, __q09
, __q10
, __q11
, __q12
, __q13
, __q14
, __q15
611 /* Set all of the elements of the vector to A. */
613 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
614 _mm_set1_epi64x (long long __A
)
616 return _mm_set_epi64x (__A
, __A
);
619 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
620 _mm_set1_epi64 (__m64 __A
)
622 return _mm_set_epi64 (__A
, __A
);
625 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
626 _mm_set1_epi32 (int __A
)
628 return _mm_set_epi32 (__A
, __A
, __A
, __A
);
631 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
632 _mm_set1_epi16 (short __A
)
634 return _mm_set_epi16 (__A
, __A
, __A
, __A
, __A
, __A
, __A
, __A
);
637 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
638 _mm_set1_epi8 (char __A
)
640 return _mm_set_epi8 (__A
, __A
, __A
, __A
, __A
, __A
, __A
, __A
,
641 __A
, __A
, __A
, __A
, __A
, __A
, __A
, __A
);
644 /* Create a vector of Qi, where i is the element number.
645 The parameter order is reversed from the _mm_set_epi* functions. */
647 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
648 _mm_setr_epi64 (__m64 __q0
, __m64 __q1
)
650 return _mm_set_epi64 (__q1
, __q0
);
653 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
654 _mm_setr_epi32 (int __q0
, int __q1
, int __q2
, int __q3
)
656 return _mm_set_epi32 (__q3
, __q2
, __q1
, __q0
);
659 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
660 _mm_setr_epi16 (short __q0
, short __q1
, short __q2
, short __q3
,
661 short __q4
, short __q5
, short __q6
, short __q7
)
663 return _mm_set_epi16 (__q7
, __q6
, __q5
, __q4
, __q3
, __q2
, __q1
, __q0
);
666 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
667 _mm_setr_epi8 (char __q00
, char __q01
, char __q02
, char __q03
,
668 char __q04
, char __q05
, char __q06
, char __q07
,
669 char __q08
, char __q09
, char __q10
, char __q11
,
670 char __q12
, char __q13
, char __q14
, char __q15
)
672 return _mm_set_epi8 (__q15
, __q14
, __q13
, __q12
, __q11
, __q10
, __q09
, __q08
,
673 __q07
, __q06
, __q05
, __q04
, __q03
, __q02
, __q01
, __q00
);
676 /* Create a vector with element 0 as *P and the rest zero. */
678 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
679 _mm_load_si128 (__m128i
const *__P
)
684 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
685 _mm_loadu_si128 (__m128i
const *__P
)
687 return (__m128i
) __builtin_ia32_loaddqu ((char const *)__P
);
690 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
691 _mm_loadl_epi64 (__m128i
const *__P
)
693 return _mm_set_epi64 ((__m64
)0LL, *(__m64
*)__P
);
696 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
697 _mm_store_si128 (__m128i
*__P
, __m128i __B
)
702 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
703 _mm_storeu_si128 (__m128i
*__P
, __m128i __B
)
705 __builtin_ia32_storedqu ((char *)__P
, (__v16qi
)__B
);
708 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
709 _mm_storel_epi64 (__m128i
*__P
, __m128i __B
)
711 *(long long *)__P
= __builtin_ia32_vec_ext_v2di ((__v2di
)__B
, 0);
714 extern __inline __m64
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
715 _mm_movepi64_pi64 (__m128i __B
)
717 return (__m64
) __builtin_ia32_vec_ext_v2di ((__v2di
)__B
, 0);
720 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
721 _mm_movpi64_epi64 (__m64 __A
)
723 return _mm_set_epi64 ((__m64
)0LL, __A
);
726 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
727 _mm_move_epi64 (__m128i __A
)
729 return (__m128i
)__builtin_ia32_movq128 ((__v2di
) __A
);
732 /* Create a vector of zeros. */
733 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
734 _mm_setzero_si128 (void)
736 return __extension__ (__m128i
)(__v4si
){ 0, 0, 0, 0 };
739 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
740 _mm_cvtepi32_pd (__m128i __A
)
742 return (__m128d
)__builtin_ia32_cvtdq2pd ((__v4si
) __A
);
745 extern __inline __m128
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
746 _mm_cvtepi32_ps (__m128i __A
)
748 return (__m128
)__builtin_ia32_cvtdq2ps ((__v4si
) __A
);
751 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
752 _mm_cvtpd_epi32 (__m128d __A
)
754 return (__m128i
)__builtin_ia32_cvtpd2dq ((__v2df
) __A
);
757 extern __inline __m64
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
758 _mm_cvtpd_pi32 (__m128d __A
)
760 return (__m64
)__builtin_ia32_cvtpd2pi ((__v2df
) __A
);
763 extern __inline __m128
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
764 _mm_cvtpd_ps (__m128d __A
)
766 return (__m128
)__builtin_ia32_cvtpd2ps ((__v2df
) __A
);
769 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
770 _mm_cvttpd_epi32 (__m128d __A
)
772 return (__m128i
)__builtin_ia32_cvttpd2dq ((__v2df
) __A
);
775 extern __inline __m64
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
776 _mm_cvttpd_pi32 (__m128d __A
)
778 return (__m64
)__builtin_ia32_cvttpd2pi ((__v2df
) __A
);
781 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
782 _mm_cvtpi32_pd (__m64 __A
)
784 return (__m128d
)__builtin_ia32_cvtpi2pd ((__v2si
) __A
);
787 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
788 _mm_cvtps_epi32 (__m128 __A
)
790 return (__m128i
)__builtin_ia32_cvtps2dq ((__v4sf
) __A
);
793 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
794 _mm_cvttps_epi32 (__m128 __A
)
796 return (__m128i
)__builtin_ia32_cvttps2dq ((__v4sf
) __A
);
799 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
800 _mm_cvtps_pd (__m128 __A
)
802 return (__m128d
)__builtin_ia32_cvtps2pd ((__v4sf
) __A
);
805 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
806 _mm_cvtsd_si32 (__m128d __A
)
808 return __builtin_ia32_cvtsd2si ((__v2df
) __A
);
812 /* Intel intrinsic. */
813 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
814 _mm_cvtsd_si64 (__m128d __A
)
816 return __builtin_ia32_cvtsd2si64 ((__v2df
) __A
);
819 /* Microsoft intrinsic. */
820 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
821 _mm_cvtsd_si64x (__m128d __A
)
823 return __builtin_ia32_cvtsd2si64 ((__v2df
) __A
);
827 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
828 _mm_cvttsd_si32 (__m128d __A
)
830 return __builtin_ia32_cvttsd2si ((__v2df
) __A
);
834 /* Intel intrinsic. */
835 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
836 _mm_cvttsd_si64 (__m128d __A
)
838 return __builtin_ia32_cvttsd2si64 ((__v2df
) __A
);
841 /* Microsoft intrinsic. */
842 extern __inline
long long __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
843 _mm_cvttsd_si64x (__m128d __A
)
845 return __builtin_ia32_cvttsd2si64 ((__v2df
) __A
);
849 extern __inline __m128
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
850 _mm_cvtsd_ss (__m128 __A
, __m128d __B
)
852 return (__m128
)__builtin_ia32_cvtsd2ss ((__v4sf
) __A
, (__v2df
) __B
);
855 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
856 _mm_cvtsi32_sd (__m128d __A
, int __B
)
858 return (__m128d
)__builtin_ia32_cvtsi2sd ((__v2df
) __A
, __B
);
862 /* Intel intrinsic. */
863 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
864 _mm_cvtsi64_sd (__m128d __A
, long long __B
)
866 return (__m128d
)__builtin_ia32_cvtsi642sd ((__v2df
) __A
, __B
);
869 /* Microsoft intrinsic. */
870 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
871 _mm_cvtsi64x_sd (__m128d __A
, long long __B
)
873 return (__m128d
)__builtin_ia32_cvtsi642sd ((__v2df
) __A
, __B
);
877 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
878 _mm_cvtss_sd (__m128d __A
, __m128 __B
)
880 return (__m128d
)__builtin_ia32_cvtss2sd ((__v2df
) __A
, (__v4sf
)__B
);
884 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
885 _mm_shuffle_pd(__m128d __A
, __m128d __B
, const int __mask
)
887 return (__m128d
)__builtin_ia32_shufpd ((__v2df
)__A
, (__v2df
)__B
, __mask
);
890 #define _mm_shuffle_pd(A, B, N) \
891 ((__m128d)__builtin_ia32_shufpd ((__v2df)(__m128d)(A), \
892 (__v2df)(__m128d)(B), (int)(N)))
895 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
896 _mm_unpackhi_pd (__m128d __A
, __m128d __B
)
898 return (__m128d
)__builtin_ia32_unpckhpd ((__v2df
)__A
, (__v2df
)__B
);
901 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
902 _mm_unpacklo_pd (__m128d __A
, __m128d __B
)
904 return (__m128d
)__builtin_ia32_unpcklpd ((__v2df
)__A
, (__v2df
)__B
);
907 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
908 _mm_loadh_pd (__m128d __A
, double const *__B
)
910 return (__m128d
)__builtin_ia32_loadhpd ((__v2df
)__A
, __B
);
913 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
914 _mm_loadl_pd (__m128d __A
, double const *__B
)
916 return (__m128d
)__builtin_ia32_loadlpd ((__v2df
)__A
, __B
);
919 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
920 _mm_movemask_pd (__m128d __A
)
922 return __builtin_ia32_movmskpd ((__v2df
)__A
);
925 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
926 _mm_packs_epi16 (__m128i __A
, __m128i __B
)
928 return (__m128i
)__builtin_ia32_packsswb128 ((__v8hi
)__A
, (__v8hi
)__B
);
931 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
932 _mm_packs_epi32 (__m128i __A
, __m128i __B
)
934 return (__m128i
)__builtin_ia32_packssdw128 ((__v4si
)__A
, (__v4si
)__B
);
937 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
938 _mm_packus_epi16 (__m128i __A
, __m128i __B
)
940 return (__m128i
)__builtin_ia32_packuswb128 ((__v8hi
)__A
, (__v8hi
)__B
);
943 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
944 _mm_unpackhi_epi8 (__m128i __A
, __m128i __B
)
946 return (__m128i
)__builtin_ia32_punpckhbw128 ((__v16qi
)__A
, (__v16qi
)__B
);
949 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
950 _mm_unpackhi_epi16 (__m128i __A
, __m128i __B
)
952 return (__m128i
)__builtin_ia32_punpckhwd128 ((__v8hi
)__A
, (__v8hi
)__B
);
955 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
956 _mm_unpackhi_epi32 (__m128i __A
, __m128i __B
)
958 return (__m128i
)__builtin_ia32_punpckhdq128 ((__v4si
)__A
, (__v4si
)__B
);
961 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
962 _mm_unpackhi_epi64 (__m128i __A
, __m128i __B
)
964 return (__m128i
)__builtin_ia32_punpckhqdq128 ((__v2di
)__A
, (__v2di
)__B
);
967 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
968 _mm_unpacklo_epi8 (__m128i __A
, __m128i __B
)
970 return (__m128i
)__builtin_ia32_punpcklbw128 ((__v16qi
)__A
, (__v16qi
)__B
);
973 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
974 _mm_unpacklo_epi16 (__m128i __A
, __m128i __B
)
976 return (__m128i
)__builtin_ia32_punpcklwd128 ((__v8hi
)__A
, (__v8hi
)__B
);
979 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
980 _mm_unpacklo_epi32 (__m128i __A
, __m128i __B
)
982 return (__m128i
)__builtin_ia32_punpckldq128 ((__v4si
)__A
, (__v4si
)__B
);
985 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
986 _mm_unpacklo_epi64 (__m128i __A
, __m128i __B
)
988 return (__m128i
)__builtin_ia32_punpcklqdq128 ((__v2di
)__A
, (__v2di
)__B
);
991 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
992 _mm_add_epi8 (__m128i __A
, __m128i __B
)
994 return (__m128i
)__builtin_ia32_paddb128 ((__v16qi
)__A
, (__v16qi
)__B
);
997 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
998 _mm_add_epi16 (__m128i __A
, __m128i __B
)
1000 return (__m128i
)__builtin_ia32_paddw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1003 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1004 _mm_add_epi32 (__m128i __A
, __m128i __B
)
1006 return (__m128i
)__builtin_ia32_paddd128 ((__v4si
)__A
, (__v4si
)__B
);
1009 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1010 _mm_add_epi64 (__m128i __A
, __m128i __B
)
1012 return (__m128i
)__builtin_ia32_paddq128 ((__v2di
)__A
, (__v2di
)__B
);
1015 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1016 _mm_adds_epi8 (__m128i __A
, __m128i __B
)
1018 return (__m128i
)__builtin_ia32_paddsb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1021 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1022 _mm_adds_epi16 (__m128i __A
, __m128i __B
)
1024 return (__m128i
)__builtin_ia32_paddsw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1027 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1028 _mm_adds_epu8 (__m128i __A
, __m128i __B
)
1030 return (__m128i
)__builtin_ia32_paddusb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1033 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1034 _mm_adds_epu16 (__m128i __A
, __m128i __B
)
1036 return (__m128i
)__builtin_ia32_paddusw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1039 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1040 _mm_sub_epi8 (__m128i __A
, __m128i __B
)
1042 return (__m128i
)__builtin_ia32_psubb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1045 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1046 _mm_sub_epi16 (__m128i __A
, __m128i __B
)
1048 return (__m128i
)__builtin_ia32_psubw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1051 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1052 _mm_sub_epi32 (__m128i __A
, __m128i __B
)
1054 return (__m128i
)__builtin_ia32_psubd128 ((__v4si
)__A
, (__v4si
)__B
);
1057 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1058 _mm_sub_epi64 (__m128i __A
, __m128i __B
)
1060 return (__m128i
)__builtin_ia32_psubq128 ((__v2di
)__A
, (__v2di
)__B
);
1063 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1064 _mm_subs_epi8 (__m128i __A
, __m128i __B
)
1066 return (__m128i
)__builtin_ia32_psubsb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1069 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1070 _mm_subs_epi16 (__m128i __A
, __m128i __B
)
1072 return (__m128i
)__builtin_ia32_psubsw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1075 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1076 _mm_subs_epu8 (__m128i __A
, __m128i __B
)
1078 return (__m128i
)__builtin_ia32_psubusb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1081 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1082 _mm_subs_epu16 (__m128i __A
, __m128i __B
)
1084 return (__m128i
)__builtin_ia32_psubusw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1087 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1088 _mm_madd_epi16 (__m128i __A
, __m128i __B
)
1090 return (__m128i
)__builtin_ia32_pmaddwd128 ((__v8hi
)__A
, (__v8hi
)__B
);
1093 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1094 _mm_mulhi_epi16 (__m128i __A
, __m128i __B
)
1096 return (__m128i
)__builtin_ia32_pmulhw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1099 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1100 _mm_mullo_epi16 (__m128i __A
, __m128i __B
)
1102 return (__m128i
)__builtin_ia32_pmullw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1105 extern __inline __m64
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1106 _mm_mul_su32 (__m64 __A
, __m64 __B
)
1108 return (__m64
)__builtin_ia32_pmuludq ((__v2si
)__A
, (__v2si
)__B
);
1111 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1112 _mm_mul_epu32 (__m128i __A
, __m128i __B
)
1114 return (__m128i
)__builtin_ia32_pmuludq128 ((__v4si
)__A
, (__v4si
)__B
);
1117 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1118 _mm_slli_epi16 (__m128i __A
, int __B
)
1120 return (__m128i
)__builtin_ia32_psllwi128 ((__v8hi
)__A
, __B
);
1123 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1124 _mm_slli_epi32 (__m128i __A
, int __B
)
1126 return (__m128i
)__builtin_ia32_pslldi128 ((__v4si
)__A
, __B
);
1129 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1130 _mm_slli_epi64 (__m128i __A
, int __B
)
1132 return (__m128i
)__builtin_ia32_psllqi128 ((__v2di
)__A
, __B
);
1135 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1136 _mm_srai_epi16 (__m128i __A
, int __B
)
1138 return (__m128i
)__builtin_ia32_psrawi128 ((__v8hi
)__A
, __B
);
1141 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1142 _mm_srai_epi32 (__m128i __A
, int __B
)
1144 return (__m128i
)__builtin_ia32_psradi128 ((__v4si
)__A
, __B
);
1148 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1149 _mm_srli_si128 (__m128i __A
, const int __N
)
1151 return (__m128i
)__builtin_ia32_psrldqi128 (__A
, __N
* 8);
1154 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1155 _mm_slli_si128 (__m128i __A
, const int __N
)
1157 return (__m128i
)__builtin_ia32_pslldqi128 (__A
, __N
* 8);
1160 #define _mm_srli_si128(A, N) \
1161 ((__m128i)__builtin_ia32_psrldqi128 ((__m128i)(A), (int)(N) * 8))
1162 #define _mm_slli_si128(A, N) \
1163 ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) * 8))
1166 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1167 _mm_srli_epi16 (__m128i __A
, int __B
)
1169 return (__m128i
)__builtin_ia32_psrlwi128 ((__v8hi
)__A
, __B
);
1172 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1173 _mm_srli_epi32 (__m128i __A
, int __B
)
1175 return (__m128i
)__builtin_ia32_psrldi128 ((__v4si
)__A
, __B
);
1178 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1179 _mm_srli_epi64 (__m128i __A
, int __B
)
1181 return (__m128i
)__builtin_ia32_psrlqi128 ((__v2di
)__A
, __B
);
1184 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1185 _mm_sll_epi16 (__m128i __A
, __m128i __B
)
1187 return (__m128i
)__builtin_ia32_psllw128((__v8hi
)__A
, (__v8hi
)__B
);
1190 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1191 _mm_sll_epi32 (__m128i __A
, __m128i __B
)
1193 return (__m128i
)__builtin_ia32_pslld128((__v4si
)__A
, (__v4si
)__B
);
1196 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1197 _mm_sll_epi64 (__m128i __A
, __m128i __B
)
1199 return (__m128i
)__builtin_ia32_psllq128((__v2di
)__A
, (__v2di
)__B
);
1202 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1203 _mm_sra_epi16 (__m128i __A
, __m128i __B
)
1205 return (__m128i
)__builtin_ia32_psraw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1208 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1209 _mm_sra_epi32 (__m128i __A
, __m128i __B
)
1211 return (__m128i
)__builtin_ia32_psrad128 ((__v4si
)__A
, (__v4si
)__B
);
1214 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1215 _mm_srl_epi16 (__m128i __A
, __m128i __B
)
1217 return (__m128i
)__builtin_ia32_psrlw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1220 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1221 _mm_srl_epi32 (__m128i __A
, __m128i __B
)
1223 return (__m128i
)__builtin_ia32_psrld128 ((__v4si
)__A
, (__v4si
)__B
);
1226 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1227 _mm_srl_epi64 (__m128i __A
, __m128i __B
)
1229 return (__m128i
)__builtin_ia32_psrlq128 ((__v2di
)__A
, (__v2di
)__B
);
1232 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1233 _mm_and_si128 (__m128i __A
, __m128i __B
)
1235 return (__m128i
)__builtin_ia32_pand128 ((__v2di
)__A
, (__v2di
)__B
);
1238 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1239 _mm_andnot_si128 (__m128i __A
, __m128i __B
)
1241 return (__m128i
)__builtin_ia32_pandn128 ((__v2di
)__A
, (__v2di
)__B
);
1244 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1245 _mm_or_si128 (__m128i __A
, __m128i __B
)
1247 return (__m128i
)__builtin_ia32_por128 ((__v2di
)__A
, (__v2di
)__B
);
1250 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1251 _mm_xor_si128 (__m128i __A
, __m128i __B
)
1253 return (__m128i
)__builtin_ia32_pxor128 ((__v2di
)__A
, (__v2di
)__B
);
1256 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1257 _mm_cmpeq_epi8 (__m128i __A
, __m128i __B
)
1259 return (__m128i
)__builtin_ia32_pcmpeqb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1262 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1263 _mm_cmpeq_epi16 (__m128i __A
, __m128i __B
)
1265 return (__m128i
)__builtin_ia32_pcmpeqw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1268 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1269 _mm_cmpeq_epi32 (__m128i __A
, __m128i __B
)
1271 return (__m128i
)__builtin_ia32_pcmpeqd128 ((__v4si
)__A
, (__v4si
)__B
);
1274 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1275 _mm_cmplt_epi8 (__m128i __A
, __m128i __B
)
1277 return (__m128i
)__builtin_ia32_pcmpgtb128 ((__v16qi
)__B
, (__v16qi
)__A
);
1280 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1281 _mm_cmplt_epi16 (__m128i __A
, __m128i __B
)
1283 return (__m128i
)__builtin_ia32_pcmpgtw128 ((__v8hi
)__B
, (__v8hi
)__A
);
1286 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1287 _mm_cmplt_epi32 (__m128i __A
, __m128i __B
)
1289 return (__m128i
)__builtin_ia32_pcmpgtd128 ((__v4si
)__B
, (__v4si
)__A
);
1292 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1293 _mm_cmpgt_epi8 (__m128i __A
, __m128i __B
)
1295 return (__m128i
)__builtin_ia32_pcmpgtb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1298 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1299 _mm_cmpgt_epi16 (__m128i __A
, __m128i __B
)
1301 return (__m128i
)__builtin_ia32_pcmpgtw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1304 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1305 _mm_cmpgt_epi32 (__m128i __A
, __m128i __B
)
1307 return (__m128i
)__builtin_ia32_pcmpgtd128 ((__v4si
)__A
, (__v4si
)__B
);
1311 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1312 _mm_extract_epi16 (__m128i
const __A
, int const __N
)
1314 return __builtin_ia32_vec_ext_v8hi ((__v8hi
)__A
, __N
);
1317 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1318 _mm_insert_epi16 (__m128i
const __A
, int const __D
, int const __N
)
1320 return (__m128i
) __builtin_ia32_vec_set_v8hi ((__v8hi
)__A
, __D
, __N
);
1323 #define _mm_extract_epi16(A, N) \
1324 ((int) __builtin_ia32_vec_ext_v8hi ((__v8hi)(__m128i)(A), (int)(N)))
1325 #define _mm_insert_epi16(A, D, N) \
1326 ((__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)(__m128i)(A), \
1327 (int)(D), (int)(N)))
1330 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1331 _mm_max_epi16 (__m128i __A
, __m128i __B
)
1333 return (__m128i
)__builtin_ia32_pmaxsw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1336 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1337 _mm_max_epu8 (__m128i __A
, __m128i __B
)
1339 return (__m128i
)__builtin_ia32_pmaxub128 ((__v16qi
)__A
, (__v16qi
)__B
);
1342 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1343 _mm_min_epi16 (__m128i __A
, __m128i __B
)
1345 return (__m128i
)__builtin_ia32_pminsw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1348 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1349 _mm_min_epu8 (__m128i __A
, __m128i __B
)
1351 return (__m128i
)__builtin_ia32_pminub128 ((__v16qi
)__A
, (__v16qi
)__B
);
1354 extern __inline
int __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1355 _mm_movemask_epi8 (__m128i __A
)
1357 return __builtin_ia32_pmovmskb128 ((__v16qi
)__A
);
1360 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1361 _mm_mulhi_epu16 (__m128i __A
, __m128i __B
)
1363 return (__m128i
)__builtin_ia32_pmulhuw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1367 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1368 _mm_shufflehi_epi16 (__m128i __A
, const int __mask
)
1370 return (__m128i
)__builtin_ia32_pshufhw ((__v8hi
)__A
, __mask
);
1373 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1374 _mm_shufflelo_epi16 (__m128i __A
, const int __mask
)
1376 return (__m128i
)__builtin_ia32_pshuflw ((__v8hi
)__A
, __mask
);
1379 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1380 _mm_shuffle_epi32 (__m128i __A
, const int __mask
)
1382 return (__m128i
)__builtin_ia32_pshufd ((__v4si
)__A
, __mask
);
1385 #define _mm_shufflehi_epi16(A, N) \
1386 ((__m128i)__builtin_ia32_pshufhw ((__v8hi)(__m128i)(A), (int)(N)))
1387 #define _mm_shufflelo_epi16(A, N) \
1388 ((__m128i)__builtin_ia32_pshuflw ((__v8hi)(__m128i)(A), (int)(N)))
1389 #define _mm_shuffle_epi32(A, N) \
1390 ((__m128i)__builtin_ia32_pshufd ((__v4si)(__m128i)(A), (int)(N)))
1393 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1394 _mm_maskmoveu_si128 (__m128i __A
, __m128i __B
, char *__C
)
1396 __builtin_ia32_maskmovdqu ((__v16qi
)__A
, (__v16qi
)__B
, __C
);
1399 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1400 _mm_avg_epu8 (__m128i __A
, __m128i __B
)
1402 return (__m128i
)__builtin_ia32_pavgb128 ((__v16qi
)__A
, (__v16qi
)__B
);
1405 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1406 _mm_avg_epu16 (__m128i __A
, __m128i __B
)
1408 return (__m128i
)__builtin_ia32_pavgw128 ((__v8hi
)__A
, (__v8hi
)__B
);
1411 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1412 _mm_sad_epu8 (__m128i __A
, __m128i __B
)
1414 return (__m128i
)__builtin_ia32_psadbw128 ((__v16qi
)__A
, (__v16qi
)__B
);
1417 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1418 _mm_stream_si32 (int *__A
, int __B
)
1420 __builtin_ia32_movnti (__A
, __B
);
1423 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1424 _mm_stream_si128 (__m128i
*__A
, __m128i __B
)
1426 __builtin_ia32_movntdq ((__v2di
*)__A
, (__v2di
)__B
);
1429 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1430 _mm_stream_pd (double *__A
, __m128d __B
)
1432 __builtin_ia32_movntpd (__A
, (__v2df
)__B
);
1435 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1436 _mm_clflush (void const *__A
)
1438 __builtin_ia32_clflush (__A
);
1441 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1444 __builtin_ia32_lfence ();
1447 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1450 __builtin_ia32_mfence ();
1453 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1454 _mm_cvtsi32_si128 (int __A
)
1456 return _mm_set_epi32 (0, 0, 0, __A
);
1460 /* Intel intrinsic. */
1461 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1462 _mm_cvtsi64_si128 (long long __A
)
1464 return _mm_set_epi64x (0, __A
);
1467 /* Microsoft intrinsic. */
1468 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1469 _mm_cvtsi64x_si128 (long long __A
)
1471 return _mm_set_epi64x (0, __A
);
1475 /* Casts between various SP, DP, INT vector types. Note that these do no
1476 conversion of values, they just change the type. */
1477 extern __inline __m128
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1478 _mm_castpd_ps(__m128d __A
)
1480 return (__m128
) __A
;
1483 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1484 _mm_castpd_si128(__m128d __A
)
1486 return (__m128i
) __A
;
1489 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1490 _mm_castps_pd(__m128 __A
)
1492 return (__m128d
) __A
;
1495 extern __inline __m128i
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1496 _mm_castps_si128(__m128 __A
)
1498 return (__m128i
) __A
;
1501 extern __inline __m128
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1502 _mm_castsi128_ps(__m128i __A
)
1504 return (__m128
) __A
;
1507 extern __inline __m128d
__attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
1508 _mm_castsi128_pd(__m128i __A
)
1510 return (__m128d
) __A
;
1513 #endif /* __SSE2__ */
1515 #endif /* _EMMINTRIN_H_INCLUDED */