blob: a74dad84a490cc002a36c618d1a710522668a1d2 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001/*===---- 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
Ben Murdoch61f157c2016-09-16 13:49:30 +010078#include <avx512vlcdintrin.h>
79
Ben Murdoch097c5b22016-05-18 11:27:45 +010080#include <avx512vldqintrin.h>
81
82#include <avx512erintrin.h>
83
84#include <avx512ifmaintrin.h>
85
86#include <avx512ifmavlintrin.h>
87
88#include <avx512vbmiintrin.h>
89
90#include <avx512vbmivlintrin.h>
91
Ben Murdoch61f157c2016-09-16 13:49:30 +010092#include <avx512pfintrin.h>
93
Ben Murdoch097c5b22016-05-18 11:27:45 +010094#include <pkuintrin.h>
95
96static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
97_rdrand16_step(unsigned short *__p)
98{
99 return __builtin_ia32_rdrand16_step(__p);
100}
101
102static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
103_rdrand32_step(unsigned int *__p)
104{
105 return __builtin_ia32_rdrand32_step(__p);
106}
107
108#ifdef __x86_64__
109static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
110_rdrand64_step(unsigned long long *__p)
111{
112 return __builtin_ia32_rdrand64_step(__p);
113}
114#endif
115
116#ifdef __x86_64__
117static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
118_readfsbase_u32(void)
119{
120 return __builtin_ia32_rdfsbase32();
121}
122
123static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
124_readfsbase_u64(void)
125{
126 return __builtin_ia32_rdfsbase64();
127}
128
129static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
130_readgsbase_u32(void)
131{
132 return __builtin_ia32_rdgsbase32();
133}
134
135static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
136_readgsbase_u64(void)
137{
138 return __builtin_ia32_rdgsbase64();
139}
140
141static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
142_writefsbase_u32(unsigned int __V)
143{
144 return __builtin_ia32_wrfsbase32(__V);
145}
146
147static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
148_writefsbase_u64(unsigned long long __V)
149{
150 return __builtin_ia32_wrfsbase64(__V);
151}
152
153static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
154_writegsbase_u32(unsigned int __V)
155{
156 return __builtin_ia32_wrgsbase32(__V);
157}
158
159static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
160_writegsbase_u64(unsigned long long __V)
161{
162 return __builtin_ia32_wrgsbase64(__V);
163}
164#endif
165
166#include <rtmintrin.h>
167
168#include <xtestintrin.h>
169
170#include <shaintrin.h>
171
172#include <fxsrintrin.h>
173
174#include <xsaveintrin.h>
175
176#include <xsaveoptintrin.h>
177
178#include <xsavecintrin.h>
179
180#include <xsavesintrin.h>
181
182/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
183 * whereas others are also available at all times. */
184#include <adxintrin.h>
185
186#endif /* __IMMINTRIN_H */