mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-03 18:45:46 +03:00
Fixed cpu features detection code for SDK
This commit is contained in:
parent
df21c21ce5
commit
629f313597
@ -44,7 +44,13 @@ void Sys_CheckCpuInstructionsSupport(void)
|
|||||||
{
|
{
|
||||||
int cpuid_data[4];
|
int cpuid_data[4];
|
||||||
|
|
||||||
|
#if defined ASMLIB_H
|
||||||
cpuid_ex(cpuid_data, 1, 0);
|
cpuid_ex(cpuid_data, 1, 0);
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
__get_cpuid(0x1, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]);
|
||||||
|
#else
|
||||||
|
__cpuidex((int*)cpuid_data, 1, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
cpuinfo.sse3 = (cpuid_data[2] & SSE3_FLAG) ? 1 : 0; // ecx
|
cpuinfo.sse3 = (cpuid_data[2] & SSE3_FLAG) ? 1 : 0; // ecx
|
||||||
cpuinfo.ssse3 = (cpuid_data[2] & SSSE3_FLAG) ? 1 : 0;
|
cpuinfo.ssse3 = (cpuid_data[2] & SSSE3_FLAG) ? 1 : 0;
|
||||||
@ -52,7 +58,13 @@ void Sys_CheckCpuInstructionsSupport(void)
|
|||||||
cpuinfo.sse4_2 = (cpuid_data[2] & SSE4_2_FLAG) ? 1 : 0;
|
cpuinfo.sse4_2 = (cpuid_data[2] & SSE4_2_FLAG) ? 1 : 0;
|
||||||
cpuinfo.avx = (cpuid_data[2] & AVX_FLAG) ? 1 : 0;
|
cpuinfo.avx = (cpuid_data[2] & AVX_FLAG) ? 1 : 0;
|
||||||
|
|
||||||
|
#if defined ASMLIB_H
|
||||||
cpuid_ex(cpuid_data, 7, 0);
|
cpuid_ex(cpuid_data, 7, 0);
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
__get_cpuid(0x7, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]);
|
||||||
|
#else
|
||||||
|
__cpuidex((int*)cpuid_data, 7, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
cpuinfo.avx2 = (cpuid_data[1] & AVX2_FLAG) ? 1 : 0; // ebx
|
cpuinfo.avx2 = (cpuid_data[1] & AVX2_FLAG) ? 1 : 0; // ebx
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user