simplify
parent
08871e448a
commit
3fa049f165
|
@ -29,17 +29,13 @@ const CpuInfo::CpuId Stockfish::CpuInfo::CPUID;
|
|||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
|
||||
void CpuInfo::cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
|
||||
__cpuidex(out, eax, ecx);
|
||||
}
|
||||
void CpuInfo::cpuid(int32_t out[4], int32_t eax, int32_t ecx) { __cpuidex(out, eax, ecx); }
|
||||
|
||||
# elif defined(__GNUC__) || defined(__clang__)
|
||||
|
||||
#include <cpuid.h>
|
||||
|
||||
void CpuInfo::cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
|
||||
__cpuid_count(eax, ecx, out[0], out[1], out[2], out[3]);
|
||||
}
|
||||
void CpuInfo::cpuid(int32_t out[4], int32_t eax, int32_t ecx) { __cpuid_count(eax, ecx, out[0], out[1], out[2], out[3]); }
|
||||
|
||||
#else
|
||||
# message "No CPU-ID intrinsic defined for compiler."
|
||||
|
@ -52,7 +48,7 @@ bool CpuInfo::osAVX() {
|
|||
if (OSXSAVE() && AVX())
|
||||
{
|
||||
// Check OS has enabled both XMM and YMM state support. Necessary for AVX and AVX2.
|
||||
return (CPUID._xcrFeatureMask & 0x06) == 0x06;
|
||||
return (xcrFeatureMask() & 0x06) == 0x06;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -69,7 +65,7 @@ bool CpuInfo::osAVX512() {
|
|||
if (osAVX() && AVX512F() && AVX512BW())
|
||||
{
|
||||
// Check for OS-support of ZMM and YMM state. Necessary for AVX-512.
|
||||
return (CPUID._xcrFeatureMask & 0xE6) == 0xE6;
|
||||
return (xcrFeatureMask() & 0xE6) == 0xE6;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ namespace Stockfish {
|
|||
static bool AVX512BW() { return CPUID._f7_EBX[30]; } // -mavx512bw
|
||||
static bool AVX512VL() { return CPUID._f7_EBX[31]; } // -mavx512vl
|
||||
static bool AVX512VNNI() { return CPUID._f7_ECX[11]; } // -mavx512vnni
|
||||
// flags reported by function 0x0D
|
||||
// XCR0 XFEATURE_ENABLED_MASK reported by function 0x0D
|
||||
static uint64_t xcrFeatureMask() { return CPUID._xcrFeatureMask; }
|
||||
|
||||
// flags reported by extended function 0x80000001
|
||||
static bool X64() { return CPUID._f81_EDX[29]; } // -DIS_64BIT
|
||||
|
@ -209,7 +210,7 @@ namespace Stockfish {
|
|||
std::bitset<32> _f7_EDX;
|
||||
std::bitset<32> _f81_EDX;
|
||||
|
||||
uint64_t _xcrFeatureMask; // XCR0 XFEATURE_ENABLED_MASK
|
||||
uint64_t _xcrFeatureMask;
|
||||
|
||||
std::vector<std::array<int32_t, 4>> _data;
|
||||
std::vector<std::array<int32_t, 4>> _dataExt;
|
||||
|
|
Loading…
Reference in New Issue