11 #include <QStringList>
14 #if defined (Q_PROCESSOR_X86)
29 uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
30 if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
31 qWarning () << Q_FUNC_INFO
32 <<
"failed to get CPUID eax = 1";
36 if (__get_cpuid_max (0,
nullptr) < 7)
37 qWarning () << Q_FUNC_INFO
38 <<
"cpuid max less than 7";
41 __cpuid_count (7, 0, eax, ebx, ecx, edx);
46 static std::once_flag dbgFlag;
47 std::call_once (dbgFlag,
48 [
this] { DumpDetectedFeatures (); });
77 return Ecx1_ & (1 << 9);
79 return Ecx1_ & (1 << 19);
81 return Ecx1_ & (1 << 28);
83 return Ecx1_ & (1 << 26);
93 void CpuFeatures::DumpDetectedFeatures ()
const
95 if (qEnvironmentVariableIsEmpty (
"DUMP_CPUFEATURES"))
99 QStringList undetected;
103 const auto feature =
static_cast<Feature> (i);
106 detected << featureName;
108 undetected << featureName;
111 qDebug () << Q_FUNC_INFO;
112 qDebug () <<
"detected the following CPU features:" << detected.join (
' ').toUtf8 ().constData ();
113 qDebug () <<
"couldn't detect the following CPU features:" << undetected.join (
' ').toUtf8 ().constData ();