mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
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 Change-Id: I95efb115b4d50bbdb6b14fca2aa63d0a24974e55
This commit is contained in:
parent
d581ba40ba
commit
d7c4b02a57
@ -29,14 +29,14 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
|||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
"xchg %%edi, %%ebx\n"
|
"xchg %%edi, %%ebx\n"
|
||||||
: "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
: "=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__)
|
#elif defined(__i386__) || defined(__x86_64__)
|
||||||
static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
||||||
__asm__ volatile (
|
__asm__ volatile (
|
||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
: "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
: "=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
|
#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729 // >= VS2008 SP1
|
||||||
#define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0
|
#define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0
|
||||||
|
Loading…
Reference in New Issue
Block a user