Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / clang-3.6 / ammintrin.h @ 13

History | View | Annotate | Download (2.46 KB)

1 13 up20180614
/*===---- ammintrin.h - SSE4a intrinsics -----------------------------------===
2
 *
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:
9
 *
10
 * The above copyright notice and this permission notice shall be included in
11
 * all copies or substantial portions of the Software.
12
 *
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
19
 * THE SOFTWARE.
20
 *
21
 *===-----------------------------------------------------------------------===
22
 */
23
24
#ifndef __AMMINTRIN_H
25
#define __AMMINTRIN_H
26
27
#ifndef __SSE4A__
28
#error "SSE4A instruction set not enabled"
29
#else
30
31
#include <pmmintrin.h>
32
33
#define _mm_extracti_si64(x, len, idx) \
34
  ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
35
                                  (char)(len), (char)(idx)))
36
37
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
38
_mm_extract_si64(__m128i __x, __m128i __y)
39
{
40
  return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y);
41
}
42
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)))
47
48
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
49
_mm_insert_si64(__m128i __x, __m128i __y)
50
{
51
  return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y);
52
}
53
54
static __inline__ void __attribute__((__always_inline__, __nodebug__))
55
_mm_stream_sd(double *__p, __m128d __a)
56
{
57
  __builtin_ia32_movntsd(__p, (__v2df)__a);
58
}
59
60
static __inline__ void __attribute__((__always_inline__, __nodebug__))
61
_mm_stream_ss(float *__p, __m128 __a)
62
{
63
  __builtin_ia32_movntss(__p, (__v4sf)__a);
64
}
65
66
#endif /* __SSE4A__ */
67
68
#endif /* __AMMINTRIN_H */