- added detection of more x86 extended CPU instructions
Replaced report of 3DNow support with recent fancy CPU instructions
This commit is contained in:
parent
6d47d79e22
commit
74685a1360
2 changed files with 125 additions and 19 deletions
|
|
@ -58,18 +58,11 @@ FString DumpCPUInfo(const CPUInfo *cpu)
|
|||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__i386__) && defined(__PIC__)
|
||||
// %ebx may by the PIC register. */
|
||||
#define __cpuid(output, func) \
|
||||
__asm__ __volatile__("xchgl\t%%ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchgl\t%%ebx, %1\n\t" \
|
||||
: "=a" ((output)[0]), "=r" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) \
|
||||
: "a" (func));
|
||||
#else
|
||||
#define __cpuid(output, func) __asm__ __volatile__("cpuid" : "=a" ((output)[0]),\
|
||||
"=b" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) : "a" (func));
|
||||
#endif
|
||||
#define __cpuidex(output, func, subfunc) \
|
||||
__asm__ __volatile__("cpuid" \
|
||||
: "=a" ((output)[0]), "=b" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) \
|
||||
: "a" (func), "c" (subfunc));
|
||||
#define __cpuid(output, func) __cpuidex(output, func, 0)
|
||||
#endif
|
||||
|
||||
void CheckCPUID(CPUInfo *cpu)
|
||||
|
|
@ -83,6 +76,7 @@ void CheckCPUID(CPUInfo *cpu)
|
|||
|
||||
// Get vendor ID
|
||||
__cpuid(foo, 0);
|
||||
const int maxid = foo[0];
|
||||
cpu->dwVendorID[0] = foo[1];
|
||||
cpu->dwVendorID[1] = foo[3];
|
||||
cpu->dwVendorID[2] = foo[2];
|
||||
|
|
@ -154,6 +148,17 @@ void CheckCPUID(CPUInfo *cpu)
|
|||
cpu->FeatureFlags[3] = foo[3]; // AMD feature flags
|
||||
}
|
||||
}
|
||||
|
||||
if (maxid >= 7)
|
||||
{
|
||||
__cpuidex(foo, 7, 0);
|
||||
cpu->FeatureFlags[4] = foo[1];
|
||||
cpu->FeatureFlags[5] = foo[2];
|
||||
cpu->FeatureFlags[6] = foo[3];
|
||||
|
||||
__cpuidex(foo, 7, 1);
|
||||
cpu->FeatureFlags[7] = foo[0];
|
||||
}
|
||||
}
|
||||
|
||||
FString DumpCPUInfo(const CPUInfo *cpu)
|
||||
|
|
@ -208,10 +213,12 @@ FString DumpCPUInfo(const CPUInfo *cpu)
|
|||
if (cpu->bSSE41) out += (" SSE4.1");
|
||||
if (cpu->bSSE42) out += (" SSE4.2");
|
||||
if (cpu->bAVX) out += (" AVX");
|
||||
if (cpu->bAVX2) out += (" AVX2");
|
||||
if (cpu->bAVX512_F) out += (" AVX512");
|
||||
if (cpu->bF16C) out += (" F16C");
|
||||
if (cpu->bFMA3) out += (" FMA3");
|
||||
if (cpu->b3DNow) out += (" 3DNow!");
|
||||
if (cpu->b3DNowPlus) out += (" 3DNow!+");
|
||||
if (cpu->bBMI1) out += (" BMI1");
|
||||
if (cpu->bBMI2) out += (" BMI2");
|
||||
if (cpu->HyperThreading) out += (" HyperThreading");
|
||||
out += ("\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue