Chromium Code Reviews| Index: source/cpu_id.cc |
| diff --git a/source/cpu_id.cc b/source/cpu_id.cc |
| index 2fdb82ab0e3bd6ccaeb3e7461e7a86cd0c3f4329..56b3c403ddfc051204ed79fd52b3ca917b2eee21 100644 |
| --- a/source/cpu_id.cc |
| +++ b/source/cpu_id.cc |
| @@ -106,14 +106,17 @@ void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info) { |
| // X86 CPUs have xgetbv to detect OS saves high parts of ymm registers. |
| int GetXCR0() { |
| uint32 xcr0 = 0u; |
| -#if (defined(_MSC_VER) && !defined(__clang__)) && (_MSC_FULL_VER >= 160040219) |
| +#if defined(_MSC_VER) |
| +//0 && (defined(_MSC_VER) && !defined(__clang__)) && (_MSC_FULL_VER >= 160040219) |
|
harryjin
2015/12/08 07:48:58
? Remove?
fbarchard
2015/12/08 19:24:04
Done.
|
| xcr0 = (uint32)(_xgetbv(0)); // VS2010 SP1 required. |
| + printf("xgetbv xcr0 %d\n", xcr0); |
|
harryjin
2015/12/08 07:48:58
Remove the printf?
fbarchard
2015/12/08 19:24:04
Done.
|
| #elif defined(_M_IX86) && defined(_MSC_VER) && !defined(__clang__) |
| __asm { |
| xor ecx, ecx // xcr 0 |
| _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 // For VS2010 and earlier. |
| mov xcr0, eax |
| } |
| + printf("asm xcr0 %d\n", xcr0); |
|
harryjin
2015/12/08 07:48:58
same here?
fbarchard
2015/12/08 19:24:04
Done.
|
| #elif defined(__i386__) || defined(__x86_64__) |
| asm(".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx"); |
| #endif // defined(__i386__) || defined(__x86_64__) |
| @@ -197,8 +200,8 @@ int InitCpuFlags(void) { |
| #ifdef HAS_XGETBV |
| // AVX requires CPU has AVX, XSAVE and OSXSave for xgetbv |
| - if ((cpu_info1[2] & 0x1c000000) == 0x1c000000 && // AVX and OSXSave |
| - (GetXCR0() & 6) == 6) { // Test OD saves YMM registers |
| + if (((cpu_info1[2] & 0x1c000000) == 0x1c000000) && // AVX and OSXSave |
| + ((GetXCR0() & 6) == 6)) { // Test OS saves YMM registers |
| cpu_info |= ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) | kCpuHasAVX; |
| // Detect AVX512bw |