clang API Documentation

ammintrin.h
Go to the documentation of this file.
00001 /*===---- ammintrin.h - SSE4a 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 __AMMINTRIN_H
00025 #define __AMMINTRIN_H
00026 
00027 #ifndef __SSE4A__
00028 #error "SSE4A instruction set not enabled"
00029 #else
00030 
00031 #include <pmmintrin.h>
00032 
00033 #define _mm_extracti_si64(x, len, idx) \
00034   ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
00035                                   (char)(len), (char)(idx)))
00036 
00037 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00038 _mm_extract_si64(__m128i __x, __m128i __y)
00039 {
00040   return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y);
00041 }
00042 
00043 #define _mm_inserti_si64(x, y, len, idx) \
00044   ((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \
00045                                     (__v2di)(__m128i)(y), \
00046                                     (char)(len), (char)(idx)))
00047 
00048 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00049 _mm_insert_si64(__m128i __x, __m128i __y)
00050 {
00051   return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y);
00052 }
00053 
00054 static __inline__ void __attribute__((__always_inline__, __nodebug__))
00055 _mm_stream_sd(double *__p, __m128d __a)
00056 {
00057   __builtin_ia32_movntsd(__p, (__v2df)__a);
00058 }
00059 
00060 static __inline__ void __attribute__((__always_inline__, __nodebug__))
00061 _mm_stream_ss(float *__p, __m128 __a)
00062 {
00063   __builtin_ia32_movntss(__p, (__v4sf)__a);
00064 }
00065 
00066 #endif /* __SSE4A__ */
00067 
00068 #endif /* __AMMINTRIN_H */