17 namespace VCL_NAMESPACE {
21 static inline uint64_t xgetbv(
int ctr ) {
22 #if ( defined( _MSC_FULL_VER ) && _MSC_FULL_VER >= 160040000 ) || \
23 ( defined( __INTEL_COMPILER ) && __INTEL_COMPILER >= 1200 )
26 return uint64_t( _xgetbv( ctr ) );
28 #elif defined( __GNUC__ ) || defined( __clang__ ) // use inline assembly, Gnu/AT&T syntax
31 __asm(
"xgetbv" :
"=a"( a ),
"=d"( d ) :
"c"( ctr ) : );
32 return a | ( uint64_t( d ) << 32 );
34 #else // #elif defined (_WIN32) // other compiler. try inline assembly with masm/intel/MS syntax
44 return a | ( uint64_t( d ) << 32 );
70 int abcd[4] = { 0, 0, 0, 0 };
72 if ( abcd[0] == 0 )
return iset;
74 if ( ( abcd[3] & ( 1 << 0 ) ) == 0 )
return iset;
75 if ( ( abcd[3] & ( 1 << 23 ) ) == 0 )
return iset;
76 if ( ( abcd[3] & ( 1 << 15 ) ) == 0 )
return iset;
77 if ( ( abcd[3] & ( 1 << 24 ) ) == 0 )
return iset;
78 if ( ( abcd[3] & ( 1 << 25 ) ) == 0 )
return iset;
80 if ( ( abcd[3] & ( 1 << 26 ) ) == 0 )
return iset;
82 if ( ( abcd[2] & ( 1 << 0 ) ) == 0 )
return iset;
84 if ( ( abcd[2] & ( 1 << 9 ) ) == 0 )
return iset;
86 if ( ( abcd[2] & ( 1 << 19 ) ) == 0 )
return iset;
88 if ( ( abcd[2] & ( 1 << 23 ) ) == 0 )
return iset;
89 if ( ( abcd[2] & ( 1 << 20 ) ) == 0 )
return iset;
91 if ( ( abcd[2] & ( 1 << 27 ) ) == 0 )
return iset;
92 if ( ( xgetbv( 0 ) & 6 ) != 6 )
return iset;
93 if ( ( abcd[2] & ( 1 << 28 ) ) == 0 )
return iset;
96 if ( ( abcd[1] & ( 1 << 5 ) ) == 0 )
return iset;
98 if ( ( abcd[1] & ( 1 << 16 ) ) == 0 )
return iset;
100 if ( ( abcd[0] & 0x60 ) != 0x60 )
return iset;
103 if ( ( abcd[1] & ( 1 << 31 ) ) == 0 )
return iset;
104 if ( ( abcd[1] & 0x40020000 ) != 0x40020000 )
return iset;
114 return ( ( abcd[2] & ( 1 << 12 ) ) != 0 );
121 cpuid( abcd, 0x80000001 );
122 return ( ( abcd[2] & ( 1 << 16 ) ) != 0 );
129 cpuid( abcd, 0x80000001 );
130 return ( ( abcd[2] & ( 1 << 11 ) ) != 0 );
138 return ( ( abcd[2] & ( 1 << 29 ) ) != 0 );
146 return ( ( abcd[1] & ( 1 << 27 ) ) != 0 );
154 return ( ( abcd[2] & ( 1 << 1 ) ) != 0 );
162 return ( ( abcd[2] & ( 1 << 6 ) ) != 0 );