From c3671245e225215f4be2c8c3fde291da2b78e55c Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 10 Dec 2019 17:09:24 -0500 Subject: [PATCH] Add SSE4a CPUID check --- src/Math.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Math.cpp b/src/Math.cpp index 8213b52..726b134 100644 --- a/src/Math.cpp +++ b/src/Math.cpp @@ -49,7 +49,8 @@ void detectCPU() { *reinterpret_cast((char*)g_cpuFeatures.cpuVendor + 4) = regs[3]; *reinterpret_cast((char*)g_cpuFeatures.cpuVendor + 8) = regs[2]; getCpuInfo(0x80000000, regs); - if (regs[0] >= 0x80000004) { + int maxExtended = regs[0]; + if (maxExtended >= 0x80000004) { for (unsigned int i = 0x80000002; i <= 0x80000004; i++) { getCpuInfo(i, regs); // Interpret CPU brand string and cache information. @@ -79,6 +80,11 @@ void detectCPU() { memset((bool*)&g_cpuFeatures.AVX2, ((regs[1] & 0x00000020) != 0), 1); } + if (maxExtended >= 0x80000001) { + getCpuInfo(0x80000001, regs); + memset((bool*)&g_cpuFeatures.SSE4a, ((regs[2] & (1 << 6)) != 0), 1); + } + isCPUInit = true; #endif }