1/*===---- immintrin.h - Intel 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 __IMMINTRIN_H
25#define __IMMINTRIN_H
26
27#include <mmintrin.h>
28
29#include <xmmintrin.h>
30
31#include <emmintrin.h>
32
33#include <pmmintrin.h>
34
35#include <tmmintrin.h>
36
37#include <smmintrin.h>
38
39#include <wmmintrin.h>
40
41#include <avxintrin.h>
42
43#include <avx2intrin.h>
44
45/* The 256-bit versions of functions in f16cintrin.h.
46   Intel documents these as being in immintrin.h, and
47   they depend on typedefs from avxintrin.h. */
48
49#define _mm256_cvtps_ph(a, imm) __extension__ ({ \
50 (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)(__m256)(a), (imm)); })
51
52static __inline __m256 __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
53_mm256_cvtph_ps(__m128i __a)
54{
55  return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
56}
57
58#include <bmiintrin.h>
59
60#include <bmi2intrin.h>
61
62#include <lzcntintrin.h>
63
64#include <fmaintrin.h>
65
66#include <avx512fintrin.h>
67
68#include <avx512vlintrin.h>
69
70#include <avx512bwintrin.h>
71
72#include <avx512cdintrin.h>
73
74#include <avx512dqintrin.h>
75
76#include <avx512vlbwintrin.h>
77
78#include <avx512vldqintrin.h>
79
80#include <avx512erintrin.h>
81
82static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
83_rdrand16_step(unsigned short *__p)
84{
85  return __builtin_ia32_rdrand16_step(__p);
86}
87
88static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
89_rdrand32_step(unsigned int *__p)
90{
91  return __builtin_ia32_rdrand32_step(__p);
92}
93
94#ifdef __x86_64__
95static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
96_rdrand64_step(unsigned long long *__p)
97{
98  return __builtin_ia32_rdrand64_step(__p);
99}
100#endif
101
102#ifdef __x86_64__
103static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
104_readfsbase_u32(void)
105{
106  return __builtin_ia32_rdfsbase32();
107}
108
109static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
110_readfsbase_u64(void)
111{
112  return __builtin_ia32_rdfsbase64();
113}
114
115static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
116_readgsbase_u32(void)
117{
118  return __builtin_ia32_rdgsbase32();
119}
120
121static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
122_readgsbase_u64(void)
123{
124  return __builtin_ia32_rdgsbase64();
125}
126
127static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
128_writefsbase_u32(unsigned int __V)
129{
130  return __builtin_ia32_wrfsbase32(__V);
131}
132
133static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
134_writefsbase_u64(unsigned long long __V)
135{
136  return __builtin_ia32_wrfsbase64(__V);
137}
138
139static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
140_writegsbase_u32(unsigned int __V)
141{
142  return __builtin_ia32_wrgsbase32(__V);
143}
144
145static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
146_writegsbase_u64(unsigned long long __V)
147{
148  return __builtin_ia32_wrgsbase64(__V);
149}
150#endif
151
152#include <rtmintrin.h>
153
154#include <xtestintrin.h>
155
156#include <shaintrin.h>
157
158#include <fxsrintrin.h>
159
160#include <xsaveintrin.h>
161
162#include <xsaveoptintrin.h>
163
164#include <xsavecintrin.h>
165
166#include <xsavesintrin.h>
167
168/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
169 * whereas others are also available at all times. */
170#include <adxintrin.h>
171
172#endif /* __IMMINTRIN_H */
173