137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson/*===---- mmintrin.h - MMX intrinsics --------------------------------------===
237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson *
337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * Permission is hereby granted, free of charge, to any person obtaining a copy
437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * of this software and associated documentation files (the "Software"), to deal
537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * in the Software without restriction, including without limitation the rights
637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * copies of the Software, and to permit persons to whom the Software is
837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * furnished to do so, subject to the following conditions:
937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson *
1037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * The above copyright notice and this permission notice shall be included in
1137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * all copies or substantial portions of the Software.
1237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson *
1337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson * THE SOFTWARE.
2037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson *
2137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson *===-----------------------------------------------------------------------===
2237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson */
2337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#ifndef __MMINTRIN_H
2537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#define __MMINTRIN_H
2637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#ifndef __MMX__
2837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#error "MMX instruction set not enabled"
2937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#else
3037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
31edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedmantypedef long long __m64 __attribute__((__vector_size__(8)));
3237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
33edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedmantypedef int __v2si __attribute__((__vector_size__(8)));
34edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedmantypedef short __v4hi __attribute__((__vector_size__(8)));
354bf4e3034e23cc3c177b7c6dda39b28e689e7ed6Anders Carlssontypedef char __v8qi __attribute__((__vector_size__(8)));
3637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
371bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ void __attribute__((__always_inline__, __nodebug__))
38e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_empty(void)
3937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
4037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson    __builtin_ia32_emms();
4137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
4237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
431bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
44e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cvtsi32_si64(int __i)
4537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
46d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
4737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
4837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
491bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ int __attribute__((__always_inline__, __nodebug__))
50e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cvtsi64_si32(__m64 __m)
5137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
52d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
5337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
5437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
551bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
56e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cvtsi64_m64(long long __i)
5737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
58edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__i;
5937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
6037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
611bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))
62e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cvtm64_si64(__m64 __m)
6337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
64edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (long long)__m;
6537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
6637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
671bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
68e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_packs_pi16(__m64 __m1, __m64 __m2)
6937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
70edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
7137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
7237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
731bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
74e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_packs_pi32(__m64 __m1, __m64 __m2)
7537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
76edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
7737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
7837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
791bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
80e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_packs_pu16(__m64 __m1, __m64 __m2)
8137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
82edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
8337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
8437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
851bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
86e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpackhi_pi8(__m64 __m1, __m64 __m2)
8737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
88d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
8937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
9037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
911bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
92e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpackhi_pi16(__m64 __m1, __m64 __m2)
9337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
94d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
9537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
9637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
971bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
98e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpackhi_pi32(__m64 __m1, __m64 __m2)
9937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
100d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
10137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
10237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1031bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
104e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpacklo_pi8(__m64 __m1, __m64 __m2)
10537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
106d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
10737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
10837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1091bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
110e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpacklo_pi16(__m64 __m1, __m64 __m2)
11137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
112d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
11337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
11437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1151bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
116e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_unpacklo_pi32(__m64 __m1, __m64 __m2)
11737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
118d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
11937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
12037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1211bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
122e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_add_pi8(__m64 __m1, __m64 __m2)
12337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
124d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
12537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
12637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1271bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
128e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_add_pi16(__m64 __m1, __m64 __m2)
12937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
130d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
13137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
13237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1331bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
134e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_add_pi32(__m64 __m1, __m64 __m2)
13537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
136d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
13737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
13837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1391bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
140e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_adds_pi8(__m64 __m1, __m64 __m2)
14137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
142edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
14337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
14437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1451bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
146e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_adds_pi16(__m64 __m1, __m64 __m2)
14737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
148edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
14937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
15037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1511bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
152e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_adds_pu8(__m64 __m1, __m64 __m2)
15337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
154edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
15537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
15637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1571bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
158e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_adds_pu16(__m64 __m1, __m64 __m2)
15937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
160edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
16137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
16237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1631bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
164e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sub_pi8(__m64 __m1, __m64 __m2)
16537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
166d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
16737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
16837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1691bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
170e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sub_pi16(__m64 __m1, __m64 __m2)
17137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
172d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
17337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
17437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1751bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
176e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sub_pi32(__m64 __m1, __m64 __m2)
17737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
178d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2);
17937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
18037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1811bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
182e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_subs_pi8(__m64 __m1, __m64 __m2)
18337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
184edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2);
18537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
18637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1871bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
188e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_subs_pi16(__m64 __m1, __m64 __m2)
18937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
190edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2);
19137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
19237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1931bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
194e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_subs_pu8(__m64 __m1, __m64 __m2)
19537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
196edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2);
19737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
19837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
1991bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
200e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_subs_pu16(__m64 __m1, __m64 __m2)
20137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
202edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2);
20337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
20437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2051bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
206e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_madd_pi16(__m64 __m1, __m64 __m2)
20737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
208edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2);
20937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
21037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2111bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
212e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_mulhi_pi16(__m64 __m1, __m64 __m2)
21337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
214edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2);
21537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
21637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2171bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
218e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_mullo_pi16(__m64 __m1, __m64 __m2)
21937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
220d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2);
22137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
22237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2231bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
224e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sll_pi16(__m64 __m, __m64 __count)
22537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
226edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count);
22737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
22837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2291bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
230e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_slli_pi16(__m64 __m, int __count)
23137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
232edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count);
23337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
23437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2351bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
236e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sll_pi32(__m64 __m, __m64 __count)
23737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
238edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_pslld((__v2si)__m, __count);
23937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
24037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2411bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
242e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_slli_pi32(__m64 __m, int __count)
24337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
244edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count);
24537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
24637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2471bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
248e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sll_si64(__m64 __m, __m64 __count)
24937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
250d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psllq(__m, __count);
25137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
25237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2531bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
254e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_slli_si64(__m64 __m, int __count)
25537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
256d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psllqi(__m, __count);
25737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
25837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2591bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
260e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sra_pi16(__m64 __m, __m64 __count)
26137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
262edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count);
26337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
26437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2651bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
266e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srai_pi16(__m64 __m, int __count)
26737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
268edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count);
26937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
27037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2711bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
272e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_sra_pi32(__m64 __m, __m64 __count)
27337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
274edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrad((__v2si)__m, __count);
27537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
27637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2771bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
278e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srai_pi32(__m64 __m, int __count)
27937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
280edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psradi((__v2si)__m, __count);
28137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
28237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2831bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
284e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srl_pi16(__m64 __m, __m64 __count)
28537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
286edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count);
28737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
28837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2891bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
290e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srli_pi16(__m64 __m, int __count)
29137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
292edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count);
29337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
29437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
2951bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
296e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srl_pi32(__m64 __m, __m64 __count)
29737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
298edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrld((__v2si)__m, __count);
29937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
30037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3011bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
302e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srli_pi32(__m64 __m, int __count)
30337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
304edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count);
30537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
30637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3071bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
308e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srl_si64(__m64 __m, __m64 __count)
30937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
310edbd9289b71cd512ae2b3a9b46cdf55b5602aabaEli Friedman    return (__m64)__builtin_ia32_psrlq(__m, __count);
31137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
31237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3131bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
314e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_srli_si64(__m64 __m, int __count)
31537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
316d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_psrlqi(__m, __count);
31737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
31837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3191bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
320e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_and_si64(__m64 __m1, __m64 __m2)
32137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
322d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return __builtin_ia32_pand(__m1, __m2);
32337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
32437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3251bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
326e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_andnot_si64(__m64 __m1, __m64 __m2)
32737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
328d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return __builtin_ia32_pandn(__m1, __m2);
32937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
33037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3311bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
332e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_or_si64(__m64 __m1, __m64 __m2)
33337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
334d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return __builtin_ia32_por(__m1, __m2);
33537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
33637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3371bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
338e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_xor_si64(__m64 __m1, __m64 __m2)
33937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
340d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return __builtin_ia32_pxor(__m1, __m2);
34137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
34237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3431bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
344e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpeq_pi8(__m64 __m1, __m64 __m2)
34537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
346d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2);
34737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
34837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3491bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
350e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpeq_pi16(__m64 __m1, __m64 __m2)
35137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
352d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2);
35337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
35437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3551bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
356e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpeq_pi32(__m64 __m1, __m64 __m2)
35737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
358d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2);
35937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
36037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3611bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
362e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpgt_pi8(__m64 __m1, __m64 __m2)
36337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
364d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2);
36537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
36637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3671bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
368e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpgt_pi16(__m64 __m1, __m64 __m2)
36937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
370d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2);
37137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
37237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3731bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
374e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
37537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
376d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2);
37737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
37837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3791bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
380e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_setzero_si64(void)
38137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
38237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson    return (__m64){ 0LL };
38337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
38437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3851bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
386e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_set_pi32(int __i1, int __i0)
38737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
388d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1);
38937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
39037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3911bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
392e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_set_pi16(short __s3, short __s2, short __s1, short __s0)
39337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
394d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3);
39537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
39637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
3971bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
398e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
399e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump            char __b1, char __b0)
40037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
401d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3,
402d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen                                               __b4, __b5, __b6, __b7);
40337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
40437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4051bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
406e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_set1_pi32(int __i)
40737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
408d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi32(__i, __i);
40937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
41037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4111bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
412d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen_mm_set1_pi16(short __w)
41337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
414d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi16(__w, __w, __w, __w);
41537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
41637958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4171bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
418e308c413fa30dd137648f3fd772a75f6fa5e4d5aMike Stump_mm_set1_pi8(char __b)
41937958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
420d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
42137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
42237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4231bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
42483a401ba1e45b045dbde4894f41fab8869b93a9eEli Friedman_mm_setr_pi32(int __i0, int __i1)
42537958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
426d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi32(__i1, __i0);
42737958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
42837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4291bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
43083a401ba1e45b045dbde4894f41fab8869b93a9eEli Friedman_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)
43137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
432d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi16(__w3, __w2, __w1, __w0);
43337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
43437958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
4351bddbcbd11de09c7bcb48c3d661c447967db73a7Chris Lattnerstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
43683a401ba1e45b045dbde4894f41fab8869b93a9eEli Friedman_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
43783a401ba1e45b045dbde4894f41fab8869b93a9eEli Friedman             char __b6, char __b7)
43837958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson{
439d47e262935f25f704afd03e26482641ca21a1df8Dale Johannesen    return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
44037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson}
44137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
442fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth
443fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth/* Aliases for compatibility. */
444fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_empty _mm_empty
445fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_from_int _mm_cvtsi32_si64
446fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_to_int _mm_cvtsi64_si32
447fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_packsswb _mm_packs_pi16
448fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_packssdw _mm_packs_pi32
449fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_packuswb _mm_packs_pu16
450fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpckhbw _mm_unpackhi_pi8
451fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpckhwd _mm_unpackhi_pi16
452fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpckhdq _mm_unpackhi_pi32
453fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpcklbw _mm_unpacklo_pi8
454fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpcklwd _mm_unpacklo_pi16
455fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_punpckldq _mm_unpacklo_pi32
456fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddb _mm_add_pi8
457fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddw _mm_add_pi16
458fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddd _mm_add_pi32
459fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddsb _mm_adds_pi8
460fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddsw _mm_adds_pi16
461fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddusb _mm_adds_pu8
462fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_paddusw _mm_adds_pu16
463fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubb _mm_sub_pi8
464fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubw _mm_sub_pi16
465fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubd _mm_sub_pi32
466fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubsb _mm_subs_pi8
467fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubsw _mm_subs_pi16
468fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubusb _mm_subs_pu8
469fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psubusw _mm_subs_pu16
470fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pmaddwd _mm_madd_pi16
471fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pmulhw _mm_mulhi_pi16
472fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pmullw _mm_mullo_pi16
473fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psllw _mm_sll_pi16
474fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psllwi _mm_slli_pi16
475fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pslld _mm_sll_pi32
476fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pslldi _mm_slli_pi32
4776b6fe28b3c7824653c5cc06695c92d5aae6e70d7Chandler Carruth#define _m_psllq _mm_sll_si64
4786b6fe28b3c7824653c5cc06695c92d5aae6e70d7Chandler Carruth#define _m_psllqi _mm_slli_si64
479fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psraw _mm_sra_pi16
480fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrawi _mm_srai_pi16
481fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrad _mm_sra_pi32
482fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psradi _mm_srai_pi32
483fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrlw _mm_srl_pi16
484fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrlwi _mm_srli_pi16
485fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrld _mm_srl_pi32
486fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_psrldi _mm_srli_pi32
4876b6fe28b3c7824653c5cc06695c92d5aae6e70d7Chandler Carruth#define _m_psrlq _mm_srl_si64
4886b6fe28b3c7824653c5cc06695c92d5aae6e70d7Chandler Carruth#define _m_psrlqi _mm_srli_si64
489fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pand _mm_and_si64
490fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pandn _mm_andnot_si64
491fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_por _mm_or_si64
492fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pxor _mm_xor_si64
493fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpeqb _mm_cmpeq_pi8
494fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpeqw _mm_cmpeq_pi16
495fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpeqd _mm_cmpeq_pi32
496fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpgtb _mm_cmpgt_pi8
497fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpgtw _mm_cmpgt_pi16
498fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth#define _m_pcmpgtd _mm_cmpgt_pi32
499fa38c81b67426e1363b58b86d702caa91a0c2ddbChandler Carruth
50037958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#endif /* __MMX__ */
50137958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
50237958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson#endif /* __MMINTRIN_H */
50337958ee2750db056dc276f045cc8876f2eab2984Anders Carlsson
504