Add check for VS version and ExtendedControlRegister (PR #766)
parent
6dfb428f10
commit
fc87f8666a
6
cpu.cpp
6
cpu.cpp
|
|
@ -57,7 +57,7 @@ unsigned long int getauxval(unsigned long int) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Visual Studio 2008 and below is missing _xgetbv. See x64dll.asm for the body.
|
// Visual Studio 2008 and below is missing _xgetbv. See x64dll.asm for the body.
|
||||||
#if defined(_MSC_VER) && defined(_M_X64)
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 && defined(_M_X64)
|
||||||
extern "C" unsigned long long __fastcall ExtendedControlRegister(unsigned int);
|
extern "C" unsigned long long __fastcall ExtendedControlRegister(unsigned int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -337,7 +337,7 @@ void DetectX86Features()
|
||||||
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
||||||
|
|
||||||
// Visual Studio 2008 and below lack xgetbv
|
// Visual Studio 2008 and below lack xgetbv
|
||||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
#elif defined(_MSC_VER) && _MSC_VER <= 1500 && defined(_M_IX86)
|
||||||
word32 a=0, d=0;
|
word32 a=0, d=0;
|
||||||
__asm {
|
__asm {
|
||||||
push eax
|
push eax
|
||||||
|
|
@ -357,7 +357,7 @@ void DetectX86Features()
|
||||||
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
||||||
|
|
||||||
// Visual Studio 2008 and below lack xgetbv
|
// Visual Studio 2008 and below lack xgetbv
|
||||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
#elif defined(_MSC_VER) && _MSC_VER <= 1500 && defined(_M_X64)
|
||||||
word64 xcr0 = ExtendedControlRegister(0);
|
word64 xcr0 = ExtendedControlRegister(0);
|
||||||
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG;
|
||||||
#elif defined(__SUNPRO_CC) // fall into
|
#elif defined(__SUNPRO_CC) // fall into
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue