source: Daodan/MinGW/lib/gcc/mingw32/5.3.0/include/mmintrin.h@ 1054

Last change on this file since 1054 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 30.4 KB
RevLine 
[1046]1/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
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 3, or (at your option)
8 any later version.
9
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.
14
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
18
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
23
24/* Implemented from the specification included in the Intel C++ Compiler
25 User Guide and Reference, version 9.0. */
26
27#ifndef _MMINTRIN_H_INCLUDED
28#define _MMINTRIN_H_INCLUDED
29
30#ifndef __MMX__
31#pragma GCC push_options
32#pragma GCC target("mmx")
33#define __DISABLE_MMX__
34#endif /* __MMX__ */
35
36/* The Intel API is flexible enough that we must allow aliasing with other
37 vector types, and their scalar components. */
38typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
39
40/* Internal data types for implementing the intrinsics. */
41typedef int __v2si __attribute__ ((__vector_size__ (8)));
42typedef short __v4hi __attribute__ ((__vector_size__ (8)));
43typedef char __v8qi __attribute__ ((__vector_size__ (8)));
44typedef long long __v1di __attribute__ ((__vector_size__ (8)));
45typedef float __v2sf __attribute__ ((__vector_size__ (8)));
46
47/* Empty the multimedia state. */
48extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
49_mm_empty (void)
50{
51 __builtin_ia32_emms ();
52}
53
54extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
55_m_empty (void)
56{
57 _mm_empty ();
58}
59
60/* Convert I to a __m64 object. The integer is zero-extended to 64-bits. */
61extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
62_mm_cvtsi32_si64 (int __i)
63{
64 return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
65}
66
67extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
68_m_from_int (int __i)
69{
70 return _mm_cvtsi32_si64 (__i);
71}
72
73#ifdef __x86_64__
74/* Convert I to a __m64 object. */
75
76/* Intel intrinsic. */
77extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
78_m_from_int64 (long long __i)
79{
80 return (__m64) __i;
81}
82
83extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
84_mm_cvtsi64_m64 (long long __i)
85{
86 return (__m64) __i;
87}
88
89/* Microsoft intrinsic. */
90extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
91_mm_cvtsi64x_si64 (long long __i)
92{
93 return (__m64) __i;
94}
95
96extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
97_mm_set_pi64x (long long __i)
98{
99 return (__m64) __i;
100}
101#endif
102
103/* Convert the lower 32 bits of the __m64 object into an integer. */
104extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
105_mm_cvtsi64_si32 (__m64 __i)
106{
107 return __builtin_ia32_vec_ext_v2si ((__v2si)__i, 0);
108}
109
110extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
111_m_to_int (__m64 __i)
112{
113 return _mm_cvtsi64_si32 (__i);
114}
115
116#ifdef __x86_64__
117/* Convert the __m64 object to a 64bit integer. */
118
119/* Intel intrinsic. */
120extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
121_m_to_int64 (__m64 __i)
122{
123 return (long long)__i;
124}
125
126extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
127_mm_cvtm64_si64 (__m64 __i)
128{
129 return (long long)__i;
130}
131
132/* Microsoft intrinsic. */
133extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
134_mm_cvtsi64_si64x (__m64 __i)
135{
136 return (long long)__i;
137}
138#endif
139
140/* Pack the four 16-bit values from M1 into the lower four 8-bit values of
141 the result, and the four 16-bit values from M2 into the upper four 8-bit
142 values of the result, all with signed saturation. */
143extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
144_mm_packs_pi16 (__m64 __m1, __m64 __m2)
145{
146 return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2);
147}
148
149extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
150_m_packsswb (__m64 __m1, __m64 __m2)
151{
152 return _mm_packs_pi16 (__m1, __m2);
153}
154
155/* Pack the two 32-bit values from M1 in to the lower two 16-bit values of
156 the result, and the two 32-bit values from M2 into the upper two 16-bit
157 values of the result, all with signed saturation. */
158extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
159_mm_packs_pi32 (__m64 __m1, __m64 __m2)
160{
161 return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2);
162}
163
164extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
165_m_packssdw (__m64 __m1, __m64 __m2)
166{
167 return _mm_packs_pi32 (__m1, __m2);
168}
169
170/* Pack the four 16-bit values from M1 into the lower four 8-bit values of
171 the result, and the four 16-bit values from M2 into the upper four 8-bit
172 values of the result, all with unsigned saturation. */
173extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
174_mm_packs_pu16 (__m64 __m1, __m64 __m2)
175{
176 return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2);
177}
178
179extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
180_m_packuswb (__m64 __m1, __m64 __m2)
181{
182 return _mm_packs_pu16 (__m1, __m2);
183}
184
185/* Interleave the four 8-bit values from the high half of M1 with the four
186 8-bit values from the high half of M2. */
187extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
188_mm_unpackhi_pi8 (__m64 __m1, __m64 __m2)
189{
190 return (__m64) __builtin_ia32_punpckhbw ((__v8qi)__m1, (__v8qi)__m2);
191}
192
193extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
194_m_punpckhbw (__m64 __m1, __m64 __m2)
195{
196 return _mm_unpackhi_pi8 (__m1, __m2);
197}
198
199/* Interleave the two 16-bit values from the high half of M1 with the two
200 16-bit values from the high half of M2. */
201extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
202_mm_unpackhi_pi16 (__m64 __m1, __m64 __m2)
203{
204 return (__m64) __builtin_ia32_punpckhwd ((__v4hi)__m1, (__v4hi)__m2);
205}
206
207extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
208_m_punpckhwd (__m64 __m1, __m64 __m2)
209{
210 return _mm_unpackhi_pi16 (__m1, __m2);
211}
212
213/* Interleave the 32-bit value from the high half of M1 with the 32-bit
214 value from the high half of M2. */
215extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
216_mm_unpackhi_pi32 (__m64 __m1, __m64 __m2)
217{
218 return (__m64) __builtin_ia32_punpckhdq ((__v2si)__m1, (__v2si)__m2);
219}
220
221extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
222_m_punpckhdq (__m64 __m1, __m64 __m2)
223{
224 return _mm_unpackhi_pi32 (__m1, __m2);
225}
226
227/* Interleave the four 8-bit values from the low half of M1 with the four
228 8-bit values from the low half of M2. */
229extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
230_mm_unpacklo_pi8 (__m64 __m1, __m64 __m2)
231{
232 return (__m64) __builtin_ia32_punpcklbw ((__v8qi)__m1, (__v8qi)__m2);
233}
234
235extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
236_m_punpcklbw (__m64 __m1, __m64 __m2)
237{
238 return _mm_unpacklo_pi8 (__m1, __m2);
239}
240
241/* Interleave the two 16-bit values from the low half of M1 with the two
242 16-bit values from the low half of M2. */
243extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
244_mm_unpacklo_pi16 (__m64 __m1, __m64 __m2)
245{
246 return (__m64) __builtin_ia32_punpcklwd ((__v4hi)__m1, (__v4hi)__m2);
247}
248
249extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
250_m_punpcklwd (__m64 __m1, __m64 __m2)
251{
252 return _mm_unpacklo_pi16 (__m1, __m2);
253}
254
255/* Interleave the 32-bit value from the low half of M1 with the 32-bit
256 value from the low half of M2. */
257extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
258_mm_unpacklo_pi32 (__m64 __m1, __m64 __m2)
259{
260 return (__m64) __builtin_ia32_punpckldq ((__v2si)__m1, (__v2si)__m2);
261}
262
263extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
264_m_punpckldq (__m64 __m1, __m64 __m2)
265{
266 return _mm_unpacklo_pi32 (__m1, __m2);
267}
268
269/* Add the 8-bit values in M1 to the 8-bit values in M2. */
270extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
271_mm_add_pi8 (__m64 __m1, __m64 __m2)
272{
273 return (__m64) __builtin_ia32_paddb ((__v8qi)__m1, (__v8qi)__m2);
274}
275
276extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
277_m_paddb (__m64 __m1, __m64 __m2)
278{
279 return _mm_add_pi8 (__m1, __m2);
280}
281
282/* Add the 16-bit values in M1 to the 16-bit values in M2. */
283extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
284_mm_add_pi16 (__m64 __m1, __m64 __m2)
285{
286 return (__m64) __builtin_ia32_paddw ((__v4hi)__m1, (__v4hi)__m2);
287}
288
289extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
290_m_paddw (__m64 __m1, __m64 __m2)
291{
292 return _mm_add_pi16 (__m1, __m2);
293}
294
295/* Add the 32-bit values in M1 to the 32-bit values in M2. */
296extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
297_mm_add_pi32 (__m64 __m1, __m64 __m2)
298{
299 return (__m64) __builtin_ia32_paddd ((__v2si)__m1, (__v2si)__m2);
300}
301
302extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
303_m_paddd (__m64 __m1, __m64 __m2)
304{
305 return _mm_add_pi32 (__m1, __m2);
306}
307
308/* Add the 64-bit values in M1 to the 64-bit values in M2. */
309#ifndef __SSE2__
310#pragma GCC push_options
311#pragma GCC target("sse2")
312#define __DISABLE_SSE2__
313#endif /* __SSE2__ */
314
315extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
316_mm_add_si64 (__m64 __m1, __m64 __m2)
317{
318 return (__m64) __builtin_ia32_paddq ((__v1di)__m1, (__v1di)__m2);
319}
320#ifdef __DISABLE_SSE2__
321#undef __DISABLE_SSE2__
322#pragma GCC pop_options
323#endif /* __DISABLE_SSE2__ */
324
325/* Add the 8-bit values in M1 to the 8-bit values in M2 using signed
326 saturated arithmetic. */
327extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
328_mm_adds_pi8 (__m64 __m1, __m64 __m2)
329{
330 return (__m64) __builtin_ia32_paddsb ((__v8qi)__m1, (__v8qi)__m2);
331}
332
333extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
334_m_paddsb (__m64 __m1, __m64 __m2)
335{
336 return _mm_adds_pi8 (__m1, __m2);
337}
338
339/* Add the 16-bit values in M1 to the 16-bit values in M2 using signed
340 saturated arithmetic. */
341extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
342_mm_adds_pi16 (__m64 __m1, __m64 __m2)
343{
344 return (__m64) __builtin_ia32_paddsw ((__v4hi)__m1, (__v4hi)__m2);
345}
346
347extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
348_m_paddsw (__m64 __m1, __m64 __m2)
349{
350 return _mm_adds_pi16 (__m1, __m2);
351}
352
353/* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned
354 saturated arithmetic. */
355extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
356_mm_adds_pu8 (__m64 __m1, __m64 __m2)
357{
358 return (__m64) __builtin_ia32_paddusb ((__v8qi)__m1, (__v8qi)__m2);
359}
360
361extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
362_m_paddusb (__m64 __m1, __m64 __m2)
363{
364 return _mm_adds_pu8 (__m1, __m2);
365}
366
367/* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned
368 saturated arithmetic. */
369extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
370_mm_adds_pu16 (__m64 __m1, __m64 __m2)
371{
372 return (__m64) __builtin_ia32_paddusw ((__v4hi)__m1, (__v4hi)__m2);
373}
374
375extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
376_m_paddusw (__m64 __m1, __m64 __m2)
377{
378 return _mm_adds_pu16 (__m1, __m2);
379}
380
381/* Subtract the 8-bit values in M2 from the 8-bit values in M1. */
382extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
383_mm_sub_pi8 (__m64 __m1, __m64 __m2)
384{
385 return (__m64) __builtin_ia32_psubb ((__v8qi)__m1, (__v8qi)__m2);
386}
387
388extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
389_m_psubb (__m64 __m1, __m64 __m2)
390{
391 return _mm_sub_pi8 (__m1, __m2);
392}
393
394/* Subtract the 16-bit values in M2 from the 16-bit values in M1. */
395extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
396_mm_sub_pi16 (__m64 __m1, __m64 __m2)
397{
398 return (__m64) __builtin_ia32_psubw ((__v4hi)__m1, (__v4hi)__m2);
399}
400
401extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
402_m_psubw (__m64 __m1, __m64 __m2)
403{
404 return _mm_sub_pi16 (__m1, __m2);
405}
406
407/* Subtract the 32-bit values in M2 from the 32-bit values in M1. */
408extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
409_mm_sub_pi32 (__m64 __m1, __m64 __m2)
410{
411 return (__m64) __builtin_ia32_psubd ((__v2si)__m1, (__v2si)__m2);
412}
413
414extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
415_m_psubd (__m64 __m1, __m64 __m2)
416{
417 return _mm_sub_pi32 (__m1, __m2);
418}
419
420/* Add the 64-bit values in M1 to the 64-bit values in M2. */
421#ifndef __SSE2__
422#pragma GCC push_options
423#pragma GCC target("sse2")
424#define __DISABLE_SSE2__
425#endif /* __SSE2__ */
426
427extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
428_mm_sub_si64 (__m64 __m1, __m64 __m2)
429{
430 return (__m64) __builtin_ia32_psubq ((__v1di)__m1, (__v1di)__m2);
431}
432#ifdef __DISABLE_SSE2__
433#undef __DISABLE_SSE2__
434#pragma GCC pop_options
435#endif /* __DISABLE_SSE2__ */
436
437/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using signed
438 saturating arithmetic. */
439extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
440_mm_subs_pi8 (__m64 __m1, __m64 __m2)
441{
442 return (__m64) __builtin_ia32_psubsb ((__v8qi)__m1, (__v8qi)__m2);
443}
444
445extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
446_m_psubsb (__m64 __m1, __m64 __m2)
447{
448 return _mm_subs_pi8 (__m1, __m2);
449}
450
451/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using
452 signed saturating arithmetic. */
453extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
454_mm_subs_pi16 (__m64 __m1, __m64 __m2)
455{
456 return (__m64) __builtin_ia32_psubsw ((__v4hi)__m1, (__v4hi)__m2);
457}
458
459extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
460_m_psubsw (__m64 __m1, __m64 __m2)
461{
462 return _mm_subs_pi16 (__m1, __m2);
463}
464
465/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using
466 unsigned saturating arithmetic. */
467extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
468_mm_subs_pu8 (__m64 __m1, __m64 __m2)
469{
470 return (__m64) __builtin_ia32_psubusb ((__v8qi)__m1, (__v8qi)__m2);
471}
472
473extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
474_m_psubusb (__m64 __m1, __m64 __m2)
475{
476 return _mm_subs_pu8 (__m1, __m2);
477}
478
479/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using
480 unsigned saturating arithmetic. */
481extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
482_mm_subs_pu16 (__m64 __m1, __m64 __m2)
483{
484 return (__m64) __builtin_ia32_psubusw ((__v4hi)__m1, (__v4hi)__m2);
485}
486
487extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
488_m_psubusw (__m64 __m1, __m64 __m2)
489{
490 return _mm_subs_pu16 (__m1, __m2);
491}
492
493/* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing
494 four 32-bit intermediate results, which are then summed by pairs to
495 produce two 32-bit results. */
496extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
497_mm_madd_pi16 (__m64 __m1, __m64 __m2)
498{
499 return (__m64) __builtin_ia32_pmaddwd ((__v4hi)__m1, (__v4hi)__m2);
500}
501
502extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
503_m_pmaddwd (__m64 __m1, __m64 __m2)
504{
505 return _mm_madd_pi16 (__m1, __m2);
506}
507
508/* Multiply four signed 16-bit values in M1 by four signed 16-bit values in
509 M2 and produce the high 16 bits of the 32-bit results. */
510extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
511_mm_mulhi_pi16 (__m64 __m1, __m64 __m2)
512{
513 return (__m64) __builtin_ia32_pmulhw ((__v4hi)__m1, (__v4hi)__m2);
514}
515
516extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
517_m_pmulhw (__m64 __m1, __m64 __m2)
518{
519 return _mm_mulhi_pi16 (__m1, __m2);
520}
521
522/* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce
523 the low 16 bits of the results. */
524extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
525_mm_mullo_pi16 (__m64 __m1, __m64 __m2)
526{
527 return (__m64) __builtin_ia32_pmullw ((__v4hi)__m1, (__v4hi)__m2);
528}
529
530extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
531_m_pmullw (__m64 __m1, __m64 __m2)
532{
533 return _mm_mullo_pi16 (__m1, __m2);
534}
535
536/* Shift four 16-bit values in M left by COUNT. */
537extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
538_mm_sll_pi16 (__m64 __m, __m64 __count)
539{
540 return (__m64) __builtin_ia32_psllw ((__v4hi)__m, (__v4hi)__count);
541}
542
543extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
544_m_psllw (__m64 __m, __m64 __count)
545{
546 return _mm_sll_pi16 (__m, __count);
547}
548
549extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
550_mm_slli_pi16 (__m64 __m, int __count)
551{
552 return (__m64) __builtin_ia32_psllwi ((__v4hi)__m, __count);
553}
554
555extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
556_m_psllwi (__m64 __m, int __count)
557{
558 return _mm_slli_pi16 (__m, __count);
559}
560
561/* Shift two 32-bit values in M left by COUNT. */
562extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
563_mm_sll_pi32 (__m64 __m, __m64 __count)
564{
565 return (__m64) __builtin_ia32_pslld ((__v2si)__m, (__v2si)__count);
566}
567
568extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
569_m_pslld (__m64 __m, __m64 __count)
570{
571 return _mm_sll_pi32 (__m, __count);
572}
573
574extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
575_mm_slli_pi32 (__m64 __m, int __count)
576{
577 return (__m64) __builtin_ia32_pslldi ((__v2si)__m, __count);
578}
579
580extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
581_m_pslldi (__m64 __m, int __count)
582{
583 return _mm_slli_pi32 (__m, __count);
584}
585
586/* Shift the 64-bit value in M left by COUNT. */
587extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
588_mm_sll_si64 (__m64 __m, __m64 __count)
589{
590 return (__m64) __builtin_ia32_psllq ((__v1di)__m, (__v1di)__count);
591}
592
593extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
594_m_psllq (__m64 __m, __m64 __count)
595{
596 return _mm_sll_si64 (__m, __count);
597}
598
599extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
600_mm_slli_si64 (__m64 __m, int __count)
601{
602 return (__m64) __builtin_ia32_psllqi ((__v1di)__m, __count);
603}
604
605extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
606_m_psllqi (__m64 __m, int __count)
607{
608 return _mm_slli_si64 (__m, __count);
609}
610
611/* Shift four 16-bit values in M right by COUNT; shift in the sign bit. */
612extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
613_mm_sra_pi16 (__m64 __m, __m64 __count)
614{
615 return (__m64) __builtin_ia32_psraw ((__v4hi)__m, (__v4hi)__count);
616}
617
618extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
619_m_psraw (__m64 __m, __m64 __count)
620{
621 return _mm_sra_pi16 (__m, __count);
622}
623
624extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
625_mm_srai_pi16 (__m64 __m, int __count)
626{
627 return (__m64) __builtin_ia32_psrawi ((__v4hi)__m, __count);
628}
629
630extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
631_m_psrawi (__m64 __m, int __count)
632{
633 return _mm_srai_pi16 (__m, __count);
634}
635
636/* Shift two 32-bit values in M right by COUNT; shift in the sign bit. */
637extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
638_mm_sra_pi32 (__m64 __m, __m64 __count)
639{
640 return (__m64) __builtin_ia32_psrad ((__v2si)__m, (__v2si)__count);
641}
642
643extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
644_m_psrad (__m64 __m, __m64 __count)
645{
646 return _mm_sra_pi32 (__m, __count);
647}
648
649extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
650_mm_srai_pi32 (__m64 __m, int __count)
651{
652 return (__m64) __builtin_ia32_psradi ((__v2si)__m, __count);
653}
654
655extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
656_m_psradi (__m64 __m, int __count)
657{
658 return _mm_srai_pi32 (__m, __count);
659}
660
661/* Shift four 16-bit values in M right by COUNT; shift in zeros. */
662extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
663_mm_srl_pi16 (__m64 __m, __m64 __count)
664{
665 return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, (__v4hi)__count);
666}
667
668extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
669_m_psrlw (__m64 __m, __m64 __count)
670{
671 return _mm_srl_pi16 (__m, __count);
672}
673
674extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
675_mm_srli_pi16 (__m64 __m, int __count)
676{
677 return (__m64) __builtin_ia32_psrlwi ((__v4hi)__m, __count);
678}
679
680extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
681_m_psrlwi (__m64 __m, int __count)
682{
683 return _mm_srli_pi16 (__m, __count);
684}
685
686/* Shift two 32-bit values in M right by COUNT; shift in zeros. */
687extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
688_mm_srl_pi32 (__m64 __m, __m64 __count)
689{
690 return (__m64) __builtin_ia32_psrld ((__v2si)__m, (__v2si)__count);
691}
692
693extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
694_m_psrld (__m64 __m, __m64 __count)
695{
696 return _mm_srl_pi32 (__m, __count);
697}
698
699extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
700_mm_srli_pi32 (__m64 __m, int __count)
701{
702 return (__m64) __builtin_ia32_psrldi ((__v2si)__m, __count);
703}
704
705extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
706_m_psrldi (__m64 __m, int __count)
707{
708 return _mm_srli_pi32 (__m, __count);
709}
710
711/* Shift the 64-bit value in M left by COUNT; shift in zeros. */
712extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
713_mm_srl_si64 (__m64 __m, __m64 __count)
714{
715 return (__m64) __builtin_ia32_psrlq ((__v1di)__m, (__v1di)__count);
716}
717
718extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
719_m_psrlq (__m64 __m, __m64 __count)
720{
721 return _mm_srl_si64 (__m, __count);
722}
723
724extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
725_mm_srli_si64 (__m64 __m, int __count)
726{
727 return (__m64) __builtin_ia32_psrlqi ((__v1di)__m, __count);
728}
729
730extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
731_m_psrlqi (__m64 __m, int __count)
732{
733 return _mm_srli_si64 (__m, __count);
734}
735
736/* Bit-wise AND the 64-bit values in M1 and M2. */
737extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
738_mm_and_si64 (__m64 __m1, __m64 __m2)
739{
740 return __builtin_ia32_pand (__m1, __m2);
741}
742
743extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
744_m_pand (__m64 __m1, __m64 __m2)
745{
746 return _mm_and_si64 (__m1, __m2);
747}
748
749/* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the
750 64-bit value in M2. */
751extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
752_mm_andnot_si64 (__m64 __m1, __m64 __m2)
753{
754 return __builtin_ia32_pandn (__m1, __m2);
755}
756
757extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
758_m_pandn (__m64 __m1, __m64 __m2)
759{
760 return _mm_andnot_si64 (__m1, __m2);
761}
762
763/* Bit-wise inclusive OR the 64-bit values in M1 and M2. */
764extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
765_mm_or_si64 (__m64 __m1, __m64 __m2)
766{
767 return __builtin_ia32_por (__m1, __m2);
768}
769
770extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
771_m_por (__m64 __m1, __m64 __m2)
772{
773 return _mm_or_si64 (__m1, __m2);
774}
775
776/* Bit-wise exclusive OR the 64-bit values in M1 and M2. */
777extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
778_mm_xor_si64 (__m64 __m1, __m64 __m2)
779{
780 return __builtin_ia32_pxor (__m1, __m2);
781}
782
783extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
784_m_pxor (__m64 __m1, __m64 __m2)
785{
786 return _mm_xor_si64 (__m1, __m2);
787}
788
789/* Compare eight 8-bit values. The result of the comparison is 0xFF if the
790 test is true and zero if false. */
791extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
792_mm_cmpeq_pi8 (__m64 __m1, __m64 __m2)
793{
794 return (__m64) __builtin_ia32_pcmpeqb ((__v8qi)__m1, (__v8qi)__m2);
795}
796
797extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
798_m_pcmpeqb (__m64 __m1, __m64 __m2)
799{
800 return _mm_cmpeq_pi8 (__m1, __m2);
801}
802
803extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
804_mm_cmpgt_pi8 (__m64 __m1, __m64 __m2)
805{
806 return (__m64) __builtin_ia32_pcmpgtb ((__v8qi)__m1, (__v8qi)__m2);
807}
808
809extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
810_m_pcmpgtb (__m64 __m1, __m64 __m2)
811{
812 return _mm_cmpgt_pi8 (__m1, __m2);
813}
814
815/* Compare four 16-bit values. The result of the comparison is 0xFFFF if
816 the test is true and zero if false. */
817extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
818_mm_cmpeq_pi16 (__m64 __m1, __m64 __m2)
819{
820 return (__m64) __builtin_ia32_pcmpeqw ((__v4hi)__m1, (__v4hi)__m2);
821}
822
823extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
824_m_pcmpeqw (__m64 __m1, __m64 __m2)
825{
826 return _mm_cmpeq_pi16 (__m1, __m2);
827}
828
829extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
830_mm_cmpgt_pi16 (__m64 __m1, __m64 __m2)
831{
832 return (__m64) __builtin_ia32_pcmpgtw ((__v4hi)__m1, (__v4hi)__m2);
833}
834
835extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
836_m_pcmpgtw (__m64 __m1, __m64 __m2)
837{
838 return _mm_cmpgt_pi16 (__m1, __m2);
839}
840
841/* Compare two 32-bit values. The result of the comparison is 0xFFFFFFFF if
842 the test is true and zero if false. */
843extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
844_mm_cmpeq_pi32 (__m64 __m1, __m64 __m2)
845{
846 return (__m64) __builtin_ia32_pcmpeqd ((__v2si)__m1, (__v2si)__m2);
847}
848
849extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
850_m_pcmpeqd (__m64 __m1, __m64 __m2)
851{
852 return _mm_cmpeq_pi32 (__m1, __m2);
853}
854
855extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
856_mm_cmpgt_pi32 (__m64 __m1, __m64 __m2)
857{
858 return (__m64) __builtin_ia32_pcmpgtd ((__v2si)__m1, (__v2si)__m2);
859}
860
861extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
862_m_pcmpgtd (__m64 __m1, __m64 __m2)
863{
864 return _mm_cmpgt_pi32 (__m1, __m2);
865}
866
867/* Creates a 64-bit zero. */
868extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
869_mm_setzero_si64 (void)
870{
871 return (__m64)0LL;
872}
873
874/* Creates a vector of two 32-bit values; I0 is least significant. */
875extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
876_mm_set_pi32 (int __i1, int __i0)
877{
878 return (__m64) __builtin_ia32_vec_init_v2si (__i0, __i1);
879}
880
881/* Creates a vector of four 16-bit values; W0 is least significant. */
882extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
883_mm_set_pi16 (short __w3, short __w2, short __w1, short __w0)
884{
885 return (__m64) __builtin_ia32_vec_init_v4hi (__w0, __w1, __w2, __w3);
886}
887
888/* Creates a vector of eight 8-bit values; B0 is least significant. */
889extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
890_mm_set_pi8 (char __b7, char __b6, char __b5, char __b4,
891 char __b3, char __b2, char __b1, char __b0)
892{
893 return (__m64) __builtin_ia32_vec_init_v8qi (__b0, __b1, __b2, __b3,
894 __b4, __b5, __b6, __b7);
895}
896
897/* Similar, but with the arguments in reverse order. */
898extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
899_mm_setr_pi32 (int __i0, int __i1)
900{
901 return _mm_set_pi32 (__i1, __i0);
902}
903
904extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
905_mm_setr_pi16 (short __w0, short __w1, short __w2, short __w3)
906{
907 return _mm_set_pi16 (__w3, __w2, __w1, __w0);
908}
909
910extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
911_mm_setr_pi8 (char __b0, char __b1, char __b2, char __b3,
912 char __b4, char __b5, char __b6, char __b7)
913{
914 return _mm_set_pi8 (__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
915}
916
917/* Creates a vector of two 32-bit values, both elements containing I. */
918extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
919_mm_set1_pi32 (int __i)
920{
921 return _mm_set_pi32 (__i, __i);
922}
923
924/* Creates a vector of four 16-bit values, all elements containing W. */
925extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
926_mm_set1_pi16 (short __w)
927{
928 return _mm_set_pi16 (__w, __w, __w, __w);
929}
930
931/* Creates a vector of eight 8-bit values, all elements containing B. */
932extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
933_mm_set1_pi8 (char __b)
934{
935 return _mm_set_pi8 (__b, __b, __b, __b, __b, __b, __b, __b);
936}
937#ifdef __DISABLE_MMX__
938#undef __DISABLE_MMX__
939#pragma GCC pop_options
940#endif /* __DISABLE_MMX__ */
941
942#endif /* _MMINTRIN_H_INCLUDED */
Note: See TracBrowser for help on using the repository browser.