x64: detect FMA support

This commit is contained in:
Tillmann Karras
2013-11-13 04:46:34 +01:00
parent 2fecb033be
commit 6054129df8
2 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,7 @@ struct CPUInfo
bool bLZCNT; bool bLZCNT;
bool bSSE4A; bool bSSE4A;
bool bAVX; bool bAVX;
bool bFMA;
bool bAES; bool bAES;
bool bLAHFSAHF64; bool bLAHFSAHF64;
bool bLongMode; bool bLongMode;

View File

@ -169,7 +169,11 @@ void CPUInfo::Detect()
if (((cpu_id[2] >> 28) & 1) && ((cpu_id[2] >> 27) & 1)) if (((cpu_id[2] >> 28) & 1) && ((cpu_id[2] >> 27) & 1))
{ {
if ((_xgetbv(_XCR_XFEATURE_ENABLED_MASK) & 0x6) == 0x6) if ((_xgetbv(_XCR_XFEATURE_ENABLED_MASK) & 0x6) == 0x6)
{
bAVX = true; bAVX = true;
if ((cpu_id[2] >> 12) & 1)
bFMA = true;
}
} }
} }
if (max_ex_fn >= 0x80000004) { if (max_ex_fn >= 0x80000004) {
@ -225,6 +229,7 @@ std::string CPUInfo::Summarize()
if (bSSE4_2) sum += ", SSE4.2"; if (bSSE4_2) sum += ", SSE4.2";
if (HTT) sum += ", HTT"; if (HTT) sum += ", HTT";
if (bAVX) sum += ", AVX"; if (bAVX) sum += ", AVX";
if (bFMA) sum += ", FMA";
if (bAES) sum += ", AES"; if (bAES) sum += ", AES";
if (bLongMode) sum += ", 64-bit support"; if (bLongMode) sum += ", 64-bit support";
return sum; return sum;