1 /*===---- ammintrin.h - SSE4a 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 "SSE4A instruction set not enabled"
31 #include <pmmintrin.h>
33 #define _mm_extracti_si64(x, len, idx) \
34 ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
35 (char)(len), (char)(idx)))
37 static __inline__ __m128i
__attribute__((__always_inline__
, __nodebug__
))
38 _mm_extract_si64(__m128i __x
, __m128i __y
)
40 return (__m128i
)__builtin_ia32_extrq((__v2di
)__x
, (__v16qi
)__y
);
43 #define _mm_inserti_si64(x, y, len, idx) \
44 ((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \
45 (__v2di)(__m128i)(y), \
46 (char)(len), (char)(idx)))
48 static __inline__ __m128i
__attribute__((__always_inline__
, __nodebug__
))
49 _mm_insert_si64(__m128i __x
, __m128i __y
)
51 return (__m128i
)__builtin_ia32_insertq((__v2di
)__x
, (__v2di
)__y
);
54 static __inline__
void __attribute__((__always_inline__
, __nodebug__
))
55 _mm_stream_sd(double *__p
, __m128d __a
)
57 __builtin_ia32_movntsd(__p
, (__v2df
)__a
);
60 static __inline__
void __attribute__((__always_inline__
, __nodebug__
))
61 _mm_stream_ss(float *__p
, __m128 __a
)
63 __builtin_ia32_movntss(__p
, (__v4sf
)__a
);
66 #endif /* __SSE4A__ */
68 #endif /* __AMMINTRIN_H */