Skip to content

Commit

Permalink
Add TSX Extension
Browse files Browse the repository at this point in the history
Add logic for TSX Check
  • Loading branch information
zminhquanz authored and Henrik Rydgard committed Sep 14, 2018
1 parent 2c92ad5 commit 49e2a2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Common/CPUDetect.cpp
Expand Up @@ -224,6 +224,11 @@ void CPUInfo::Detect() {
}
}


// TSX support require check:
// -- Is the RTM bit set in CPUID? (>>11)
// -- No need to check HLE bit because legacy processors ignore HLE hints
// -- See https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family
if (max_std_fn >= 7)
{
do_cpuid(cpu_id, 0x00000007);
Expand All @@ -236,6 +241,8 @@ void CPUInfo::Detect() {
bBMI2 = true;
if ((cpu_id[1] >> 29) & 1)
bSHA = true;
if ((cpu_id[1] >> 11) & 1)
bRTM = true;
}
}
if (max_ex_fn >= 0x80000004) {
Expand Down Expand Up @@ -419,6 +426,7 @@ std::string CPUInfo::Summarize()
if (bAES) sum += ", AES";
if (bSHA) sum += ", SHA";
if (bXOP) sum += ", XOP";
if (bRTM) sum += ", TSX";
if (bLongMode) sum += ", 64-bit support";
return sum;
}
Expand Down
1 change: 1 addition & 0 deletions Common/CPUDetect.h
Expand Up @@ -52,6 +52,7 @@ struct CPUInfo {
bool bBMI1;
bool bBMI2;
bool bXOP;
bool bRTM;

// x86 : SIMD 128 bit
bool bSSE;
Expand Down

0 comments on commit 49e2a2d

Please sign in to comment.