21 #define INSTRSET_H 125 24 #if ( defined( _M_AMD64 ) || defined( _M_X64 ) || defined( __amd64 ) ) && !defined( __x86_64__ ) 25 #define __x86_64__ 1 // There are many different macros for this, decide on only one 31 #if defined( __AVX512F__ ) || defined( __AVX512__ ) 33 #elif defined( __AVX2__ ) 35 #elif defined( __AVX__ ) 37 #elif defined( __SSE4_2__ ) 39 #elif defined( __SSE4_1__ ) 41 #elif defined( __SSSE3__ ) 43 #elif defined( __SSE3__ ) 45 #elif defined( __SSE2__ ) || defined( __x86_64__ ) 47 #elif defined( __SSE__ ) 49 #elif defined( _M_IX86_FP ) // Defined in MS compiler. 1: SSE, 2: SSE2 50 #define INSTRSET _M_IX86_FP 53 #endif // instruction set defines 57 #if INSTRSET > 7 // AVX2 and later 58 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) 59 #include <x86intrin.h> 63 #include <immintrin.h> 66 #include <immintrin.h> 68 #include <nmmintrin.h> 70 #include <smmintrin.h> 72 #include <tmmintrin.h> 74 #include <pmmintrin.h> 76 #include <emmintrin.h> 78 #include <xmmintrin.h> 81 #if INSTRSET >= 8 && !defined( __FMA__ ) 83 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && !defined( __clang__ ) 85 #pragma message "It is recommended to specify also option -mfma when using -mavx2 or higher" 92 #if defined( __XOP__ ) || defined( __FMA4__ ) 94 #include <x86intrin.h> 96 #include <ammintrin.h> 98 #elif defined( __SSE4A__ ) // AMD SSE4A 99 #include <ammintrin.h> 103 #if defined( __FMA__ ) && ( defined( __GNUC__ ) || defined( __clang__ ) ) && !defined( __INTEL_COMPILER ) 104 #include <fmaintrin.h> 108 #if defined( __FMA4__ ) && ( defined( __GNUC__ ) || defined( __clang__ ) ) 109 #include <fma4intrin.h> 113 #if defined( __GNUC__ ) || defined( __clang__ ) || ( defined( _MSC_VER ) && _MSC_VER >= 1600 ) 116 #elif defined( _MSC_VER ) 118 typedef signed __int8
int8_t;
119 typedef unsigned __int8
uint8_t;
120 typedef signed __int16
int16_t;
122 typedef signed __int32
int32_t;
124 typedef signed __int64
int64_t;
126 #ifndef _INTPTR_T_DEFINED 127 #define _INTPTR_T_DEFINED 153 #ifdef _MSC_VER // Microsoft compiler or compatible Intel compiler 172 #if defined( __GNUC__ ) && !defined( GCC_VERSION ) && !defined( __clang__ ) 173 #define GCC_VERSION ( (__GNUC__)*10000 + (__GNUC_MINOR__)*100 + ( __GNUC_PATCHLEVEL__ ) ) 177 #if defined( __clang__ ) 178 #define CLANG_VERSION ( (__clang_major__)*10000 + (__clang_minor__)*100 + ( __clang_patchlevel__ ) ) 186 #if defined( _WINDEF_ ) && defined( min ) && defined( max ) 204 template <u
int32_t n>
208 #define const_int( n ) ( Const_int_t<n>() ) // n must be compile-time integer constant 209 #define const_uint( n ) ( Const_uint_t<n>() ) // n must be compile-time unsigned integer constant
unsigned long long uint64_t
unsigned short int uint16_t
int instrset_detect(void)