1239313Sdim/*===---- ammintrin.h - SSE4a intrinsics -----------------------------------=== 2239313Sdim * 3239313Sdim * Permission is hereby granted, free of charge, to any person obtaining a copy 4239313Sdim * of this software and associated documentation files (the "Software"), to deal 5239313Sdim * in the Software without restriction, including without limitation the rights 6239313Sdim * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7239313Sdim * copies of the Software, and to permit persons to whom the Software is 8239313Sdim * furnished to do so, subject to the following conditions: 9239313Sdim * 10239313Sdim * The above copyright notice and this permission notice shall be included in 11239313Sdim * all copies or substantial portions of the Software. 12239313Sdim * 13239313Sdim * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14239313Sdim * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15239313Sdim * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16239313Sdim * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17239313Sdim * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18239313Sdim * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19239313Sdim * THE SOFTWARE. 20239313Sdim * 21239313Sdim *===-----------------------------------------------------------------------=== 22239313Sdim */ 23239313Sdim 24239313Sdim#ifndef __AMMINTRIN_H 25239313Sdim#define __AMMINTRIN_H 26239313Sdim 27239313Sdim#ifndef __SSE4A__ 28239313Sdim#error "SSE4A instruction set not enabled" 29239313Sdim#else 30239313Sdim 31239313Sdim#include <pmmintrin.h> 32239313Sdim 33239313Sdim#define _mm_extracti_si64(x, len, idx) \ 34239313Sdim ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \ 35239313Sdim (char)(len), (char)(idx))) 36239313Sdim 37239313Sdimstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) 38239313Sdim_mm_extract_si64(__m128i __x, __m128i __y) 39239313Sdim{ 40239313Sdim return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y); 41239313Sdim} 42239313Sdim 43239313Sdim#define _mm_inserti_si64(x, y, len, idx) \ 44239313Sdim ((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \ 45239313Sdim (__v2di)(__m128i)(y), \ 46239313Sdim (char)(len), (char)(idx))) 47239313Sdim 48239313Sdimstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) 49239313Sdim_mm_insert_si64(__m128i __x, __m128i __y) 50239313Sdim{ 51239313Sdim return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y); 52239313Sdim} 53239313Sdim 54239313Sdimstatic __inline__ void __attribute__((__always_inline__, __nodebug__)) 55239313Sdim_mm_stream_sd(double *__p, __m128d __a) 56239313Sdim{ 57239313Sdim __builtin_ia32_movntsd(__p, (__v2df)__a); 58239313Sdim} 59239313Sdim 60239313Sdimstatic __inline__ void __attribute__((__always_inline__, __nodebug__)) 61239313Sdim_mm_stream_ss(float *__p, __m128 __a) 62239313Sdim{ 63239313Sdim __builtin_ia32_movntss(__p, (__v4sf)__a); 64239313Sdim} 65239313Sdim 66239313Sdim#endif /* __SSE4A__ */ 67239313Sdim 68239313Sdim#endif /* __AMMINTRIN_H */ 69