Commit 451a7541 authored by fbarchard@google.com's avatar fbarchard@google.com

Check number of functions available to cpuid before fetching function 7 results.

BUG=343
TESTED=local test on Windows.
R=brettw@chromium.org, tpsiaki@google.com

Review URL: https://webrtc-codereview.appspot.com/12969004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1035 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 9ffb92fa
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1032
Version: 1035
License: BSD
License File: LICENSE
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1032
#define LIBYUV_VERSION 1035
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -188,10 +188,14 @@ LIBYUV_API SAFEBUFFERS
int InitCpuFlags(void) {
#if !defined(__pnacl__) && !defined(__CLR_VER) && defined(CPU_X86)
uint32 cpu_info0[4] = { 0, 0, 0, 0 };
uint32 cpu_info1[4] = { 0, 0, 0, 0 };
uint32 cpu_info7[4] = { 0, 0, 0, 0 };
CpuId(0, 0, cpu_info0);
CpuId(1, 0, cpu_info1);
CpuId(7, 0, cpu_info7);
if (cpu_info0[0] >= 7) {
CpuId(7, 0, cpu_info7);
}
cpu_info_ = ((cpu_info1[3] & 0x04000000) ? kCpuHasSSE2 : 0) |
((cpu_info1[2] & 0x00000200) ? kCpuHasSSSE3 : 0) |
((cpu_info1[2] & 0x00080000) ? kCpuHasSSE41 : 0) |
......@@ -199,6 +203,7 @@ int InitCpuFlags(void) {
((cpu_info7[1] & 0x00000200) ? kCpuHasERMS : 0) |
((cpu_info1[2] & 0x00001000) ? kCpuHasFMA3 : 0) |
kCpuHasX86;
#ifdef HAS_XGETBV
if ((cpu_info1[2] & 0x18000000) == 0x18000000 && // AVX and OSSave
TestOsSaveYmm()) { // Saves YMM.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment