mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:23:35 +02:00
Fix bug that causes GCC not to detect AVX2
This commit is contained in:
parent
04ad35aeb1
commit
2ce357db3a
1 changed files with 11 additions and 4 deletions
|
@ -143,10 +143,17 @@ static inline bool cpuSupportsAVX2() {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (cpuSupportsAVX()) {
|
if (cpuSupportsAVX()) {
|
||||||
|
|
||||||
if (__get_cpuid(0x7, &eax, &ebx, &ecx, &edx) && ((ebx & MASK_AVX2) == MASK_AVX2)) {
|
// Work around a bug where __get_cpuid(0x7) returns wrong values on older GCC
|
||||||
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756
|
||||||
|
if (__get_cpuid(0x0, &eax, &ebx, &ecx, &edx) && (eax >= 0x7)) {
|
||||||
|
|
||||||
|
__cpuid_count(0x7, 0x0, eax, ebx, ecx, edx);
|
||||||
|
|
||||||
|
if ((ebx & MASK_AVX2) == MASK_AVX2) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue