mirror of
https://github.com/google/cpu_features.git
synced 2025-04-27 23:22:31 +02:00
Add X86 GFNI detection
This commit is contained in:
parent
8ca7c65f65
commit
3485a46a6d
@ -100,6 +100,7 @@ typedef struct {
|
|||||||
int ss : 1;
|
int ss : 1;
|
||||||
int adx : 1;
|
int adx : 1;
|
||||||
int lzcnt : 1; // Note: this flag is called ABM for AMD, LZCNT for Intel.
|
int lzcnt : 1; // Note: this flag is called ABM for AMD, LZCNT for Intel.
|
||||||
|
int gfni: 1;
|
||||||
// Make sure to update X86FeaturesEnum below if you add a field here.
|
// Make sure to update X86FeaturesEnum below if you add a field here.
|
||||||
} X86Features;
|
} X86Features;
|
||||||
|
|
||||||
@ -256,6 +257,7 @@ typedef enum {
|
|||||||
X86_SS,
|
X86_SS,
|
||||||
X86_ADX,
|
X86_ADX,
|
||||||
X86_LZCNT,
|
X86_LZCNT,
|
||||||
|
X86_GFNI,
|
||||||
X86_LAST_,
|
X86_LAST_,
|
||||||
} X86FeaturesEnum;
|
} X86FeaturesEnum;
|
||||||
|
|
||||||
|
@ -310,6 +310,7 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info,
|
|||||||
features->clflushopt = IsBitSet(leaf_7.ebx, 23);
|
features->clflushopt = IsBitSet(leaf_7.ebx, 23);
|
||||||
features->clwb = IsBitSet(leaf_7.ebx, 24);
|
features->clwb = IsBitSet(leaf_7.ebx, 24);
|
||||||
features->sha = IsBitSet(leaf_7.ebx, 29);
|
features->sha = IsBitSet(leaf_7.ebx, 29);
|
||||||
|
features->gfni = IsBitSet(leaf_7.ecx, 8);
|
||||||
features->vaes = IsBitSet(leaf_7.ecx, 9);
|
features->vaes = IsBitSet(leaf_7.ecx, 9);
|
||||||
features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10);
|
features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10);
|
||||||
features->adx = IsBitSet(leaf_7.ebx, 19);
|
features->adx = IsBitSet(leaf_7.ebx, 19);
|
||||||
@ -1895,7 +1896,8 @@ CacheInfo GetX86CacheInfo(void) {
|
|||||||
LINE(X86_DCA, dca, , , ) \
|
LINE(X86_DCA, dca, , , ) \
|
||||||
LINE(X86_SS, ss, , , ) \
|
LINE(X86_SS, ss, , , ) \
|
||||||
LINE(X86_ADX, adx, , , ) \
|
LINE(X86_ADX, adx, , , ) \
|
||||||
LINE(X86_LZCNT, lzcnt, , , )
|
LINE(X86_LZCNT, lzcnt, , , ) \
|
||||||
|
LINE(X86_GFNI, gfni, , , )
|
||||||
#define INTROSPECTION_PREFIX X86
|
#define INTROSPECTION_PREFIX X86
|
||||||
#define INTROSPECTION_ENUM_PREFIX X86
|
#define INTROSPECTION_ENUM_PREFIX X86
|
||||||
#include "define_introspection.inl"
|
#include "define_introspection.inl"
|
||||||
|
@ -1011,6 +1011,24 @@ TEST_F(CpuidX86Test, INTEL_TIGER_LAKE_AVX512) {
|
|||||||
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_TGL);
|
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_TGL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00706E5_IceLakeY_CPUID.txt
|
||||||
|
TEST_F(CpuidX86Test, INTEL_ICE_LAKE_GFNI) {
|
||||||
|
cpu().SetLeaves({
|
||||||
|
{{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}},
|
||||||
|
{{0x00000001, 0}, Leaf{0x000706E5, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
|
||||||
|
{{0x00000007, 0}, Leaf{0x00000000, 0xF2BF27EF, 0x40405F4E, 0xBC000410}},
|
||||||
|
});
|
||||||
|
|
||||||
|
const auto info = GetX86Info();
|
||||||
|
|
||||||
|
EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL);
|
||||||
|
EXPECT_EQ(info.family, 0x06);
|
||||||
|
EXPECT_EQ(info.model, 0x7E);
|
||||||
|
EXPECT_TRUE(info.features.gfni);
|
||||||
|
|
||||||
|
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ICL);
|
||||||
|
}
|
||||||
|
|
||||||
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0100FA0_K10_Thuban_CPUID.txt
|
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0100FA0_K10_Thuban_CPUID.txt
|
||||||
TEST_F(CpuidX86Test, AMD_THUBAN_CACHE_INFO) {
|
TEST_F(CpuidX86Test, AMD_THUBAN_CACHE_INFO) {
|
||||||
cpu().SetLeaves({
|
cpu().SetLeaves({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user