From 8508ab99a7df1b77278f0fc305ec2a6307c76928 Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 12 Jan 2015 17:58:57 -0800 Subject: [PATCH] cpu: fix AVX2 detection for gcc/clang targets ecx needs to be set to 0; the visual studio builds were already doing this. https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family (cherry picked from commit d7c4b02a57bcab6a42ee5b6277c3da39a404e2a7) Change-Id: I95efb115b4d50bbdb6b14fca2aa63d0a24974e55 --- src/dsp/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dsp/cpu.c b/src/dsp/cpu.c index 8754f874..3557ae02 100644 --- a/src/dsp/cpu.c +++ b/src/dsp/cpu.c @@ -29,14 +29,14 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) { "cpuid\n" "xchg %%edi, %%ebx\n" : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) - : "a"(info_type)); + : "a"(info_type), "c"(0)); } #elif defined(__i386__) || defined(__x86_64__) static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) { __asm__ volatile ( "cpuid\n" : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) - : "a"(info_type)); + : "a"(info_type), "c"(0)); } #elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 // >= VS2008 SP1 #define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0