Commit 0057aeb1 authored by fbarchard@google.com's avatar fbarchard@google.com

ERMS detect work around for compiler bug

BUG=213
TEST=cpu tool/unittest under sde
Review URL: https://webrtc-codereview.appspot.com/1283006

git-svn-id: http://libyuv.googlecode.com/svn/trunk@643 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c56a55fc
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 642 Version: 643
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 642 #define LIBYUV_VERSION 643
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -161,19 +161,20 @@ static bool TestEnv(const char* name) { ...@@ -161,19 +161,20 @@ static bool TestEnv(const char* name) {
LIBYUV_API LIBYUV_API
int InitCpuFlags(void) { int InitCpuFlags(void) {
#if !defined(__CLR_VER) && defined(CPU_X86) #if !defined(__CLR_VER) && defined(CPU_X86)
int cpu_info[4] = { 0, 0, 0, 0 }; int cpu_info1[4] = { 0, 0, 0, 0 };
__cpuid(cpu_info, 1); int cpu_info7[4] = { 0, 0, 0, 0 };
cpu_info_ = ((cpu_info[3] & 0x04000000) ? kCpuHasSSE2 : 0) | __cpuid(cpu_info1, 1);
((cpu_info[2] & 0x00000200) ? kCpuHasSSSE3 : 0) | __cpuid(cpu_info7, 7);
((cpu_info[2] & 0x00080000) ? kCpuHasSSE41 : 0) | cpu_info_ = ((cpu_info1[3] & 0x04000000) ? kCpuHasSSE2 : 0) |
((cpu_info[2] & 0x00100000) ? kCpuHasSSE42 : 0) | ((cpu_info1[2] & 0x00000200) ? kCpuHasSSSE3 : 0) |
((cpu_info1[2] & 0x00080000) ? kCpuHasSSE41 : 0) |
((cpu_info1[2] & 0x00100000) ? kCpuHasSSE42 : 0) |
((cpu_info7[1] & 0x00000200) ? kCpuHasERMS : 0) |
kCpuHasX86; kCpuHasX86;
#ifdef HAS_XGETBV #ifdef HAS_XGETBV
if ((cpu_info[2] & 0x18000000) == 0x18000000 && // AVX and OSSave if ((cpu_info1[2] & 0x18000000) == 0x18000000 && // AVX and OSSave
(XGetBV(kXCR_XFEATURE_ENABLED_MASK) & 0x06) == 0x06) { // Save YMM (XGetBV(kXCR_XFEATURE_ENABLED_MASK) & 0x06) == 0x06) { // Saves YMM.
__cpuid(cpu_info, 7); cpu_info_ |= ((cpu_info7[1] & 0x00000020) ? kCpuHasAVX2 : 0) |
cpu_info_ |= ((cpu_info[1] & 0x00000020) ? kCpuHasAVX2 : 0) |
((cpu_info[1] & 0x00000200) ? kCpuHasERMS : 0) |
kCpuHasAVX; kCpuHasAVX;
} }
#endif #endif
......
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