blob: a28222b79eb1e8a3b4c5014d6cb79e4bd2bd2baa [file] [log] [blame]
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +00001/*===---- 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
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000027#include <mmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000028
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000029#include <xmmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000030
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000031#include <emmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000032
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000033#include <pmmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000034
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000035#include <tmmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000036
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000037#include <smmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000038
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000039#include <wmmintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000040
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000041#include <avxintrin.h>
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +000042
Craig Topperdec792e2011-12-19 05:04:33 +000043#include <avx2intrin.h>
Craig Topperdec792e2011-12-19 05:04:33 +000044
Craig Topperf2855ad2011-12-25 06:25:37 +000045#include <bmiintrin.h>
Craig Topperf2855ad2011-12-25 06:25:37 +000046
Craig Topperc334dd62011-12-26 02:31:10 +000047#include <bmi2intrin.h>
Craig Topperc334dd62011-12-26 02:31:10 +000048
Craig Topperf2855ad2011-12-25 06:25:37 +000049#include <lzcntintrin.h>
Craig Topperf2855ad2011-12-25 06:25:37 +000050
Craig Topper2b1eda32012-06-04 03:42:47 +000051#include <fmaintrin.h>
Craig Topper2b1eda32012-06-04 03:42:47 +000052
Elena Demikhovskyfcc6df32014-07-22 11:31:39 +000053#include <avx512fintrin.h>
Elena Demikhovskyfcc6df32014-07-22 11:31:39 +000054
Robert Khasanovb9f3a912014-10-08 17:18:13 +000055#include <avx512vlintrin.h>
Robert Khasanovb9f3a912014-10-08 17:18:13 +000056
Robert Khasanovb9f3a912014-10-08 17:18:13 +000057#include <avx512bwintrin.h>
Robert Khasanovb9f3a912014-10-08 17:18:13 +000058
Asaf Badouha45b7ca2015-06-29 12:51:53 +000059#include <avx512cdintrin.h>
60
Elena Demikhovskye7d4c2e2015-04-30 09:24:29 +000061#include <avx512dqintrin.h>
Elena Demikhovskye7d4c2e2015-04-30 09:24:29 +000062
Robert Khasanovb9f3a912014-10-08 17:18:13 +000063#include <avx512vlbwintrin.h>
Robert Khasanovb9f3a912014-10-08 17:18:13 +000064
Elena Demikhovskye7d4c2e2015-04-30 09:24:29 +000065#include <avx512vldqintrin.h>
Elena Demikhovskye7d4c2e2015-04-30 09:24:29 +000066
Elena Demikhovskyfcc6df32014-07-22 11:31:39 +000067#include <avx512erintrin.h>
Elena Demikhovskyfcc6df32014-07-22 11:31:39 +000068
Eric Christopher9fc7fb22015-06-17 07:09:32 +000069static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
Benjamin Kramera43b6992012-07-12 09:33:03 +000070_rdrand16_step(unsigned short *__p)
71{
72 return __builtin_ia32_rdrand16_step(__p);
73}
74
Eric Christopher9fc7fb22015-06-17 07:09:32 +000075static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
Benjamin Kramera43b6992012-07-12 09:33:03 +000076_rdrand32_step(unsigned int *__p)
77{
78 return __builtin_ia32_rdrand32_step(__p);
79}
80
81#ifdef __x86_64__
Eric Christopher9fc7fb22015-06-17 07:09:32 +000082static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
Benjamin Kramera43b6992012-07-12 09:33:03 +000083_rdrand64_step(unsigned long long *__p)
84{
85 return __builtin_ia32_rdrand64_step(__p);
86}
87#endif
Benjamin Kramera43b6992012-07-12 09:33:03 +000088
Craig Topper8c7f2512014-11-03 06:51:41 +000089#ifdef __x86_64__
Eric Christopher9fc7fb22015-06-17 07:09:32 +000090static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +000091_readfsbase_u32(void)
92{
93 return __builtin_ia32_rdfsbase32();
94}
95
Eric Christopher9fc7fb22015-06-17 07:09:32 +000096static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +000097_readfsbase_u64(void)
98{
99 return __builtin_ia32_rdfsbase64();
100}
101
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000102static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000103_readgsbase_u32(void)
104{
105 return __builtin_ia32_rdgsbase32();
106}
107
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000108static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000109_readgsbase_u64(void)
110{
111 return __builtin_ia32_rdgsbase64();
112}
113
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000114static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000115_writefsbase_u32(unsigned int __V)
116{
117 return __builtin_ia32_wrfsbase32(__V);
118}
119
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000120static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000121_writefsbase_u64(unsigned long long __V)
122{
123 return __builtin_ia32_wrfsbase64(__V);
124}
125
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000126static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000127_writegsbase_u32(unsigned int __V)
128{
129 return __builtin_ia32_wrgsbase32(__V);
130}
131
Eric Christopher9fc7fb22015-06-17 07:09:32 +0000132static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
Craig Topper8c7f2512014-11-03 06:51:41 +0000133_writegsbase_u64(unsigned long long __V)
134{
135 return __builtin_ia32_wrgsbase64(__V);
136}
137#endif
Craig Topper8c7f2512014-11-03 06:51:41 +0000138
Michael Liao625a8752012-11-10 05:17:46 +0000139#include <rtmintrin.h>
Michael Liao625a8752012-11-10 05:17:46 +0000140
Eric Christopher3d920ee2015-06-17 18:42:07 +0000141#include <xtestintrin.h>
Michael Liao4442f792013-03-29 05:14:06 +0000142
Ben Langmuir6efe3a82013-09-19 14:00:22 +0000143#include <shaintrin.h>
Ben Langmuir6efe3a82013-09-19 14:00:22 +0000144
Michael Kupersteina3c7b742015-06-30 09:45:38 +0000145#include <fxsrintrin.h>
146
Amjad Aboud2b9b8a52015-10-13 12:29:35 +0000147#include <xsaveintrin.h>
148
149#include <xsaveoptintrin.h>
150
151#include <xsavecintrin.h>
152
153#include <xsavesintrin.h>
154
Eric Christopher29b78092015-06-17 18:42:03 +0000155/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
156 * whereas others are also available at all times. */
Robert Khasanov83c419b2014-09-19 10:17:06 +0000157#include <adxintrin.h>
158
Benjamin Kramer65b9f7b2010-08-20 18:04:07 +0000159#endif /* __IMMINTRIN_H */