Improve AVX check in CPUDetect. Warning fix.

Keeping the ifdef for zenfone - still doesn't work without it
This commit is contained in:
Henrik Rydgard 2014-11-11 23:48:58 +01:00
parent 7409263eb0
commit 784bf82b58
2 changed files with 6 additions and 5 deletions

View File

@ -196,10 +196,11 @@ void CPUInfo::Detect() {
// So let's just not bother with AVX on Android for now.
#ifndef ANDROID
// AVX support requires 3 separate checks:
// - Is the AVX bit set in CPUID?
// - Is the XSAVE bit set in CPUID?
// - Is the AVX bit set in CPUID? (>>28)
// - Is the XSAVE bit set in CPUID? ( >>26)
// - Is the OSXSAVE bit set in CPUID? ( >>27)
// - XGETBV result has the XCR bit set.
if (((cpu_id[2] >> 28) & 1) && ((cpu_id[2] >> 27) & 1))
if (((cpu_id[2] >> 28) & 1) && ((cpu_id[2] >> 27) & 1) && ((cpu_id[2] >> 26) & 1))
{
if ((_xgetbv(_XCR_XFEATURE_ENABLED_MASK) & 0x6) == 0x6)
{

View File

@ -22,11 +22,11 @@
#include "Common.h"
#ifdef _M_X64
#if defined(_M_X64) && !defined(_ARCH_64)
#define _ARCH_64
#endif
#ifdef _M_X64
#ifdef _ARCH_64
#define PTRBITS 64
#else
#define PTRBITS 32