clang API Documentation

pmmintrin.h
Go to the documentation of this file.
00001 /*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy
00004  * of this software and associated documentation files (the "Software"), to deal
00005  * in the Software without restriction, including without limitation the rights
00006  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00007  * copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in
00011  * all copies or substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00014  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00015  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00016  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00017  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00018  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00019  * THE SOFTWARE.
00020  *
00021  *===-----------------------------------------------------------------------===
00022  */
00023  
00024 #ifndef __PMMINTRIN_H
00025 #define __PMMINTRIN_H
00026 
00027 #ifndef __SSE3__
00028 #error "SSE3 instruction set not enabled"
00029 #else
00030 
00031 #include <emmintrin.h>
00032 
00033 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00034 _mm_lddqu_si128(__m128i const *__p)
00035 {
00036   return (__m128i)__builtin_ia32_lddqu((char const *)__p);
00037 }
00038 
00039 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00040 _mm_addsub_ps(__m128 __a, __m128 __b)
00041 {
00042   return __builtin_ia32_addsubps(__a, __b);
00043 }
00044 
00045 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00046 _mm_hadd_ps(__m128 __a, __m128 __b)
00047 {
00048   return __builtin_ia32_haddps(__a, __b);
00049 }
00050 
00051 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00052 _mm_hsub_ps(__m128 __a, __m128 __b)
00053 {
00054   return __builtin_ia32_hsubps(__a, __b);
00055 }
00056 
00057 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00058 _mm_movehdup_ps(__m128 __a)
00059 {
00060   return __builtin_shufflevector(__a, __a, 1, 1, 3, 3);
00061 }
00062 
00063 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00064 _mm_moveldup_ps(__m128 __a)
00065 {
00066   return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
00067 }
00068 
00069 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
00070 _mm_addsub_pd(__m128d __a, __m128d __b)
00071 {
00072   return __builtin_ia32_addsubpd(__a, __b);
00073 }
00074 
00075 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
00076 _mm_hadd_pd(__m128d __a, __m128d __b)
00077 {
00078   return __builtin_ia32_haddpd(__a, __b);
00079 }
00080 
00081 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
00082 _mm_hsub_pd(__m128d __a, __m128d __b)
00083 {
00084   return __builtin_ia32_hsubpd(__a, __b);
00085 }
00086 
00087 #define        _mm_loaddup_pd(dp)        _mm_load1_pd(dp)
00088 
00089 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
00090 _mm_movedup_pd(__m128d __a)
00091 {
00092   return __builtin_shufflevector(__a, __a, 0, 0);
00093 }
00094 
00095 #define _MM_DENORMALS_ZERO_ON   (0x0040)
00096 #define _MM_DENORMALS_ZERO_OFF  (0x0000)
00097 
00098 #define _MM_DENORMALS_ZERO_MASK (0x0040)
00099 
00100 #define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
00101 #define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
00102 
00103 static __inline__ void __attribute__((__always_inline__, __nodebug__))
00104 _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
00105 {
00106   __builtin_ia32_monitor((void *)__p, __extensions, __hints);
00107 }
00108 
00109 static __inline__ void __attribute__((__always_inline__, __nodebug__))
00110 _mm_mwait(unsigned __extensions, unsigned __hints)
00111 {
00112   __builtin_ia32_mwait(__extensions, __hints);
00113 }
00114 
00115 #endif /* __SSE3__ */
00116 
00117 #endif /* __PMMINTRIN_H */