Have "SSE42 capable" also include PCLMUL

This commit is contained in:
Nigel Tao committed 2021-01-24 22:11:17 +11:00
1 parent 8e89a17bb1
commit 77b9316aad
3 files changed
+10 -8

No files matched your search

+4 -3
View File
@@ -104,7 +104,8 @@ extern "C" {
// WUFFS_BASE__CPU_ARCH__X86_64__ETC are bits returned by
// wuffs_base__cpu_arch__x86_64__capabilities.
// - "SSE42" means all of SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and POPCNT.
// - "SSE42" means all of SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, PCLMUL and
// POPCNT.
// - "AVX2" means all of AVX and AVX2.
// - "AVX512ETC" is reserved, pending need. Note that AVX-512 consists of
// multiple extensions that may be implemented independently.
@@ -121,7 +122,7 @@ wuffs_base__cpu_arch__x86_64__capabilities() {
unsigned int ecx1 = 0;
unsigned int edx1 = 0;
if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {
const unsigned int sse42_ecx1 = bit_SSE4_2 | bit_POPCNT;
const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;
if ((ecx1 & sse42_ecx1) == sse42_ecx1) {
ret |= WUFFS_BASE__CPU_ARCH__X86_64__SSE42;
}
@@ -152,7 +153,7 @@ wuffs_base__cpu_arch__have_sse42() {
unsigned int ecx1 = 0;
unsigned int edx1 = 0;
if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {
const unsigned int sse42_ecx1 = bit_SSE4_2 | bit_POPCNT;
const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;
return (ecx1 & sse42_ecx1) == sse42_ecx1;
}
#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)