Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 27 | #include <mmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 28 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 29 | #include <xmmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 30 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 31 | #include <emmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 32 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 33 | #include <pmmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 34 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 35 | #include <tmmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 36 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 37 | #include <smmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 38 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 39 | #include <wmmintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 40 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 41 | #include <avxintrin.h> |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 42 | |
Craig Topper | dec792e | 2011-12-19 05:04:33 +0000 | [diff] [blame] | 43 | #include <avx2intrin.h> |
Craig Topper | dec792e | 2011-12-19 05:04:33 +0000 | [diff] [blame] | 44 | |
Paul Robinson | 941bc91 | 2015-12-02 18:41:52 +0000 | [diff] [blame] | 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 | |
| 52 | static __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 | |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 58 | #include <bmiintrin.h> |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 59 | |
Craig Topper | c334dd6 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 60 | #include <bmi2intrin.h> |
Craig Topper | c334dd6 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 61 | |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 62 | #include <lzcntintrin.h> |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 63 | |
Craig Topper | 2b1eda3 | 2012-06-04 03:42:47 +0000 | [diff] [blame] | 64 | #include <fmaintrin.h> |
Craig Topper | 2b1eda3 | 2012-06-04 03:42:47 +0000 | [diff] [blame] | 65 | |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 66 | #include <avx512fintrin.h> |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 67 | |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 68 | #include <avx512vlintrin.h> |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 69 | |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 70 | #include <avx512bwintrin.h> |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 71 | |
Asaf Badouh | a45b7ca | 2015-06-29 12:51:53 +0000 | [diff] [blame] | 72 | #include <avx512cdintrin.h> |
| 73 | |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 74 | #include <avx512dqintrin.h> |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 75 | |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 76 | #include <avx512vlbwintrin.h> |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 77 | |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 78 | #include <avx512vldqintrin.h> |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 79 | |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 80 | #include <avx512erintrin.h> |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 81 | |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 82 | #include <avx512ifmaintrin.h> |
| 83 | |
| 84 | #include <avx512ifmavlintrin.h> |
| 85 | |
Michael Zuckerman | 9f33848 | 2016-03-07 17:04:11 +0000 | [diff] [blame^] | 86 | #include <avx512vbmiintrin.h> |
| 87 | |
| 88 | #include <avx512vbmivlintrin.h> |
| 89 | |
Asaf Badouh | a9d1e18 | 2015-12-31 14:14:07 +0000 | [diff] [blame] | 90 | #include <pkuintrin.h> |
| 91 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 92 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 93 | _rdrand16_step(unsigned short *__p) |
| 94 | { |
| 95 | return __builtin_ia32_rdrand16_step(__p); |
| 96 | } |
| 97 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 98 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 99 | _rdrand32_step(unsigned int *__p) |
| 100 | { |
| 101 | return __builtin_ia32_rdrand32_step(__p); |
| 102 | } |
| 103 | |
| 104 | #ifdef __x86_64__ |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 105 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 106 | _rdrand64_step(unsigned long long *__p) |
| 107 | { |
| 108 | return __builtin_ia32_rdrand64_step(__p); |
| 109 | } |
| 110 | #endif |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 111 | |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 112 | #ifdef __x86_64__ |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 113 | static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 114 | _readfsbase_u32(void) |
| 115 | { |
| 116 | return __builtin_ia32_rdfsbase32(); |
| 117 | } |
| 118 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 119 | static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 120 | _readfsbase_u64(void) |
| 121 | { |
| 122 | return __builtin_ia32_rdfsbase64(); |
| 123 | } |
| 124 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 125 | static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 126 | _readgsbase_u32(void) |
| 127 | { |
| 128 | return __builtin_ia32_rdgsbase32(); |
| 129 | } |
| 130 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 131 | static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 132 | _readgsbase_u64(void) |
| 133 | { |
| 134 | return __builtin_ia32_rdgsbase64(); |
| 135 | } |
| 136 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 137 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 138 | _writefsbase_u32(unsigned int __V) |
| 139 | { |
| 140 | return __builtin_ia32_wrfsbase32(__V); |
| 141 | } |
| 142 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 143 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 144 | _writefsbase_u64(unsigned long long __V) |
| 145 | { |
| 146 | return __builtin_ia32_wrfsbase64(__V); |
| 147 | } |
| 148 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 149 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 150 | _writegsbase_u32(unsigned int __V) |
| 151 | { |
| 152 | return __builtin_ia32_wrgsbase32(__V); |
| 153 | } |
| 154 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 155 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 156 | _writegsbase_u64(unsigned long long __V) |
| 157 | { |
| 158 | return __builtin_ia32_wrgsbase64(__V); |
| 159 | } |
| 160 | #endif |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 161 | |
Michael Liao | 625a875 | 2012-11-10 05:17:46 +0000 | [diff] [blame] | 162 | #include <rtmintrin.h> |
Michael Liao | 625a875 | 2012-11-10 05:17:46 +0000 | [diff] [blame] | 163 | |
Eric Christopher | 3d920ee | 2015-06-17 18:42:07 +0000 | [diff] [blame] | 164 | #include <xtestintrin.h> |
Michael Liao | 4442f79 | 2013-03-29 05:14:06 +0000 | [diff] [blame] | 165 | |
Ben Langmuir | 6efe3a8 | 2013-09-19 14:00:22 +0000 | [diff] [blame] | 166 | #include <shaintrin.h> |
Ben Langmuir | 6efe3a8 | 2013-09-19 14:00:22 +0000 | [diff] [blame] | 167 | |
Michael Kuperstein | a3c7b74 | 2015-06-30 09:45:38 +0000 | [diff] [blame] | 168 | #include <fxsrintrin.h> |
| 169 | |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 170 | #include <xsaveintrin.h> |
| 171 | |
| 172 | #include <xsaveoptintrin.h> |
| 173 | |
| 174 | #include <xsavecintrin.h> |
| 175 | |
| 176 | #include <xsavesintrin.h> |
| 177 | |
Eric Christopher | 29b7809 | 2015-06-17 18:42:03 +0000 | [diff] [blame] | 178 | /* Some intrinsics inside adxintrin.h are available only on processors with ADX, |
| 179 | * whereas others are also available at all times. */ |
Robert Khasanov | 83c419b | 2014-09-19 10:17:06 +0000 | [diff] [blame] | 180 | #include <adxintrin.h> |
| 181 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 182 | #endif /* __IMMINTRIN_H */ |