James Zern 2014-05-16 18:43:11 -07:00
parent ab9f2f8685
commit bdb151ee80
2 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -56,6 +56,7 @@ typedef enum {
kSSE2,
kSSE3,
kAVX,
kAVX2,
kNEON,
kMIPS32
} CPUFeature;