1 /*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 *===-----------------------------------------------------------------------===
28 #error "SSE3 instruction set not enabled"
31 #include <emmintrin.h>
33 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
34 _mm_lddqu_si128(__m128i const *__p)
36 return (__m128i)__builtin_ia32_lddqu((char const *)__p);
39 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
40 _mm_addsub_ps(__m128 __a, __m128 __b)
42 return __builtin_ia32_addsubps(__a, __b);
45 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
46 _mm_hadd_ps(__m128 __a, __m128 __b)
48 return __builtin_ia32_haddps(__a, __b);
51 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
52 _mm_hsub_ps(__m128 __a, __m128 __b)
54 return __builtin_ia32_hsubps(__a, __b);
57 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
58 _mm_movehdup_ps(__m128 __a)
60 return __builtin_shufflevector(__a, __a, 1, 1, 3, 3);
63 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
64 _mm_moveldup_ps(__m128 __a)
66 return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
69 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
70 _mm_addsub_pd(__m128d __a, __m128d __b)
72 return __builtin_ia32_addsubpd(__a, __b);
75 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
76 _mm_hadd_pd(__m128d __a, __m128d __b)
78 return __builtin_ia32_haddpd(__a, __b);
81 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
82 _mm_hsub_pd(__m128d __a, __m128d __b)
84 return __builtin_ia32_hsubpd(__a, __b);
87 #define _mm_loaddup_pd(dp) _mm_load1_pd(dp)
89 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
90 _mm_movedup_pd(__m128d __a)
92 return __builtin_shufflevector(__a, __a, 0, 0);
95 #define _MM_DENORMALS_ZERO_ON (0x0040)
96 #define _MM_DENORMALS_ZERO_OFF (0x0000)
98 #define _MM_DENORMALS_ZERO_MASK (0x0040)
100 #define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
101 #define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
103 static __inline__ void __attribute__((__always_inline__, __nodebug__))
104 _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
106 __builtin_ia32_monitor((void *)__p, __extensions, __hints);
109 static __inline__ void __attribute__((__always_inline__, __nodebug__))
110 _mm_mwait(unsigned __extensions, unsigned __hints)
112 __builtin_ia32_mwait(__extensions, __hints);
115 #endif /* __SSE3__ */
117 #endif /* __PMMINTRIN_H */