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 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 27 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 28 | #include <mmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 29 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 30 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 31 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 32 | #include <xmmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 33 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 34 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 35 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 36 | #include <emmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 37 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 38 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 39 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 40 | #include <pmmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 41 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 42 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 43 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 44 | #include <tmmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 45 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 46 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 47 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 48 | (defined(__SSE4_2__) || defined(__SSE4_1__)) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 49 | #include <smmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 50 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 51 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 52 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 53 | (defined(__AES__) || defined(__PCLMUL__)) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 54 | #include <wmmintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 55 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 56 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 57 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__) |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 58 | #include <avxintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 59 | #endif |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 60 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 61 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__) |
Craig Topper | dec792e | 2011-12-19 05:04:33 +0000 | [diff] [blame] | 62 | #include <avx2intrin.h> |
Craig Topper | dec792e | 2011-12-19 05:04:33 +0000 | [diff] [blame] | 63 | |
Paul Robinson | 941bc91 | 2015-12-02 18:41:52 +0000 | [diff] [blame] | 64 | /* The 256-bit versions of functions in f16cintrin.h. |
| 65 | Intel documents these as being in immintrin.h, and |
| 66 | they depend on typedefs from avxintrin.h. */ |
| 67 | |
| 68 | #define _mm256_cvtps_ph(a, imm) __extension__ ({ \ |
| 69 | (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)(__m256)(a), (imm)); }) |
| 70 | |
| 71 | static __inline __m256 __attribute__((__always_inline__, __nodebug__, __target__("f16c"))) |
| 72 | _mm256_cvtph_ps(__m128i __a) |
| 73 | { |
| 74 | return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a); |
| 75 | } |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 76 | #endif /* __AVX2__ */ |
Paul Robinson | 941bc91 | 2015-12-02 18:41:52 +0000 | [diff] [blame] | 77 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 78 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__) |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 79 | #include <bmiintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 80 | #endif |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 81 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 82 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__) |
Craig Topper | c334dd6 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 83 | #include <bmi2intrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 84 | #endif |
Craig Topper | c334dd6 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 85 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 86 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__) |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 87 | #include <lzcntintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 88 | #endif |
Craig Topper | f2855ad | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 89 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 90 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__) |
Craig Topper | 2b1eda3 | 2012-06-04 03:42:47 +0000 | [diff] [blame] | 91 | #include <fmaintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 92 | #endif |
Craig Topper | 2b1eda3 | 2012-06-04 03:42:47 +0000 | [diff] [blame] | 93 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 94 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__) |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 95 | #include <avx512fintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 96 | #endif |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 97 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 98 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__) |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 99 | #include <avx512vlintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 100 | #endif |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 101 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 102 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__) |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 103 | #include <avx512bwintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 104 | #endif |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 105 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 106 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__) |
Asaf Badouh | a45b7ca | 2015-06-29 12:51:53 +0000 | [diff] [blame] | 107 | #include <avx512cdintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 108 | #endif |
Asaf Badouh | a45b7ca | 2015-06-29 12:51:53 +0000 | [diff] [blame] | 109 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 110 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__) |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 111 | #include <avx512dqintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 112 | #endif |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 113 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 114 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 115 | (defined(__AVX512VL__) && defined(__AVX512BW__)) |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 116 | #include <avx512vlbwintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 117 | #endif |
Robert Khasanov | b9f3a91 | 2014-10-08 17:18:13 +0000 | [diff] [blame] | 118 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 119 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 120 | (defined(__AVX512VL__) && defined(__AVX512CD__)) |
Michael Zuckerman | 8c2900f | 2016-04-27 11:43:14 +0000 | [diff] [blame] | 121 | #include <avx512vlcdintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 122 | #endif |
Michael Zuckerman | 8c2900f | 2016-04-27 11:43:14 +0000 | [diff] [blame] | 123 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 124 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 125 | (defined(__AVX512VL__) && defined(__AVX512DQ__)) |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 126 | #include <avx512vldqintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 127 | #endif |
Elena Demikhovsky | e7d4c2e | 2015-04-30 09:24:29 +0000 | [diff] [blame] | 128 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 129 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__) |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 130 | #include <avx512erintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 131 | #endif |
Elena Demikhovsky | fcc6df3 | 2014-07-22 11:31:39 +0000 | [diff] [blame] | 132 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 133 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__) |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 134 | #include <avx512ifmaintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 135 | #endif |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 136 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 137 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 138 | (defined(__AVX512IFMA__) && defined(__AVX512VL__)) |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 139 | #include <avx512ifmavlintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 140 | #endif |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 141 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 142 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__) |
Michael Zuckerman | 9f33848 | 2016-03-07 17:04:11 +0000 | [diff] [blame] | 143 | #include <avx512vbmiintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 144 | #endif |
Michael Zuckerman | 9f33848 | 2016-03-07 17:04:11 +0000 | [diff] [blame] | 145 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 146 | #if !defined(_MSC_VER) || __has_feature(modules) || \ |
| 147 | (defined(__AVX512VBMI__) && defined(__AVX512VL__)) |
Michael Zuckerman | 9f33848 | 2016-03-07 17:04:11 +0000 | [diff] [blame] | 148 | #include <avx512vbmivlintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 149 | #endif |
Michael Zuckerman | 9f33848 | 2016-03-07 17:04:11 +0000 | [diff] [blame] | 150 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 151 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__) |
Michael Zuckerman | 4fa96af | 2016-04-21 12:47:27 +0000 | [diff] [blame] | 152 | #include <avx512pfintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 153 | #endif |
Michael Zuckerman | 4fa96af | 2016-04-21 12:47:27 +0000 | [diff] [blame] | 154 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 155 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__) |
Asaf Badouh | a9d1e18 | 2015-12-31 14:14:07 +0000 | [diff] [blame] | 156 | #include <pkuintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 157 | #endif |
Asaf Badouh | a9d1e18 | 2015-12-31 14:14:07 +0000 | [diff] [blame] | 158 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 159 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__) |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 160 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 161 | _rdrand16_step(unsigned short *__p) |
| 162 | { |
| 163 | return __builtin_ia32_rdrand16_step(__p); |
| 164 | } |
| 165 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 166 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 167 | _rdrand32_step(unsigned int *__p) |
| 168 | { |
| 169 | return __builtin_ia32_rdrand32_step(__p); |
| 170 | } |
| 171 | |
| 172 | #ifdef __x86_64__ |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 173 | static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 174 | _rdrand64_step(unsigned long long *__p) |
| 175 | { |
| 176 | return __builtin_ia32_rdrand64_step(__p); |
| 177 | } |
| 178 | #endif |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 179 | #endif /* __RDRND__ */ |
Benjamin Kramer | a43b699 | 2012-07-12 09:33:03 +0000 | [diff] [blame] | 180 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 181 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 182 | #ifdef __x86_64__ |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 183 | static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 184 | _readfsbase_u32(void) |
| 185 | { |
| 186 | return __builtin_ia32_rdfsbase32(); |
| 187 | } |
| 188 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 189 | static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 190 | _readfsbase_u64(void) |
| 191 | { |
| 192 | return __builtin_ia32_rdfsbase64(); |
| 193 | } |
| 194 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 195 | static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 196 | _readgsbase_u32(void) |
| 197 | { |
| 198 | return __builtin_ia32_rdgsbase32(); |
| 199 | } |
| 200 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 201 | static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 202 | _readgsbase_u64(void) |
| 203 | { |
| 204 | return __builtin_ia32_rdgsbase64(); |
| 205 | } |
| 206 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 207 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 208 | _writefsbase_u32(unsigned int __V) |
| 209 | { |
| 210 | return __builtin_ia32_wrfsbase32(__V); |
| 211 | } |
| 212 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 213 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 214 | _writefsbase_u64(unsigned long long __V) |
| 215 | { |
| 216 | return __builtin_ia32_wrfsbase64(__V); |
| 217 | } |
| 218 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 219 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 220 | _writegsbase_u32(unsigned int __V) |
| 221 | { |
| 222 | return __builtin_ia32_wrgsbase32(__V); |
| 223 | } |
| 224 | |
Eric Christopher | 9fc7fb2 | 2015-06-17 07:09:32 +0000 | [diff] [blame] | 225 | static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 226 | _writegsbase_u64(unsigned long long __V) |
| 227 | { |
| 228 | return __builtin_ia32_wrgsbase64(__V); |
| 229 | } |
| 230 | #endif |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 231 | #endif /* __FSGSBASE__ */ |
Craig Topper | 8c7f251 | 2014-11-03 06:51:41 +0000 | [diff] [blame] | 232 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 233 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__) |
Michael Liao | 625a875 | 2012-11-10 05:17:46 +0000 | [diff] [blame] | 234 | #include <rtmintrin.h> |
Eric Christopher | 3d920ee | 2015-06-17 18:42:07 +0000 | [diff] [blame] | 235 | #include <xtestintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 236 | #endif |
Michael Liao | 4442f79 | 2013-03-29 05:14:06 +0000 | [diff] [blame] | 237 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 238 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__) |
Ben Langmuir | 6efe3a8 | 2013-09-19 14:00:22 +0000 | [diff] [blame] | 239 | #include <shaintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 240 | #endif |
Ben Langmuir | 6efe3a8 | 2013-09-19 14:00:22 +0000 | [diff] [blame] | 241 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 242 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__) |
Michael Kuperstein | a3c7b74 | 2015-06-30 09:45:38 +0000 | [diff] [blame] | 243 | #include <fxsrintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 244 | #endif |
Michael Kuperstein | a3c7b74 | 2015-06-30 09:45:38 +0000 | [diff] [blame] | 245 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 246 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__) |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 247 | #include <xsaveintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 248 | #endif |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 249 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 250 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__) |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 251 | #include <xsaveoptintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 252 | #endif |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 253 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 254 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__) |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 255 | #include <xsavecintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 256 | #endif |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 257 | |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 258 | #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__) |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 259 | #include <xsavesintrin.h> |
Nico Weber | 379a195 | 2016-05-16 18:14:07 +0000 | [diff] [blame^] | 260 | #endif |
Amjad Aboud | 2b9b8a5 | 2015-10-13 12:29:35 +0000 | [diff] [blame] | 261 | |
Eric Christopher | 29b7809 | 2015-06-17 18:42:03 +0000 | [diff] [blame] | 262 | /* Some intrinsics inside adxintrin.h are available only on processors with ADX, |
| 263 | * whereas others are also available at all times. */ |
Robert Khasanov | 83c419b | 2014-09-19 10:17:06 +0000 | [diff] [blame] | 264 | #include <adxintrin.h> |
| 265 | |
Benjamin Kramer | 65b9f7b | 2010-08-20 18:04:07 +0000 | [diff] [blame] | 266 | #endif /* __IMMINTRIN_H */ |