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(__AVX__) 58#include <avxintrin.h> 59#endif 60 61#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__) 62#include <avx2intrin.h> 63 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 71static __inline __m256 __attribute__((__always_inline__, __nodebug__, __target__("f16c"))) 72_mm256_cvtph_ps(__m128i __a) 73{ 74 return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a); 75} 76#endif /* __AVX2__ */ 77 78#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__) 79#include <bmiintrin.h> 80#endif 81 82#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__) 83#include <bmi2intrin.h> 84#endif 85 86#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__) 87#include <lzcntintrin.h> 88#endif 89 90#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__) 91#include <fmaintrin.h> 92#endif 93 94#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__) 95#include <avx512fintrin.h> 96#endif 97 98#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__) 99#include <avx512vlintrin.h> 100#endif 101 102#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__) 103#include <avx512bwintrin.h> 104#endif 105 106#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__) 107#include <avx512cdintrin.h> 108#endif 109 110#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__) 111#include <avx512dqintrin.h> 112#endif 113 114#if !defined(_MSC_VER) || __has_feature(modules) || \ 115 (defined(__AVX512VL__) && defined(__AVX512BW__)) 116#include <avx512vlbwintrin.h> 117#endif 118 119#if !defined(_MSC_VER) || __has_feature(modules) || \ 120 (defined(__AVX512VL__) && defined(__AVX512CD__)) 121#include <avx512vlcdintrin.h> 122#endif 123 124#if !defined(_MSC_VER) || __has_feature(modules) || \ 125 (defined(__AVX512VL__) && defined(__AVX512DQ__)) 126#include <avx512vldqintrin.h> 127#endif 128 129#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__) 130#include <avx512erintrin.h> 131#endif 132 133#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__) 134#include <avx512ifmaintrin.h> 135#endif 136 137#if !defined(_MSC_VER) || __has_feature(modules) || \ 138 (defined(__AVX512IFMA__) && defined(__AVX512VL__)) 139#include <avx512ifmavlintrin.h> 140#endif 141 142#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__) 143#include <avx512vbmiintrin.h> 144#endif 145 146#if !defined(_MSC_VER) || __has_feature(modules) || \ 147 (defined(__AVX512VBMI__) && defined(__AVX512VL__)) 148#include <avx512vbmivlintrin.h> 149#endif 150 151#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__) 152#include <avx512pfintrin.h> 153#endif 154 155#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__) 156#include <pkuintrin.h> 157#endif 158 159#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__) 160static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) 161_rdrand16_step(unsigned short *__p) 162{ 163 return __builtin_ia32_rdrand16_step(__p); 164} 165 166static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) 167_rdrand32_step(unsigned int *__p) 168{ 169 return __builtin_ia32_rdrand32_step(__p); 170} 171 172#ifdef __x86_64__ 173static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) 174_rdrand64_step(unsigned long long *__p) 175{ 176 return __builtin_ia32_rdrand64_step(__p); 177} 178#endif 179#endif /* __RDRND__ */ 180 181#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__) 182#ifdef __x86_64__ 183static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 184_readfsbase_u32(void) 185{ 186 return __builtin_ia32_rdfsbase32(); 187} 188 189static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 190_readfsbase_u64(void) 191{ 192 return __builtin_ia32_rdfsbase64(); 193} 194 195static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 196_readgsbase_u32(void) 197{ 198 return __builtin_ia32_rdgsbase32(); 199} 200 201static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 202_readgsbase_u64(void) 203{ 204 return __builtin_ia32_rdgsbase64(); 205} 206 207static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 208_writefsbase_u32(unsigned int __V) 209{ 210 return __builtin_ia32_wrfsbase32(__V); 211} 212 213static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 214_writefsbase_u64(unsigned long long __V) 215{ 216 return __builtin_ia32_wrfsbase64(__V); 217} 218 219static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 220_writegsbase_u32(unsigned int __V) 221{ 222 return __builtin_ia32_wrgsbase32(__V); 223} 224 225static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) 226_writegsbase_u64(unsigned long long __V) 227{ 228 return __builtin_ia32_wrgsbase64(__V); 229} 230#endif 231#endif /* __FSGSBASE__ */ 232 233#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__) 234#include <rtmintrin.h> 235#include <xtestintrin.h> 236#endif 237 238#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__) 239#include <shaintrin.h> 240#endif 241 242#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__) 243#include <fxsrintrin.h> 244#endif 245 246#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__) 247#include <xsaveintrin.h> 248#endif 249 250#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__) 251#include <xsaveoptintrin.h> 252#endif 253 254#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__) 255#include <xsavecintrin.h> 256#endif 257 258#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__) 259#include <xsavesintrin.h> 260#endif 261 262/* Some intrinsics inside adxintrin.h are available only on processors with ADX, 263 * whereas others are also available at all times. */ 264#include <adxintrin.h> 265 266#endif /* __IMMINTRIN_H */ 267