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