clang  7.0.0svn
immintrin.h
Go to the documentation of this file.
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 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__)
28 #include <mmintrin.h>
29 #endif
30 
31 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__)
32 #include <xmmintrin.h>
33 #endif
34 
35 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__)
36 #include <emmintrin.h>
37 #endif
38 
39 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__)
40 #include <pmmintrin.h>
41 #endif
42 
43 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__)
44 #include <tmmintrin.h>
45 #endif
46 
47 #if !defined(_MSC_VER) || __has_feature(modules) || \
48  (defined(__SSE4_2__) || defined(__SSE4_1__))
49 #include <smmintrin.h>
50 #endif
51 
52 #if !defined(_MSC_VER) || __has_feature(modules) || \
53  (defined(__AES__) || defined(__PCLMUL__))
54 #include <wmmintrin.h>
55 #endif
56 
57 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
58 #include <clflushoptintrin.h>
59 #endif
60 
61 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__)
62 #include <clwbintrin.h>
63 #endif
64 
65 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
66 #include <avxintrin.h>
67 #endif
68 
69 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__)
70 #include <avx2intrin.h>
71 #endif
72 
73 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__F16C__)
74 #include <f16cintrin.h>
75 #endif
76 
77 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__VPCLMULQDQ__)
78 #include <vpclmulqdqintrin.h>
79 #endif
80 
81 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
82 #include <bmiintrin.h>
83 #endif
84 
85 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
86 #include <bmi2intrin.h>
87 #endif
88 
89 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
90 #include <lzcntintrin.h>
91 #endif
92 
93 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__)
94 #include <fmaintrin.h>
95 #endif
96 
97 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__)
98 #include <avx512fintrin.h>
99 #endif
100 
101 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__)
102 #include <avx512vlintrin.h>
103 #endif
104 
105 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__)
106 #include <avx512bwintrin.h>
107 #endif
108 
109 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BITALG__)
110 #include <avx512bitalgintrin.h>
111 #endif
112 
113 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__)
114 #include <avx512cdintrin.h>
115 #endif
116 
117 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VPOPCNTDQ__)
118 #include <avx512vpopcntdqintrin.h>
119 #endif
120 
121 #if !defined(_MSC_VER) || __has_feature(modules) || \
122  (defined(__AVX512VL__) && defined(__AVX512VPOPCNTDQ__))
123 #include <avx512vpopcntdqvlintrin.h>
124 #endif
125 
126 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VNNI__)
127 #include <avx512vnniintrin.h>
128 #endif
129 
130 #if !defined(_MSC_VER) || __has_feature(modules) || \
131  (defined(__AVX512VL__) && defined(__AVX512VNNI__))
132 #include <avx512vlvnniintrin.h>
133 #endif
134 
135 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__)
136 #include <avx512dqintrin.h>
137 #endif
138 
139 #if !defined(_MSC_VER) || __has_feature(modules) || \
140  (defined(__AVX512VL__) && defined(__AVX512BITALG__))
141 #include <avx512vlbitalgintrin.h>
142 #endif
143 
144 #if !defined(_MSC_VER) || __has_feature(modules) || \
145  (defined(__AVX512VL__) && defined(__AVX512BW__))
146 #include <avx512vlbwintrin.h>
147 #endif
148 
149 #if !defined(_MSC_VER) || __has_feature(modules) || \
150  (defined(__AVX512VL__) && defined(__AVX512CD__))
151 #include <avx512vlcdintrin.h>
152 #endif
153 
154 #if !defined(_MSC_VER) || __has_feature(modules) || \
155  (defined(__AVX512VL__) && defined(__AVX512DQ__))
156 #include <avx512vldqintrin.h>
157 #endif
158 
159 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__)
160 #include <avx512erintrin.h>
161 #endif
162 
163 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__)
164 #include <avx512ifmaintrin.h>
165 #endif
166 
167 #if !defined(_MSC_VER) || __has_feature(modules) || \
168  (defined(__AVX512IFMA__) && defined(__AVX512VL__))
169 #include <avx512ifmavlintrin.h>
170 #endif
171 
172 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__)
173 #include <avx512vbmiintrin.h>
174 #endif
175 
176 #if !defined(_MSC_VER) || __has_feature(modules) || \
177  (defined(__AVX512VBMI__) && defined(__AVX512VL__))
178 #include <avx512vbmivlintrin.h>
179 #endif
180 
181 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI2__)
182 #include <avx512vbmi2intrin.h>
183 #endif
184 
185 #if !defined(_MSC_VER) || __has_feature(modules) || \
186  (defined(__AVX512VBMI2__) && defined(__AVX512VL__))
187 #include <avx512vlvbmi2intrin.h>
188 #endif
189 
190 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__)
191 #include <avx512pfintrin.h>
192 #endif
193 
194 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__)
195 #include <pkuintrin.h>
196 #endif
197 
198 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__VAES__)
199 #include <vaesintrin.h>
200 #endif
201 
202 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__GFNI__)
203 #include <gfniintrin.h>
204 #endif
205 
206 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDPID__)
207 /// Returns the value of the IA32_TSC_AUX MSR (0xc0000103).
208 ///
209 /// \headerfile <immintrin.h>
210 ///
211 /// This intrinsic corresponds to the <c> RDPID </c> instruction.
212 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("rdpid")))
213 _rdpid_u32(void) {
214  return __builtin_ia32_rdpid();
215 }
216 #endif // __RDPID__
217 
218 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__)
219 static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
220 _rdrand16_step(unsigned short *__p)
221 {
222  return __builtin_ia32_rdrand16_step(__p);
223 }
224 
225 static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
226 _rdrand32_step(unsigned int *__p)
227 {
228  return __builtin_ia32_rdrand32_step(__p);
229 }
230 
231 #ifdef __x86_64__
232 static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
233 _rdrand64_step(unsigned long long *__p)
234 {
235  return __builtin_ia32_rdrand64_step(__p);
236 }
237 #endif
238 #endif /* __RDRND__ */
239 
240 /* __bit_scan_forward */
241 static __inline__ int __attribute__((__always_inline__, __nodebug__))
242 _bit_scan_forward(int __A) {
243  return __builtin_ctz(__A);
244 }
245 
246 /* __bit_scan_reverse */
247 static __inline__ int __attribute__((__always_inline__, __nodebug__))
248 _bit_scan_reverse(int __A) {
249  return 31 - __builtin_clz(__A);
250 }
251 
252 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__)
253 #ifdef __x86_64__
254 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
255 _readfsbase_u32(void)
256 {
257  return __builtin_ia32_rdfsbase32();
258 }
259 
260 static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
261 _readfsbase_u64(void)
262 {
263  return __builtin_ia32_rdfsbase64();
264 }
265 
266 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
267 _readgsbase_u32(void)
268 {
269  return __builtin_ia32_rdgsbase32();
270 }
271 
272 static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
273 _readgsbase_u64(void)
274 {
275  return __builtin_ia32_rdgsbase64();
276 }
277 
278 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
279 _writefsbase_u32(unsigned int __V)
280 {
281  return __builtin_ia32_wrfsbase32(__V);
282 }
283 
284 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
285 _writefsbase_u64(unsigned long long __V)
286 {
287  return __builtin_ia32_wrfsbase64(__V);
288 }
289 
290 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
291 _writegsbase_u32(unsigned int __V)
292 {
293  return __builtin_ia32_wrgsbase32(__V);
294 }
295 
296 static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
297 _writegsbase_u64(unsigned long long __V)
298 {
299  return __builtin_ia32_wrgsbase64(__V);
300 }
301 
302 #endif
303 #endif /* __FSGSBASE__ */
304 
305 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__)
306 #include <rtmintrin.h>
307 #include <xtestintrin.h>
308 #endif
309 
310 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__)
311 #include <shaintrin.h>
312 #endif
313 
314 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__)
315 #include <fxsrintrin.h>
316 #endif
317 
318 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__)
319 #include <xsaveintrin.h>
320 #endif
321 
322 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__)
323 #include <xsaveoptintrin.h>
324 #endif
325 
326 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__)
327 #include <xsavecintrin.h>
328 #endif
329 
330 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__)
331 #include <xsavesintrin.h>
332 #endif
333 
334 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHSTK__)
335 #include <cetintrin.h>
336 #endif
337 
338 /* Some intrinsics inside adxintrin.h are available only on processors with ADX,
339  * whereas others are also available at all times. */
340 #include <adxintrin.h>
341 
342 #endif /* __IMMINTRIN_H */
static __inline unsigned char unsigned int unsigned int unsigned int * __p
Definition: adxintrin.h:38
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("rdpid"))) _rdpid_u32(void)
Returns the value of the IA32_TSC_AUX MSR (0xc0000103).
Definition: immintrin.h:212