Skip to content

Commit

Permalink
Detect Intel's Multi-Precision Add-Carry Instruction Extensions (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskwiatkowski committed May 21, 2021
1 parent 3e8243b commit d35e2f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/cpuinfo_x86.h
Expand Up @@ -89,6 +89,7 @@ typedef struct {

int dca : 1;
int ss : 1;
int adx : 1;
// Make sure to update X86FeaturesEnum below if you add a field here.
} X86Features;

Expand Down Expand Up @@ -214,6 +215,7 @@ typedef enum {
X86_RDRND,
X86_DCA,
X86_SS,
X86_ADX,
X86_LAST_,
} X86FeaturesEnum;

Expand Down
4 changes: 3 additions & 1 deletion src/cpuinfo_x86.c
Expand Up @@ -88,7 +88,8 @@
FEATURE(X86_MOVBE, movbe, "movbe", 0, 0) \
FEATURE(X86_RDRND, rdrnd, "rdrnd", 0, 0) \
FEATURE(X86_DCA, dca, "dca", 0, 0) \
FEATURE(X86_SS, ss, "ss", 0, 0)
FEATURE(X86_SS, ss, "ss", 0, 0) \
FEATURE(X86_ADX, adx, "adx", 0, 0)
#define DEFINE_TABLE_FEATURE_TYPE X86Features
#define DEFINE_TABLE_DONT_GENERATE_HWCAPS
#include "define_tables.h"
Expand Down Expand Up @@ -1314,6 +1315,7 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf,
features->sha = IsBitSet(leaf_7.ebx, 29);
features->vaes = IsBitSet(leaf_7.ecx, 9);
features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10);
features->adx = IsBitSet(leaf_7.ebx, 19);

if (os_support.have_sse_via_os) {
DetectSseViaOs(features);
Expand Down
1 change: 1 addition & 0 deletions test/cpuinfo_x86_test.cc
Expand Up @@ -148,6 +148,7 @@ TEST_F(CpuidX86Test, SandyBridge) {
EXPECT_TRUE(features.popcnt);
EXPECT_FALSE(features.movbe);
EXPECT_FALSE(features.rdrnd);
EXPECT_FALSE(features.adx);
}

const int KiB = 1024;
Expand Down

0 comments on commit d35e2f3

Please sign in to comment.