1 /* Copyright (C) 2002-2016 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GCC is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
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.
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/>. */
24 #ifndef _MMINTRIN_H_INCLUDED
25 #define _MMINTRIN_H_INCLUDED
28 #error mmintrin.h included without enabling WMMX/WMMX2 instructions (e.g. -march=iwmmxt or -march=iwmmxt2)
32 #if defined __cplusplus
34 /* Intrinsics use C name-mangling. */
35 #endif /* __cplusplus */
37 /* The data type intended for user use. */
38 typedef unsigned long long __m64
, __int64
;
40 /* Internal data types for implementing the intrinsics. */
41 typedef int __v2si
__attribute__ ((vector_size (8)));
42 typedef short __v4hi
__attribute__ ((vector_size (8)));
43 typedef signed char __v8qi
__attribute__ ((vector_size (8)));
45 /* Provided for source compatibility with MMX. */
46 extern __inline
void __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
51 /* "Convert" __m64 and __int64 into each other. */
53 _mm_cvtsi64_m64 (__int64 __i
)
58 static __inline __int64
59 _mm_cvtm64_si64 (__m64 __i
)
65 _mm_cvtsi64_si32 (__int64 __i
)
70 static __inline __int64
71 _mm_cvtsi32_si64 (int __i
)
73 return (__i
& 0xffffffff);
76 /* Pack the four 16-bit values from M1 into the lower four 8-bit values of
77 the result, and the four 16-bit values from M2 into the upper four 8-bit
78 values of the result, all with signed saturation. */
80 _mm_packs_pi16 (__m64 __m1
, __m64 __m2
)
82 return (__m64
) __builtin_arm_wpackhss ((__v4hi
)__m1
, (__v4hi
)__m2
);
85 /* Pack the two 32-bit values from M1 in to the lower two 16-bit values of
86 the result, and the two 32-bit values from M2 into the upper two 16-bit
87 values of the result, all with signed saturation. */
89 _mm_packs_pi32 (__m64 __m1
, __m64 __m2
)
91 return (__m64
) __builtin_arm_wpackwss ((__v2si
)__m1
, (__v2si
)__m2
);
94 /* Copy the 64-bit value from M1 into the lower 32-bits of the result, and
95 the 64-bit value from M2 into the upper 32-bits of the result, all with
96 signed saturation for values that do not fit exactly into 32-bits. */
98 _mm_packs_pi64 (__m64 __m1
, __m64 __m2
)
100 return (__m64
) __builtin_arm_wpackdss ((long long)__m1
, (long long)__m2
);
103 /* Pack the four 16-bit values from M1 into the lower four 8-bit values of
104 the result, and the four 16-bit values from M2 into the upper four 8-bit
105 values of the result, all with unsigned saturation. */
106 static __inline __m64
107 _mm_packs_pu16 (__m64 __m1
, __m64 __m2
)
109 return (__m64
) __builtin_arm_wpackhus ((__v4hi
)__m1
, (__v4hi
)__m2
);
112 /* Pack the two 32-bit values from M1 into the lower two 16-bit values of
113 the result, and the two 32-bit values from M2 into the upper two 16-bit
114 values of the result, all with unsigned saturation. */
115 static __inline __m64
116 _mm_packs_pu32 (__m64 __m1
, __m64 __m2
)
118 return (__m64
) __builtin_arm_wpackwus ((__v2si
)__m1
, (__v2si
)__m2
);
121 /* Copy the 64-bit value from M1 into the lower 32-bits of the result, and
122 the 64-bit value from M2 into the upper 32-bits of the result, all with
123 unsigned saturation for values that do not fit exactly into 32-bits. */
124 static __inline __m64
125 _mm_packs_pu64 (__m64 __m1
, __m64 __m2
)
127 return (__m64
) __builtin_arm_wpackdus ((long long)__m1
, (long long)__m2
);
130 /* Interleave the four 8-bit values from the high half of M1 with the four
131 8-bit values from the high half of M2. */
132 static __inline __m64
133 _mm_unpackhi_pi8 (__m64 __m1
, __m64 __m2
)
135 return (__m64
) __builtin_arm_wunpckihb ((__v8qi
)__m1
, (__v8qi
)__m2
);
138 /* Interleave the two 16-bit values from the high half of M1 with the two
139 16-bit values from the high half of M2. */
140 static __inline __m64
141 _mm_unpackhi_pi16 (__m64 __m1
, __m64 __m2
)
143 return (__m64
) __builtin_arm_wunpckihh ((__v4hi
)__m1
, (__v4hi
)__m2
);
146 /* Interleave the 32-bit value from the high half of M1 with the 32-bit
147 value from the high half of M2. */
148 static __inline __m64
149 _mm_unpackhi_pi32 (__m64 __m1
, __m64 __m2
)
151 return (__m64
) __builtin_arm_wunpckihw ((__v2si
)__m1
, (__v2si
)__m2
);
154 /* Interleave the four 8-bit values from the low half of M1 with the four
155 8-bit values from the low half of M2. */
156 static __inline __m64
157 _mm_unpacklo_pi8 (__m64 __m1
, __m64 __m2
)
159 return (__m64
) __builtin_arm_wunpckilb ((__v8qi
)__m1
, (__v8qi
)__m2
);
162 /* Interleave the two 16-bit values from the low half of M1 with the two
163 16-bit values from the low half of M2. */
164 static __inline __m64
165 _mm_unpacklo_pi16 (__m64 __m1
, __m64 __m2
)
167 return (__m64
) __builtin_arm_wunpckilh ((__v4hi
)__m1
, (__v4hi
)__m2
);
170 /* Interleave the 32-bit value from the low half of M1 with the 32-bit
171 value from the low half of M2. */
172 static __inline __m64
173 _mm_unpacklo_pi32 (__m64 __m1
, __m64 __m2
)
175 return (__m64
) __builtin_arm_wunpckilw ((__v2si
)__m1
, (__v2si
)__m2
);
178 /* Take the four 8-bit values from the low half of M1, sign extend them,
179 and return the result as a vector of four 16-bit quantities. */
180 static __inline __m64
181 _mm_unpackel_pi8 (__m64 __m1
)
183 return (__m64
) __builtin_arm_wunpckelsb ((__v8qi
)__m1
);
186 /* Take the two 16-bit values from the low half of M1, sign extend them,
187 and return the result as a vector of two 32-bit quantities. */
188 static __inline __m64
189 _mm_unpackel_pi16 (__m64 __m1
)
191 return (__m64
) __builtin_arm_wunpckelsh ((__v4hi
)__m1
);
194 /* Take the 32-bit value from the low half of M1, and return it sign extended
196 static __inline __m64
197 _mm_unpackel_pi32 (__m64 __m1
)
199 return (__m64
) __builtin_arm_wunpckelsw ((__v2si
)__m1
);
202 /* Take the four 8-bit values from the high half of M1, sign extend them,
203 and return the result as a vector of four 16-bit quantities. */
204 static __inline __m64
205 _mm_unpackeh_pi8 (__m64 __m1
)
207 return (__m64
) __builtin_arm_wunpckehsb ((__v8qi
)__m1
);
210 /* Take the two 16-bit values from the high half of M1, sign extend them,
211 and return the result as a vector of two 32-bit quantities. */
212 static __inline __m64
213 _mm_unpackeh_pi16 (__m64 __m1
)
215 return (__m64
) __builtin_arm_wunpckehsh ((__v4hi
)__m1
);
218 /* Take the 32-bit value from the high half of M1, and return it sign extended
220 static __inline __m64
221 _mm_unpackeh_pi32 (__m64 __m1
)
223 return (__m64
) __builtin_arm_wunpckehsw ((__v2si
)__m1
);
226 /* Take the four 8-bit values from the low half of M1, zero extend them,
227 and return the result as a vector of four 16-bit quantities. */
228 static __inline __m64
229 _mm_unpackel_pu8 (__m64 __m1
)
231 return (__m64
) __builtin_arm_wunpckelub ((__v8qi
)__m1
);
234 /* Take the two 16-bit values from the low half of M1, zero extend them,
235 and return the result as a vector of two 32-bit quantities. */
236 static __inline __m64
237 _mm_unpackel_pu16 (__m64 __m1
)
239 return (__m64
) __builtin_arm_wunpckeluh ((__v4hi
)__m1
);
242 /* Take the 32-bit value from the low half of M1, and return it zero extended
244 static __inline __m64
245 _mm_unpackel_pu32 (__m64 __m1
)
247 return (__m64
) __builtin_arm_wunpckeluw ((__v2si
)__m1
);
250 /* Take the four 8-bit values from the high half of M1, zero extend them,
251 and return the result as a vector of four 16-bit quantities. */
252 static __inline __m64
253 _mm_unpackeh_pu8 (__m64 __m1
)
255 return (__m64
) __builtin_arm_wunpckehub ((__v8qi
)__m1
);
258 /* Take the two 16-bit values from the high half of M1, zero extend them,
259 and return the result as a vector of two 32-bit quantities. */
260 static __inline __m64
261 _mm_unpackeh_pu16 (__m64 __m1
)
263 return (__m64
) __builtin_arm_wunpckehuh ((__v4hi
)__m1
);
266 /* Take the 32-bit value from the high half of M1, and return it zero extended
268 static __inline __m64
269 _mm_unpackeh_pu32 (__m64 __m1
)
271 return (__m64
) __builtin_arm_wunpckehuw ((__v2si
)__m1
);
274 /* Add the 8-bit values in M1 to the 8-bit values in M2. */
275 static __inline __m64
276 _mm_add_pi8 (__m64 __m1
, __m64 __m2
)
278 return (__m64
) __builtin_arm_waddb ((__v8qi
)__m1
, (__v8qi
)__m2
);
281 /* Add the 16-bit values in M1 to the 16-bit values in M2. */
282 static __inline __m64
283 _mm_add_pi16 (__m64 __m1
, __m64 __m2
)
285 return (__m64
) __builtin_arm_waddh ((__v4hi
)__m1
, (__v4hi
)__m2
);
288 /* Add the 32-bit values in M1 to the 32-bit values in M2. */
289 static __inline __m64
290 _mm_add_pi32 (__m64 __m1
, __m64 __m2
)
292 return (__m64
) __builtin_arm_waddw ((__v2si
)__m1
, (__v2si
)__m2
);
295 /* Add the 8-bit values in M1 to the 8-bit values in M2 using signed
296 saturated arithmetic. */
297 static __inline __m64
298 _mm_adds_pi8 (__m64 __m1
, __m64 __m2
)
300 return (__m64
) __builtin_arm_waddbss ((__v8qi
)__m1
, (__v8qi
)__m2
);
303 /* Add the 16-bit values in M1 to the 16-bit values in M2 using signed
304 saturated arithmetic. */
305 static __inline __m64
306 _mm_adds_pi16 (__m64 __m1
, __m64 __m2
)
308 return (__m64
) __builtin_arm_waddhss ((__v4hi
)__m1
, (__v4hi
)__m2
);
311 /* Add the 32-bit values in M1 to the 32-bit values in M2 using signed
312 saturated arithmetic. */
313 static __inline __m64
314 _mm_adds_pi32 (__m64 __m1
, __m64 __m2
)
316 return (__m64
) __builtin_arm_waddwss ((__v2si
)__m1
, (__v2si
)__m2
);
319 /* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned
320 saturated arithmetic. */
321 static __inline __m64
322 _mm_adds_pu8 (__m64 __m1
, __m64 __m2
)
324 return (__m64
) __builtin_arm_waddbus ((__v8qi
)__m1
, (__v8qi
)__m2
);
327 /* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned
328 saturated arithmetic. */
329 static __inline __m64
330 _mm_adds_pu16 (__m64 __m1
, __m64 __m2
)
332 return (__m64
) __builtin_arm_waddhus ((__v4hi
)__m1
, (__v4hi
)__m2
);
335 /* Add the 32-bit values in M1 to the 32-bit values in M2 using unsigned
336 saturated arithmetic. */
337 static __inline __m64
338 _mm_adds_pu32 (__m64 __m1
, __m64 __m2
)
340 return (__m64
) __builtin_arm_waddwus ((__v2si
)__m1
, (__v2si
)__m2
);
343 /* Subtract the 8-bit values in M2 from the 8-bit values in M1. */
344 static __inline __m64
345 _mm_sub_pi8 (__m64 __m1
, __m64 __m2
)
347 return (__m64
) __builtin_arm_wsubb ((__v8qi
)__m1
, (__v8qi
)__m2
);
350 /* Subtract the 16-bit values in M2 from the 16-bit values in M1. */
351 static __inline __m64
352 _mm_sub_pi16 (__m64 __m1
, __m64 __m2
)
354 return (__m64
) __builtin_arm_wsubh ((__v4hi
)__m1
, (__v4hi
)__m2
);
357 /* Subtract the 32-bit values in M2 from the 32-bit values in M1. */
358 static __inline __m64
359 _mm_sub_pi32 (__m64 __m1
, __m64 __m2
)
361 return (__m64
) __builtin_arm_wsubw ((__v2si
)__m1
, (__v2si
)__m2
);
364 /* Subtract the 8-bit values in M2 from the 8-bit values in M1 using signed
365 saturating arithmetic. */
366 static __inline __m64
367 _mm_subs_pi8 (__m64 __m1
, __m64 __m2
)
369 return (__m64
) __builtin_arm_wsubbss ((__v8qi
)__m1
, (__v8qi
)__m2
);
372 /* Subtract the 16-bit values in M2 from the 16-bit values in M1 using
373 signed saturating arithmetic. */
374 static __inline __m64
375 _mm_subs_pi16 (__m64 __m1
, __m64 __m2
)
377 return (__m64
) __builtin_arm_wsubhss ((__v4hi
)__m1
, (__v4hi
)__m2
);
380 /* Subtract the 32-bit values in M2 from the 32-bit values in M1 using
381 signed saturating arithmetic. */
382 static __inline __m64
383 _mm_subs_pi32 (__m64 __m1
, __m64 __m2
)
385 return (__m64
) __builtin_arm_wsubwss ((__v2si
)__m1
, (__v2si
)__m2
);
388 /* Subtract the 8-bit values in M2 from the 8-bit values in M1 using
389 unsigned saturating arithmetic. */
390 static __inline __m64
391 _mm_subs_pu8 (__m64 __m1
, __m64 __m2
)
393 return (__m64
) __builtin_arm_wsubbus ((__v8qi
)__m1
, (__v8qi
)__m2
);
396 /* Subtract the 16-bit values in M2 from the 16-bit values in M1 using
397 unsigned saturating arithmetic. */
398 static __inline __m64
399 _mm_subs_pu16 (__m64 __m1
, __m64 __m2
)
401 return (__m64
) __builtin_arm_wsubhus ((__v4hi
)__m1
, (__v4hi
)__m2
);
404 /* Subtract the 32-bit values in M2 from the 32-bit values in M1 using
405 unsigned saturating arithmetic. */
406 static __inline __m64
407 _mm_subs_pu32 (__m64 __m1
, __m64 __m2
)
409 return (__m64
) __builtin_arm_wsubwus ((__v2si
)__m1
, (__v2si
)__m2
);
412 /* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing
413 four 32-bit intermediate results, which are then summed by pairs to
414 produce two 32-bit results. */
415 static __inline __m64
416 _mm_madd_pi16 (__m64 __m1
, __m64 __m2
)
418 return (__m64
) __builtin_arm_wmadds ((__v4hi
)__m1
, (__v4hi
)__m2
);
421 /* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing
422 four 32-bit intermediate results, which are then summed by pairs to
423 produce two 32-bit results. */
424 static __inline __m64
425 _mm_madd_pu16 (__m64 __m1
, __m64 __m2
)
427 return (__m64
) __builtin_arm_wmaddu ((__v4hi
)__m1
, (__v4hi
)__m2
);
430 /* Multiply four signed 16-bit values in M1 by four signed 16-bit values in
431 M2 and produce the high 16 bits of the 32-bit results. */
432 static __inline __m64
433 _mm_mulhi_pi16 (__m64 __m1
, __m64 __m2
)
435 return (__m64
) __builtin_arm_wmulsm ((__v4hi
)__m1
, (__v4hi
)__m2
);
438 /* Multiply four signed 16-bit values in M1 by four signed 16-bit values in
439 M2 and produce the high 16 bits of the 32-bit results. */
440 static __inline __m64
441 _mm_mulhi_pu16 (__m64 __m1
, __m64 __m2
)
443 return (__m64
) __builtin_arm_wmulum ((__v4hi
)__m1
, (__v4hi
)__m2
);
446 /* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce
447 the low 16 bits of the results. */
448 static __inline __m64
449 _mm_mullo_pi16 (__m64 __m1
, __m64 __m2
)
451 return (__m64
) __builtin_arm_wmulul ((__v4hi
)__m1
, (__v4hi
)__m2
);
454 /* Shift four 16-bit values in M left by COUNT. */
455 static __inline __m64
456 _mm_sll_pi16 (__m64 __m
, __m64 __count
)
458 return (__m64
) __builtin_arm_wsllh ((__v4hi
)__m
, __count
);
461 static __inline __m64
462 _mm_slli_pi16 (__m64 __m
, int __count
)
464 return (__m64
) __builtin_arm_wsllhi ((__v4hi
)__m
, __count
);
467 /* Shift two 32-bit values in M left by COUNT. */
468 static __inline __m64
469 _mm_sll_pi32 (__m64 __m
, __m64 __count
)
471 return (__m64
) __builtin_arm_wsllw ((__v2si
)__m
, __count
);
474 static __inline __m64
475 _mm_slli_pi32 (__m64 __m
, int __count
)
477 return (__m64
) __builtin_arm_wsllwi ((__v2si
)__m
, __count
);
480 /* Shift the 64-bit value in M left by COUNT. */
481 static __inline __m64
482 _mm_sll_si64 (__m64 __m
, __m64 __count
)
484 return (__m64
) __builtin_arm_wslld (__m
, __count
);
487 static __inline __m64
488 _mm_slli_si64 (__m64 __m
, int __count
)
490 return (__m64
) __builtin_arm_wslldi (__m
, __count
);
493 /* Shift four 16-bit values in M right by COUNT; shift in the sign bit. */
494 static __inline __m64
495 _mm_sra_pi16 (__m64 __m
, __m64 __count
)
497 return (__m64
) __builtin_arm_wsrah ((__v4hi
)__m
, __count
);
500 static __inline __m64
501 _mm_srai_pi16 (__m64 __m
, int __count
)
503 return (__m64
) __builtin_arm_wsrahi ((__v4hi
)__m
, __count
);
506 /* Shift two 32-bit values in M right by COUNT; shift in the sign bit. */
507 static __inline __m64
508 _mm_sra_pi32 (__m64 __m
, __m64 __count
)
510 return (__m64
) __builtin_arm_wsraw ((__v2si
)__m
, __count
);
513 static __inline __m64
514 _mm_srai_pi32 (__m64 __m
, int __count
)
516 return (__m64
) __builtin_arm_wsrawi ((__v2si
)__m
, __count
);
519 /* Shift the 64-bit value in M right by COUNT; shift in the sign bit. */
520 static __inline __m64
521 _mm_sra_si64 (__m64 __m
, __m64 __count
)
523 return (__m64
) __builtin_arm_wsrad (__m
, __count
);
526 static __inline __m64
527 _mm_srai_si64 (__m64 __m
, int __count
)
529 return (__m64
) __builtin_arm_wsradi (__m
, __count
);
532 /* Shift four 16-bit values in M right by COUNT; shift in zeros. */
533 static __inline __m64
534 _mm_srl_pi16 (__m64 __m
, __m64 __count
)
536 return (__m64
) __builtin_arm_wsrlh ((__v4hi
)__m
, __count
);
539 static __inline __m64
540 _mm_srli_pi16 (__m64 __m
, int __count
)
542 return (__m64
) __builtin_arm_wsrlhi ((__v4hi
)__m
, __count
);
545 /* Shift two 32-bit values in M right by COUNT; shift in zeros. */
546 static __inline __m64
547 _mm_srl_pi32 (__m64 __m
, __m64 __count
)
549 return (__m64
) __builtin_arm_wsrlw ((__v2si
)__m
, __count
);
552 static __inline __m64
553 _mm_srli_pi32 (__m64 __m
, int __count
)
555 return (__m64
) __builtin_arm_wsrlwi ((__v2si
)__m
, __count
);
558 /* Shift the 64-bit value in M left by COUNT; shift in zeros. */
559 static __inline __m64
560 _mm_srl_si64 (__m64 __m
, __m64 __count
)
562 return (__m64
) __builtin_arm_wsrld (__m
, __count
);
565 static __inline __m64
566 _mm_srli_si64 (__m64 __m
, int __count
)
568 return (__m64
) __builtin_arm_wsrldi (__m
, __count
);
571 /* Rotate four 16-bit values in M right by COUNT. */
572 static __inline __m64
573 _mm_ror_pi16 (__m64 __m
, __m64 __count
)
575 return (__m64
) __builtin_arm_wrorh ((__v4hi
)__m
, __count
);
578 static __inline __m64
579 _mm_rori_pi16 (__m64 __m
, int __count
)
581 return (__m64
) __builtin_arm_wrorhi ((__v4hi
)__m
, __count
);
584 /* Rotate two 32-bit values in M right by COUNT. */
585 static __inline __m64
586 _mm_ror_pi32 (__m64 __m
, __m64 __count
)
588 return (__m64
) __builtin_arm_wrorw ((__v2si
)__m
, __count
);
591 static __inline __m64
592 _mm_rori_pi32 (__m64 __m
, int __count
)
594 return (__m64
) __builtin_arm_wrorwi ((__v2si
)__m
, __count
);
597 /* Rotate two 64-bit values in M right by COUNT. */
598 static __inline __m64
599 _mm_ror_si64 (__m64 __m
, __m64 __count
)
601 return (__m64
) __builtin_arm_wrord (__m
, __count
);
604 static __inline __m64
605 _mm_rori_si64 (__m64 __m
, int __count
)
607 return (__m64
) __builtin_arm_wrordi (__m
, __count
);
610 /* Bit-wise AND the 64-bit values in M1 and M2. */
611 static __inline __m64
612 _mm_and_si64 (__m64 __m1
, __m64 __m2
)
614 return __builtin_arm_wand (__m1
, __m2
);
617 /* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the
618 64-bit value in M2. */
619 static __inline __m64
620 _mm_andnot_si64 (__m64 __m1
, __m64 __m2
)
622 return __builtin_arm_wandn (__m2
, __m1
);
625 /* Bit-wise inclusive OR the 64-bit values in M1 and M2. */
626 static __inline __m64
627 _mm_or_si64 (__m64 __m1
, __m64 __m2
)
629 return __builtin_arm_wor (__m1
, __m2
);
632 /* Bit-wise exclusive OR the 64-bit values in M1 and M2. */
633 static __inline __m64
634 _mm_xor_si64 (__m64 __m1
, __m64 __m2
)
636 return __builtin_arm_wxor (__m1
, __m2
);
639 /* Compare eight 8-bit values. The result of the comparison is 0xFF if the
640 test is true and zero if false. */
641 static __inline __m64
642 _mm_cmpeq_pi8 (__m64 __m1
, __m64 __m2
)
644 return (__m64
) __builtin_arm_wcmpeqb ((__v8qi
)__m1
, (__v8qi
)__m2
);
647 static __inline __m64
648 _mm_cmpgt_pi8 (__m64 __m1
, __m64 __m2
)
650 return (__m64
) __builtin_arm_wcmpgtsb ((__v8qi
)__m1
, (__v8qi
)__m2
);
653 static __inline __m64
654 _mm_cmpgt_pu8 (__m64 __m1
, __m64 __m2
)
656 return (__m64
) __builtin_arm_wcmpgtub ((__v8qi
)__m1
, (__v8qi
)__m2
);
659 /* Compare four 16-bit values. The result of the comparison is 0xFFFF if
660 the test is true and zero if false. */
661 static __inline __m64
662 _mm_cmpeq_pi16 (__m64 __m1
, __m64 __m2
)
664 return (__m64
) __builtin_arm_wcmpeqh ((__v4hi
)__m1
, (__v4hi
)__m2
);
667 static __inline __m64
668 _mm_cmpgt_pi16 (__m64 __m1
, __m64 __m2
)
670 return (__m64
) __builtin_arm_wcmpgtsh ((__v4hi
)__m1
, (__v4hi
)__m2
);
673 static __inline __m64
674 _mm_cmpgt_pu16 (__m64 __m1
, __m64 __m2
)
676 return (__m64
) __builtin_arm_wcmpgtuh ((__v4hi
)__m1
, (__v4hi
)__m2
);
679 /* Compare two 32-bit values. The result of the comparison is 0xFFFFFFFF if
680 the test is true and zero if false. */
681 static __inline __m64
682 _mm_cmpeq_pi32 (__m64 __m1
, __m64 __m2
)
684 return (__m64
) __builtin_arm_wcmpeqw ((__v2si
)__m1
, (__v2si
)__m2
);
687 static __inline __m64
688 _mm_cmpgt_pi32 (__m64 __m1
, __m64 __m2
)
690 return (__m64
) __builtin_arm_wcmpgtsw ((__v2si
)__m1
, (__v2si
)__m2
);
693 static __inline __m64
694 _mm_cmpgt_pu32 (__m64 __m1
, __m64 __m2
)
696 return (__m64
) __builtin_arm_wcmpgtuw ((__v2si
)__m1
, (__v2si
)__m2
);
699 /* Element-wise multiplication of unsigned 16-bit values __B and __C, followed
700 by accumulate across all elements and __A. */
701 static __inline __m64
702 _mm_mac_pu16 (__m64 __A
, __m64 __B
, __m64 __C
)
704 return __builtin_arm_wmacu (__A
, (__v4hi
)__B
, (__v4hi
)__C
);
707 /* Element-wise multiplication of signed 16-bit values __B and __C, followed
708 by accumulate across all elements and __A. */
709 static __inline __m64
710 _mm_mac_pi16 (__m64 __A
, __m64 __B
, __m64 __C
)
712 return __builtin_arm_wmacs (__A
, (__v4hi
)__B
, (__v4hi
)__C
);
715 /* Element-wise multiplication of unsigned 16-bit values __B and __C, followed
716 by accumulate across all elements. */
717 static __inline __m64
718 _mm_macz_pu16 (__m64 __A
, __m64 __B
)
720 return __builtin_arm_wmacuz ((__v4hi
)__A
, (__v4hi
)__B
);
723 /* Element-wise multiplication of signed 16-bit values __B and __C, followed
724 by accumulate across all elements. */
725 static __inline __m64
726 _mm_macz_pi16 (__m64 __A
, __m64 __B
)
728 return __builtin_arm_wmacsz ((__v4hi
)__A
, (__v4hi
)__B
);
731 /* Accumulate across all unsigned 8-bit values in __A. */
732 static __inline __m64
733 _mm_acc_pu8 (__m64 __A
)
735 return __builtin_arm_waccb ((__v8qi
)__A
);
738 /* Accumulate across all unsigned 16-bit values in __A. */
739 static __inline __m64
740 _mm_acc_pu16 (__m64 __A
)
742 return __builtin_arm_wacch ((__v4hi
)__A
);
745 /* Accumulate across all unsigned 32-bit values in __A. */
746 static __inline __m64
747 _mm_acc_pu32 (__m64 __A
)
749 return __builtin_arm_waccw ((__v2si
)__A
);
752 static __inline __m64
753 _mm_mia_si64 (__m64 __A
, int __B
, int __C
)
755 return __builtin_arm_tmia (__A
, __B
, __C
);
758 static __inline __m64
759 _mm_miaph_si64 (__m64 __A
, int __B
, int __C
)
761 return __builtin_arm_tmiaph (__A
, __B
, __C
);
764 static __inline __m64
765 _mm_miabb_si64 (__m64 __A
, int __B
, int __C
)
767 return __builtin_arm_tmiabb (__A
, __B
, __C
);
770 static __inline __m64
771 _mm_miabt_si64 (__m64 __A
, int __B
, int __C
)
773 return __builtin_arm_tmiabt (__A
, __B
, __C
);
776 static __inline __m64
777 _mm_miatb_si64 (__m64 __A
, int __B
, int __C
)
779 return __builtin_arm_tmiatb (__A
, __B
, __C
);
782 static __inline __m64
783 _mm_miatt_si64 (__m64 __A
, int __B
, int __C
)
785 return __builtin_arm_tmiatt (__A
, __B
, __C
);
788 /* Extract one of the elements of A and sign extend. The selector N must
790 #define _mm_extract_pi8(A, N) __builtin_arm_textrmsb ((__v8qi)(A), (N))
791 #define _mm_extract_pi16(A, N) __builtin_arm_textrmsh ((__v4hi)(A), (N))
792 #define _mm_extract_pi32(A, N) __builtin_arm_textrmsw ((__v2si)(A), (N))
794 /* Extract one of the elements of A and zero extend. The selector N must
796 #define _mm_extract_pu8(A, N) __builtin_arm_textrmub ((__v8qi)(A), (N))
797 #define _mm_extract_pu16(A, N) __builtin_arm_textrmuh ((__v4hi)(A), (N))
798 #define _mm_extract_pu32(A, N) __builtin_arm_textrmuw ((__v2si)(A), (N))
800 /* Inserts word D into one of the elements of A. The selector N must be
802 #define _mm_insert_pi8(A, D, N) \
803 ((__m64) __builtin_arm_tinsrb ((__v8qi)(A), (D), (N)))
804 #define _mm_insert_pi16(A, D, N) \
805 ((__m64) __builtin_arm_tinsrh ((__v4hi)(A), (D), (N)))
806 #define _mm_insert_pi32(A, D, N) \
807 ((__m64) __builtin_arm_tinsrw ((__v2si)(A), (D), (N)))
809 /* Compute the element-wise maximum of signed 8-bit values. */
810 static __inline __m64
811 _mm_max_pi8 (__m64 __A
, __m64 __B
)
813 return (__m64
) __builtin_arm_wmaxsb ((__v8qi
)__A
, (__v8qi
)__B
);
816 /* Compute the element-wise maximum of signed 16-bit values. */
817 static __inline __m64
818 _mm_max_pi16 (__m64 __A
, __m64 __B
)
820 return (__m64
) __builtin_arm_wmaxsh ((__v4hi
)__A
, (__v4hi
)__B
);
823 /* Compute the element-wise maximum of signed 32-bit values. */
824 static __inline __m64
825 _mm_max_pi32 (__m64 __A
, __m64 __B
)
827 return (__m64
) __builtin_arm_wmaxsw ((__v2si
)__A
, (__v2si
)__B
);
830 /* Compute the element-wise maximum of unsigned 8-bit values. */
831 static __inline __m64
832 _mm_max_pu8 (__m64 __A
, __m64 __B
)
834 return (__m64
) __builtin_arm_wmaxub ((__v8qi
)__A
, (__v8qi
)__B
);
837 /* Compute the element-wise maximum of unsigned 16-bit values. */
838 static __inline __m64
839 _mm_max_pu16 (__m64 __A
, __m64 __B
)
841 return (__m64
) __builtin_arm_wmaxuh ((__v4hi
)__A
, (__v4hi
)__B
);
844 /* Compute the element-wise maximum of unsigned 32-bit values. */
845 static __inline __m64
846 _mm_max_pu32 (__m64 __A
, __m64 __B
)
848 return (__m64
) __builtin_arm_wmaxuw ((__v2si
)__A
, (__v2si
)__B
);
851 /* Compute the element-wise minimum of signed 16-bit values. */
852 static __inline __m64
853 _mm_min_pi8 (__m64 __A
, __m64 __B
)
855 return (__m64
) __builtin_arm_wminsb ((__v8qi
)__A
, (__v8qi
)__B
);
858 /* Compute the element-wise minimum of signed 16-bit values. */
859 static __inline __m64
860 _mm_min_pi16 (__m64 __A
, __m64 __B
)
862 return (__m64
) __builtin_arm_wminsh ((__v4hi
)__A
, (__v4hi
)__B
);
865 /* Compute the element-wise minimum of signed 32-bit values. */
866 static __inline __m64
867 _mm_min_pi32 (__m64 __A
, __m64 __B
)
869 return (__m64
) __builtin_arm_wminsw ((__v2si
)__A
, (__v2si
)__B
);
872 /* Compute the element-wise minimum of unsigned 16-bit values. */
873 static __inline __m64
874 _mm_min_pu8 (__m64 __A
, __m64 __B
)
876 return (__m64
) __builtin_arm_wminub ((__v8qi
)__A
, (__v8qi
)__B
);
879 /* Compute the element-wise minimum of unsigned 16-bit values. */
880 static __inline __m64
881 _mm_min_pu16 (__m64 __A
, __m64 __B
)
883 return (__m64
) __builtin_arm_wminuh ((__v4hi
)__A
, (__v4hi
)__B
);
886 /* Compute the element-wise minimum of unsigned 32-bit values. */
887 static __inline __m64
888 _mm_min_pu32 (__m64 __A
, __m64 __B
)
890 return (__m64
) __builtin_arm_wminuw ((__v2si
)__A
, (__v2si
)__B
);
893 /* Create an 8-bit mask of the signs of 8-bit values. */
895 _mm_movemask_pi8 (__m64 __A
)
897 return __builtin_arm_tmovmskb ((__v8qi
)__A
);
900 /* Create an 8-bit mask of the signs of 16-bit values. */
902 _mm_movemask_pi16 (__m64 __A
)
904 return __builtin_arm_tmovmskh ((__v4hi
)__A
);
907 /* Create an 8-bit mask of the signs of 32-bit values. */
909 _mm_movemask_pi32 (__m64 __A
)
911 return __builtin_arm_tmovmskw ((__v2si
)__A
);
914 /* Return a combination of the four 16-bit values in A. The selector
915 must be an immediate. */
916 #define _mm_shuffle_pi16(A, N) \
917 ((__m64) __builtin_arm_wshufh ((__v4hi)(A), (N)))
920 /* Compute the rounded averages of the unsigned 8-bit values in A and B. */
921 static __inline __m64
922 _mm_avg_pu8 (__m64 __A
, __m64 __B
)
924 return (__m64
) __builtin_arm_wavg2br ((__v8qi
)__A
, (__v8qi
)__B
);
927 /* Compute the rounded averages of the unsigned 16-bit values in A and B. */
928 static __inline __m64
929 _mm_avg_pu16 (__m64 __A
, __m64 __B
)
931 return (__m64
) __builtin_arm_wavg2hr ((__v4hi
)__A
, (__v4hi
)__B
);
934 /* Compute the averages of the unsigned 8-bit values in A and B. */
935 static __inline __m64
936 _mm_avg2_pu8 (__m64 __A
, __m64 __B
)
938 return (__m64
) __builtin_arm_wavg2b ((__v8qi
)__A
, (__v8qi
)__B
);
941 /* Compute the averages of the unsigned 16-bit values in A and B. */
942 static __inline __m64
943 _mm_avg2_pu16 (__m64 __A
, __m64 __B
)
945 return (__m64
) __builtin_arm_wavg2h ((__v4hi
)__A
, (__v4hi
)__B
);
948 /* Compute the sum of the absolute differences of the unsigned 8-bit
949 values in A and B. Return the value in the lower 16-bit word; the
950 upper words are cleared. */
951 static __inline __m64
952 _mm_sad_pu8 (__m64 __A
, __m64 __B
)
954 return (__m64
) __builtin_arm_wsadbz ((__v8qi
)__A
, (__v8qi
)__B
);
957 static __inline __m64
958 _mm_sada_pu8 (__m64 __A
, __m64 __B
, __m64 __C
)
960 return (__m64
) __builtin_arm_wsadb ((__v2si
)__A
, (__v8qi
)__B
, (__v8qi
)__C
);
963 /* Compute the sum of the absolute differences of the unsigned 16-bit
964 values in A and B. Return the value in the lower 32-bit word; the
965 upper words are cleared. */
966 static __inline __m64
967 _mm_sad_pu16 (__m64 __A
, __m64 __B
)
969 return (__m64
) __builtin_arm_wsadhz ((__v4hi
)__A
, (__v4hi
)__B
);
972 static __inline __m64
973 _mm_sada_pu16 (__m64 __A
, __m64 __B
, __m64 __C
)
975 return (__m64
) __builtin_arm_wsadh ((__v2si
)__A
, (__v4hi
)__B
, (__v4hi
)__C
);
979 /* Compute the sum of the absolute differences of the unsigned 8-bit
980 values in A and B. Return the value in the lower 16-bit word; the
981 upper words are cleared. */
982 static __inline __m64
983 _mm_sadz_pu8 (__m64 __A
, __m64 __B
)
985 return (__m64
) __builtin_arm_wsadbz ((__v8qi
)__A
, (__v8qi
)__B
);
988 /* Compute the sum of the absolute differences of the unsigned 16-bit
989 values in A and B. Return the value in the lower 32-bit word; the
990 upper words are cleared. */
991 static __inline __m64
992 _mm_sadz_pu16 (__m64 __A
, __m64 __B
)
994 return (__m64
) __builtin_arm_wsadhz ((__v4hi
)__A
, (__v4hi
)__B
);
997 #define _mm_align_si64(__A,__B, N) \
998 (__m64) __builtin_arm_walign ((__v8qi) (__A),(__v8qi) (__B), (N))
1000 /* Creates a 64-bit zero. */
1001 static __inline __m64
1002 _mm_setzero_si64 (void)
1004 return __builtin_arm_wzero ();
1007 /* Set and Get arbitrary iWMMXt Control registers.
1008 Note only registers 0-3 and 8-11 are currently defined,
1009 the rest are reserved. */
1011 static __inline
void
1012 _mm_setwcx (const int __value
, const int __regno
)
1017 __asm
__volatile ("tmcr wcid, %0" :: "r"(__value
));
1020 __asm
__volatile ("tmcr wcon, %0" :: "r"(__value
));
1023 __asm
__volatile ("tmcr wcssf, %0" :: "r"(__value
));
1026 __asm
__volatile ("tmcr wcasf, %0" :: "r"(__value
));
1029 __builtin_arm_setwcgr0 (__value
);
1032 __builtin_arm_setwcgr1 (__value
);
1035 __builtin_arm_setwcgr2 (__value
);
1038 __builtin_arm_setwcgr3 (__value
);
1046 _mm_getwcx (const int __regno
)
1052 __asm
__volatile ("tmrc %0, wcid" : "=r"(__value
));
1055 __asm
__volatile ("tmrc %0, wcon" : "=r"(__value
));
1058 __asm
__volatile ("tmrc %0, wcssf" : "=r"(__value
));
1061 __asm
__volatile ("tmrc %0, wcasf" : "=r"(__value
));
1064 return __builtin_arm_getwcgr0 ();
1066 return __builtin_arm_getwcgr1 ();
1068 return __builtin_arm_getwcgr2 ();
1070 return __builtin_arm_getwcgr3 ();
1077 /* Creates a vector of two 32-bit values; I0 is least significant. */
1078 static __inline __m64
1079 _mm_set_pi32 (int __i1
, int __i0
)
1091 __u
.__s
.__i0
= __i0
;
1092 __u
.__s
.__i1
= __i1
;
1097 /* Creates a vector of four 16-bit values; W0 is least significant. */
1098 static __inline __m64
1099 _mm_set_pi16 (short __w3
, short __w2
, short __w1
, short __w0
)
1101 unsigned int __i1
= (unsigned short) __w3
<< 16 | (unsigned short) __w2
;
1102 unsigned int __i0
= (unsigned short) __w1
<< 16 | (unsigned short) __w0
;
1104 return _mm_set_pi32 (__i1
, __i0
);
1107 /* Creates a vector of eight 8-bit values; B0 is least significant. */
1108 static __inline __m64
1109 _mm_set_pi8 (char __b7
, char __b6
, char __b5
, char __b4
,
1110 char __b3
, char __b2
, char __b1
, char __b0
)
1112 unsigned int __i1
, __i0
;
1114 __i1
= (unsigned char)__b7
;
1115 __i1
= __i1
<< 8 | (unsigned char)__b6
;
1116 __i1
= __i1
<< 8 | (unsigned char)__b5
;
1117 __i1
= __i1
<< 8 | (unsigned char)__b4
;
1119 __i0
= (unsigned char)__b3
;
1120 __i0
= __i0
<< 8 | (unsigned char)__b2
;
1121 __i0
= __i0
<< 8 | (unsigned char)__b1
;
1122 __i0
= __i0
<< 8 | (unsigned char)__b0
;
1124 return _mm_set_pi32 (__i1
, __i0
);
1127 /* Similar, but with the arguments in reverse order. */
1128 static __inline __m64
1129 _mm_setr_pi32 (int __i0
, int __i1
)
1131 return _mm_set_pi32 (__i1
, __i0
);
1134 static __inline __m64
1135 _mm_setr_pi16 (short __w0
, short __w1
, short __w2
, short __w3
)
1137 return _mm_set_pi16 (__w3
, __w2
, __w1
, __w0
);
1140 static __inline __m64
1141 _mm_setr_pi8 (char __b0
, char __b1
, char __b2
, char __b3
,
1142 char __b4
, char __b5
, char __b6
, char __b7
)
1144 return _mm_set_pi8 (__b7
, __b6
, __b5
, __b4
, __b3
, __b2
, __b1
, __b0
);
1147 /* Creates a vector of two 32-bit values, both elements containing I. */
1148 static __inline __m64
1149 _mm_set1_pi32 (int __i
)
1151 return _mm_set_pi32 (__i
, __i
);
1154 /* Creates a vector of four 16-bit values, all elements containing W. */
1155 static __inline __m64
1156 _mm_set1_pi16 (short __w
)
1158 unsigned int __i
= (unsigned short)__w
<< 16 | (unsigned short)__w
;
1159 return _mm_set1_pi32 (__i
);
1162 /* Creates a vector of four 16-bit values, all elements containing B. */
1163 static __inline __m64
1164 _mm_set1_pi8 (char __b
)
1166 unsigned int __w
= (unsigned char)__b
<< 8 | (unsigned char)__b
;
1167 unsigned int __i
= __w
<< 16 | __w
;
1168 return _mm_set1_pi32 (__i
);
1172 static __inline __m64
1173 _mm_abs_pi8 (__m64 m1
)
1175 return (__m64
) __builtin_arm_wabsb ((__v8qi
)m1
);
1178 static __inline __m64
1179 _mm_abs_pi16 (__m64 m1
)
1181 return (__m64
) __builtin_arm_wabsh ((__v4hi
)m1
);
1185 static __inline __m64
1186 _mm_abs_pi32 (__m64 m1
)
1188 return (__m64
) __builtin_arm_wabsw ((__v2si
)m1
);
1192 static __inline __m64
1193 _mm_addsubhx_pi16 (__m64 a
, __m64 b
)
1195 return (__m64
) __builtin_arm_waddsubhx ((__v4hi
)a
, (__v4hi
)b
);
1198 static __inline __m64
1199 _mm_absdiff_pu8 (__m64 a
, __m64 b
)
1201 return (__m64
) __builtin_arm_wabsdiffb ((__v8qi
)a
, (__v8qi
)b
);
1204 static __inline __m64
1205 _mm_absdiff_pu16 (__m64 a
, __m64 b
)
1207 return (__m64
) __builtin_arm_wabsdiffh ((__v4hi
)a
, (__v4hi
)b
);
1210 static __inline __m64
1211 _mm_absdiff_pu32 (__m64 a
, __m64 b
)
1213 return (__m64
) __builtin_arm_wabsdiffw ((__v2si
)a
, (__v2si
)b
);
1216 static __inline __m64
1217 _mm_addc_pu16 (__m64 a
, __m64 b
)
1220 __asm__
__volatile__ ("waddhc %0, %1, %2" : "=y" (result
) : "y" (a
), "y" (b
));
1224 static __inline __m64
1225 _mm_addc_pu32 (__m64 a
, __m64 b
)
1228 __asm__
__volatile__ ("waddwc %0, %1, %2" : "=y" (result
) : "y" (a
), "y" (b
));
1232 static __inline __m64
1233 _mm_avg4_pu8 (__m64 a
, __m64 b
)
1235 return (__m64
) __builtin_arm_wavg4 ((__v8qi
)a
, (__v8qi
)b
);
1238 static __inline __m64
1239 _mm_avg4r_pu8 (__m64 a
, __m64 b
)
1241 return (__m64
) __builtin_arm_wavg4r ((__v8qi
)a
, (__v8qi
)b
);
1244 static __inline __m64
1245 _mm_maddx_pi16 (__m64 a
, __m64 b
)
1247 return (__m64
) __builtin_arm_wmaddsx ((__v4hi
)a
, (__v4hi
)b
);
1250 static __inline __m64
1251 _mm_maddx_pu16 (__m64 a
, __m64 b
)
1253 return (__m64
) __builtin_arm_wmaddux ((__v4hi
)a
, (__v4hi
)b
);
1256 static __inline __m64
1257 _mm_msub_pi16 (__m64 a
, __m64 b
)
1259 return (__m64
) __builtin_arm_wmaddsn ((__v4hi
)a
, (__v4hi
)b
);
1262 static __inline __m64
1263 _mm_msub_pu16 (__m64 a
, __m64 b
)
1265 return (__m64
) __builtin_arm_wmaddun ((__v4hi
)a
, (__v4hi
)b
);
1268 static __inline __m64
1269 _mm_mulhi_pi32 (__m64 a
, __m64 b
)
1271 return (__m64
) __builtin_arm_wmulwsm ((__v2si
)a
, (__v2si
)b
);
1274 static __inline __m64
1275 _mm_mulhi_pu32 (__m64 a
, __m64 b
)
1277 return (__m64
) __builtin_arm_wmulwum ((__v2si
)a
, (__v2si
)b
);
1280 static __inline __m64
1281 _mm_mulhir_pi16 (__m64 a
, __m64 b
)
1283 return (__m64
) __builtin_arm_wmulsmr ((__v4hi
)a
, (__v4hi
)b
);
1286 static __inline __m64
1287 _mm_mulhir_pi32 (__m64 a
, __m64 b
)
1289 return (__m64
) __builtin_arm_wmulwsmr ((__v2si
)a
, (__v2si
)b
);
1292 static __inline __m64
1293 _mm_mulhir_pu16 (__m64 a
, __m64 b
)
1295 return (__m64
) __builtin_arm_wmulumr ((__v4hi
)a
, (__v4hi
)b
);
1298 static __inline __m64
1299 _mm_mulhir_pu32 (__m64 a
, __m64 b
)
1301 return (__m64
) __builtin_arm_wmulwumr ((__v2si
)a
, (__v2si
)b
);
1304 static __inline __m64
1305 _mm_mullo_pi32 (__m64 a
, __m64 b
)
1307 return (__m64
) __builtin_arm_wmulwl ((__v2si
)a
, (__v2si
)b
);
1310 static __inline __m64
1311 _mm_qmulm_pi16 (__m64 a
, __m64 b
)
1313 return (__m64
) __builtin_arm_wqmulm ((__v4hi
)a
, (__v4hi
)b
);
1316 static __inline __m64
1317 _mm_qmulm_pi32 (__m64 a
, __m64 b
)
1319 return (__m64
) __builtin_arm_wqmulwm ((__v2si
)a
, (__v2si
)b
);
1322 static __inline __m64
1323 _mm_qmulmr_pi16 (__m64 a
, __m64 b
)
1325 return (__m64
) __builtin_arm_wqmulmr ((__v4hi
)a
, (__v4hi
)b
);
1328 static __inline __m64
1329 _mm_qmulmr_pi32 (__m64 a
, __m64 b
)
1331 return (__m64
) __builtin_arm_wqmulwmr ((__v2si
)a
, (__v2si
)b
);
1334 static __inline __m64
1335 _mm_subaddhx_pi16 (__m64 a
, __m64 b
)
1337 return (__m64
) __builtin_arm_wsubaddhx ((__v4hi
)a
, (__v4hi
)b
);
1340 static __inline __m64
1341 _mm_addbhusl_pu8 (__m64 a
, __m64 b
)
1343 return (__m64
) __builtin_arm_waddbhusl ((__v4hi
)a
, (__v8qi
)b
);
1346 static __inline __m64
1347 _mm_addbhusm_pu8 (__m64 a
, __m64 b
)
1349 return (__m64
) __builtin_arm_waddbhusm ((__v4hi
)a
, (__v8qi
)b
);
1352 #define _mm_qmiabb_pi32(acc, m1, m2) \
1357 _acc = (__m64) __builtin_arm_wqmiabb ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1361 #define _mm_qmiabbn_pi32(acc, m1, m2) \
1366 _acc = (__m64) __builtin_arm_wqmiabbn ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1370 #define _mm_qmiabt_pi32(acc, m1, m2) \
1375 _acc = (__m64) __builtin_arm_wqmiabt ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1379 #define _mm_qmiabtn_pi32(acc, m1, m2) \
1384 _acc = (__m64) __builtin_arm_wqmiabtn ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1388 #define _mm_qmiatb_pi32(acc, m1, m2) \
1393 _acc = (__m64) __builtin_arm_wqmiatb ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1397 #define _mm_qmiatbn_pi32(acc, m1, m2) \
1402 _acc = (__m64) __builtin_arm_wqmiatbn ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1406 #define _mm_qmiatt_pi32(acc, m1, m2) \
1411 _acc = (__m64) __builtin_arm_wqmiatt ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1415 #define _mm_qmiattn_pi32(acc, m1, m2) \
1420 _acc = (__m64) __builtin_arm_wqmiattn ((__v2si)_acc, (__v4hi)_m1, (__v4hi)_m2);\
1424 #define _mm_wmiabb_si64(acc, m1, m2) \
1429 _acc = (__m64) __builtin_arm_wmiabb (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1433 #define _mm_wmiabbn_si64(acc, m1, m2) \
1438 _acc = (__m64) __builtin_arm_wmiabbn (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1442 #define _mm_wmiabt_si64(acc, m1, m2) \
1447 _acc = (__m64) __builtin_arm_wmiabt (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1451 #define _mm_wmiabtn_si64(acc, m1, m2) \
1456 _acc = (__m64) __builtin_arm_wmiabtn (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1460 #define _mm_wmiatb_si64(acc, m1, m2) \
1465 _acc = (__m64) __builtin_arm_wmiatb (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1469 #define _mm_wmiatbn_si64(acc, m1, m2) \
1474 _acc = (__m64) __builtin_arm_wmiatbn (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1478 #define _mm_wmiatt_si64(acc, m1, m2) \
1483 _acc = (__m64) __builtin_arm_wmiatt (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1487 #define _mm_wmiattn_si64(acc, m1, m2) \
1492 _acc = (__m64) __builtin_arm_wmiattn (_acc, (__v4hi)_m1, (__v4hi)_m2);\
1496 #define _mm_wmiawbb_si64(acc, m1, m2) \
1501 _acc = (__m64) __builtin_arm_wmiawbb (_acc, (__v2si)_m1, (__v2si)_m2);\
1505 #define _mm_wmiawbbn_si64(acc, m1, m2) \
1510 _acc = (__m64) __builtin_arm_wmiawbbn (_acc, (__v2si)_m1, (__v2si)_m2);\
1514 #define _mm_wmiawbt_si64(acc, m1, m2) \
1519 _acc = (__m64) __builtin_arm_wmiawbt (_acc, (__v2si)_m1, (__v2si)_m2);\
1523 #define _mm_wmiawbtn_si64(acc, m1, m2) \
1528 _acc = (__m64) __builtin_arm_wmiawbtn (_acc, (__v2si)_m1, (__v2si)_m2);\
1532 #define _mm_wmiawtb_si64(acc, m1, m2) \
1537 _acc = (__m64) __builtin_arm_wmiawtb (_acc, (__v2si)_m1, (__v2si)_m2);\
1541 #define _mm_wmiawtbn_si64(acc, m1, m2) \
1546 _acc = (__m64) __builtin_arm_wmiawtbn (_acc, (__v2si)_m1, (__v2si)_m2);\
1550 #define _mm_wmiawtt_si64(acc, m1, m2) \
1555 _acc = (__m64) __builtin_arm_wmiawtt (_acc, (__v2si)_m1, (__v2si)_m2);\
1559 #define _mm_wmiawttn_si64(acc, m1, m2) \
1564 _acc = (__m64) __builtin_arm_wmiawttn (_acc, (__v2si)_m1, (__v2si)_m2);\
1568 /* The third arguments should be an immediate. */
1569 #define _mm_merge_si64(a, b, n) \
1572 result = (__m64) __builtin_arm_wmerge ((__m64) (a), (__m64) (b), (n));\
1575 #endif /* __IWMMXT2__ */
1577 static __inline __m64
1578 _mm_alignr0_si64 (__m64 a
, __m64 b
)
1580 return (__m64
) __builtin_arm_walignr0 ((__v8qi
) a
, (__v8qi
) b
);
1583 static __inline __m64
1584 _mm_alignr1_si64 (__m64 a
, __m64 b
)
1586 return (__m64
) __builtin_arm_walignr1 ((__v8qi
) a
, (__v8qi
) b
);
1589 static __inline __m64
1590 _mm_alignr2_si64 (__m64 a
, __m64 b
)
1592 return (__m64
) __builtin_arm_walignr2 ((__v8qi
) a
, (__v8qi
) b
);
1595 static __inline __m64
1596 _mm_alignr3_si64 (__m64 a
, __m64 b
)
1598 return (__m64
) __builtin_arm_walignr3 ((__v8qi
) a
, (__v8qi
) b
);
1601 static __inline
void
1604 __asm
__volatile ("tandcb r15");
1607 static __inline
void
1610 __asm
__volatile ("tandch r15");
1613 static __inline
void
1616 __asm
__volatile ("tandcw r15");
1619 #define _mm_textrcb(n) \
1621 __asm__ __volatile__ (\
1622 "textrcb r15, %0" : : "i" (n));\
1625 #define _mm_textrch(n) \
1627 __asm__ __volatile__ (\
1628 "textrch r15, %0" : : "i" (n));\
1631 #define _mm_textrcw(n) \
1633 __asm__ __volatile__ (\
1634 "textrcw r15, %0" : : "i" (n));\
1637 static __inline
void
1640 __asm
__volatile ("torcb r15");
1643 static __inline
void
1646 __asm
__volatile ("torch r15");
1649 static __inline
void
1652 __asm
__volatile ("torcw r15");
1656 static __inline
void
1659 __asm
__volatile ("torvscb r15");
1662 static __inline
void
1665 __asm
__volatile ("torvsch r15");
1668 static __inline
void
1671 __asm
__volatile ("torvscw r15");
1673 #endif /* __IWMMXT2__ */
1675 static __inline __m64
1676 _mm_tbcst_pi8 (int value
)
1678 return (__m64
) __builtin_arm_tbcstb ((signed char) value
);
1681 static __inline __m64
1682 _mm_tbcst_pi16 (int value
)
1684 return (__m64
) __builtin_arm_tbcsth ((short) value
);
1687 static __inline __m64
1688 _mm_tbcst_pi32 (int value
)
1690 return (__m64
) __builtin_arm_tbcstw (value
);
1693 #define _m_empty _mm_empty
1694 #define _m_packsswb _mm_packs_pi16
1695 #define _m_packssdw _mm_packs_pi32
1696 #define _m_packuswb _mm_packs_pu16
1697 #define _m_packusdw _mm_packs_pu32
1698 #define _m_packssqd _mm_packs_pi64
1699 #define _m_packusqd _mm_packs_pu64
1700 #define _mm_packs_si64 _mm_packs_pi64
1701 #define _mm_packs_su64 _mm_packs_pu64
1702 #define _m_punpckhbw _mm_unpackhi_pi8
1703 #define _m_punpckhwd _mm_unpackhi_pi16
1704 #define _m_punpckhdq _mm_unpackhi_pi32
1705 #define _m_punpcklbw _mm_unpacklo_pi8
1706 #define _m_punpcklwd _mm_unpacklo_pi16
1707 #define _m_punpckldq _mm_unpacklo_pi32
1708 #define _m_punpckehsbw _mm_unpackeh_pi8
1709 #define _m_punpckehswd _mm_unpackeh_pi16
1710 #define _m_punpckehsdq _mm_unpackeh_pi32
1711 #define _m_punpckehubw _mm_unpackeh_pu8
1712 #define _m_punpckehuwd _mm_unpackeh_pu16
1713 #define _m_punpckehudq _mm_unpackeh_pu32
1714 #define _m_punpckelsbw _mm_unpackel_pi8
1715 #define _m_punpckelswd _mm_unpackel_pi16
1716 #define _m_punpckelsdq _mm_unpackel_pi32
1717 #define _m_punpckelubw _mm_unpackel_pu8
1718 #define _m_punpckeluwd _mm_unpackel_pu16
1719 #define _m_punpckeludq _mm_unpackel_pu32
1720 #define _m_paddb _mm_add_pi8
1721 #define _m_paddw _mm_add_pi16
1722 #define _m_paddd _mm_add_pi32
1723 #define _m_paddsb _mm_adds_pi8
1724 #define _m_paddsw _mm_adds_pi16
1725 #define _m_paddsd _mm_adds_pi32
1726 #define _m_paddusb _mm_adds_pu8
1727 #define _m_paddusw _mm_adds_pu16
1728 #define _m_paddusd _mm_adds_pu32
1729 #define _m_psubb _mm_sub_pi8
1730 #define _m_psubw _mm_sub_pi16
1731 #define _m_psubd _mm_sub_pi32
1732 #define _m_psubsb _mm_subs_pi8
1733 #define _m_psubsw _mm_subs_pi16
1734 #define _m_psubuw _mm_subs_pi32
1735 #define _m_psubusb _mm_subs_pu8
1736 #define _m_psubusw _mm_subs_pu16
1737 #define _m_psubusd _mm_subs_pu32
1738 #define _m_pmaddwd _mm_madd_pi16
1739 #define _m_pmadduwd _mm_madd_pu16
1740 #define _m_pmulhw _mm_mulhi_pi16
1741 #define _m_pmulhuw _mm_mulhi_pu16
1742 #define _m_pmullw _mm_mullo_pi16
1743 #define _m_pmacsw _mm_mac_pi16
1744 #define _m_pmacuw _mm_mac_pu16
1745 #define _m_pmacszw _mm_macz_pi16
1746 #define _m_pmacuzw _mm_macz_pu16
1747 #define _m_paccb _mm_acc_pu8
1748 #define _m_paccw _mm_acc_pu16
1749 #define _m_paccd _mm_acc_pu32
1750 #define _m_pmia _mm_mia_si64
1751 #define _m_pmiaph _mm_miaph_si64
1752 #define _m_pmiabb _mm_miabb_si64
1753 #define _m_pmiabt _mm_miabt_si64
1754 #define _m_pmiatb _mm_miatb_si64
1755 #define _m_pmiatt _mm_miatt_si64
1756 #define _m_psllw _mm_sll_pi16
1757 #define _m_psllwi _mm_slli_pi16
1758 #define _m_pslld _mm_sll_pi32
1759 #define _m_pslldi _mm_slli_pi32
1760 #define _m_psllq _mm_sll_si64
1761 #define _m_psllqi _mm_slli_si64
1762 #define _m_psraw _mm_sra_pi16
1763 #define _m_psrawi _mm_srai_pi16
1764 #define _m_psrad _mm_sra_pi32
1765 #define _m_psradi _mm_srai_pi32
1766 #define _m_psraq _mm_sra_si64
1767 #define _m_psraqi _mm_srai_si64
1768 #define _m_psrlw _mm_srl_pi16
1769 #define _m_psrlwi _mm_srli_pi16
1770 #define _m_psrld _mm_srl_pi32
1771 #define _m_psrldi _mm_srli_pi32
1772 #define _m_psrlq _mm_srl_si64
1773 #define _m_psrlqi _mm_srli_si64
1774 #define _m_prorw _mm_ror_pi16
1775 #define _m_prorwi _mm_rori_pi16
1776 #define _m_prord _mm_ror_pi32
1777 #define _m_prordi _mm_rori_pi32
1778 #define _m_prorq _mm_ror_si64
1779 #define _m_prorqi _mm_rori_si64
1780 #define _m_pand _mm_and_si64
1781 #define _m_pandn _mm_andnot_si64
1782 #define _m_por _mm_or_si64
1783 #define _m_pxor _mm_xor_si64
1784 #define _m_pcmpeqb _mm_cmpeq_pi8
1785 #define _m_pcmpeqw _mm_cmpeq_pi16
1786 #define _m_pcmpeqd _mm_cmpeq_pi32
1787 #define _m_pcmpgtb _mm_cmpgt_pi8
1788 #define _m_pcmpgtub _mm_cmpgt_pu8
1789 #define _m_pcmpgtw _mm_cmpgt_pi16
1790 #define _m_pcmpgtuw _mm_cmpgt_pu16
1791 #define _m_pcmpgtd _mm_cmpgt_pi32
1792 #define _m_pcmpgtud _mm_cmpgt_pu32
1793 #define _m_pextrb _mm_extract_pi8
1794 #define _m_pextrw _mm_extract_pi16
1795 #define _m_pextrd _mm_extract_pi32
1796 #define _m_pextrub _mm_extract_pu8
1797 #define _m_pextruw _mm_extract_pu16
1798 #define _m_pextrud _mm_extract_pu32
1799 #define _m_pinsrb _mm_insert_pi8
1800 #define _m_pinsrw _mm_insert_pi16
1801 #define _m_pinsrd _mm_insert_pi32
1802 #define _m_pmaxsb _mm_max_pi8
1803 #define _m_pmaxsw _mm_max_pi16
1804 #define _m_pmaxsd _mm_max_pi32
1805 #define _m_pmaxub _mm_max_pu8
1806 #define _m_pmaxuw _mm_max_pu16
1807 #define _m_pmaxud _mm_max_pu32
1808 #define _m_pminsb _mm_min_pi8
1809 #define _m_pminsw _mm_min_pi16
1810 #define _m_pminsd _mm_min_pi32
1811 #define _m_pminub _mm_min_pu8
1812 #define _m_pminuw _mm_min_pu16
1813 #define _m_pminud _mm_min_pu32
1814 #define _m_pmovmskb _mm_movemask_pi8
1815 #define _m_pmovmskw _mm_movemask_pi16
1816 #define _m_pmovmskd _mm_movemask_pi32
1817 #define _m_pshufw _mm_shuffle_pi16
1818 #define _m_pavgb _mm_avg_pu8
1819 #define _m_pavgw _mm_avg_pu16
1820 #define _m_pavg2b _mm_avg2_pu8
1821 #define _m_pavg2w _mm_avg2_pu16
1822 #define _m_psadbw _mm_sad_pu8
1823 #define _m_psadwd _mm_sad_pu16
1824 #define _m_psadzbw _mm_sadz_pu8
1825 #define _m_psadzwd _mm_sadz_pu16
1826 #define _m_paligniq _mm_align_si64
1827 #define _m_cvt_si2pi _mm_cvtsi64_m64
1828 #define _m_cvt_pi2si _mm_cvtm64_si64
1829 #define _m_from_int _mm_cvtsi32_si64
1830 #define _m_to_int _mm_cvtsi64_si32
1832 #if defined __cplusplus
1834 #endif /* __cplusplus */
1836 #endif /* _MMINTRIN_H_INCLUDED */