mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
dsp/cpu: add AVX2 detection
currently unused. https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf Change-Id: I314200f890c58b9a587b902b214f90deb95f0579
This commit is contained in:
parent
ab9f2f8685
commit
bdb151ee80
@ -38,6 +38,8 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
||||
: "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
||||
: "a"(info_type));
|
||||
}
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1500 // >= VS2008
|
||||
#define GetCPUInfo(info, type) __cpuidex(info, type, 0) // set ecx=0
|
||||
#elif defined(WEBP_MSC_SSE2)
|
||||
#define GetCPUInfo __cpuid
|
||||
#endif
|
||||
@ -87,6 +89,12 @@ static int x86CPUInfo(CPUFeature feature) {
|
||||
return (xgetbv() & 0x6) == 0x6;
|
||||
}
|
||||
}
|
||||
if (feature == kAVX2) {
|
||||
if (x86CPUInfo(kAVX)) {
|
||||
GetCPUInfo(cpu_info, 7);
|
||||
return ((cpu_info[1] & 0x00000020) == 0x00000020);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
VP8CPUInfo VP8GetCPUInfo = x86CPUInfo;
|
||||
|
@ -56,6 +56,7 @@ typedef enum {
|
||||
kSSE2,
|
||||
kSSE3,
|
||||
kAVX,
|
||||
kAVX2,
|
||||
kNEON,
|
||||
kMIPS32
|
||||
} CPUFeature;
|
||||
|
Loading…
Reference in New Issue
Block a user