mirror of
https://github.com/google/cpu_features.git
synced 2025-04-28 07:23:37 +02:00
detect intel sgx and smx cpu features for the x86 arch
This commit is contained in:
parent
bc8df0c1c5
commit
3ee0d62e87
@ -52,6 +52,9 @@ typedef struct {
|
|||||||
int avx512_4vnniw : 1;
|
int avx512_4vnniw : 1;
|
||||||
int avx512_4vbmi2 : 1;
|
int avx512_4vbmi2 : 1;
|
||||||
|
|
||||||
|
int smx : 1;
|
||||||
|
int sgx : 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;
|
||||||
|
|
||||||
@ -133,6 +136,8 @@ typedef enum {
|
|||||||
X86_AVX512VPOPCNTDQ,
|
X86_AVX512VPOPCNTDQ,
|
||||||
X86_AVX512_4VNNIW,
|
X86_AVX512_4VNNIW,
|
||||||
X86_AVX512_4VBMI2,
|
X86_AVX512_4VBMI2,
|
||||||
|
X86_SMX,
|
||||||
|
X86_SGX,
|
||||||
X86_LAST_,
|
X86_LAST_,
|
||||||
} X86FeaturesEnum;
|
} X86FeaturesEnum;
|
||||||
|
|
||||||
|
@ -102,6 +102,9 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info) {
|
|||||||
features->bmi2 = IsBitSet(leaf_7.ebx, 8);
|
features->bmi2 = IsBitSet(leaf_7.ebx, 8);
|
||||||
features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10);
|
features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10);
|
||||||
|
|
||||||
|
features->smx = IsBitSet(leaf_1.ecx, 6);
|
||||||
|
features->sgx = IsBitSet(leaf_7.ebx, 2);
|
||||||
|
|
||||||
if (have_sse_os_support) {
|
if (have_sse_os_support) {
|
||||||
features->ssse3 = IsBitSet(leaf_1.ecx, 9);
|
features->ssse3 = IsBitSet(leaf_1.ecx, 9);
|
||||||
features->sse4_1 = IsBitSet(leaf_1.ecx, 19);
|
features->sse4_1 = IsBitSet(leaf_1.ecx, 19);
|
||||||
@ -313,6 +316,10 @@ int GetX86FeaturesEnumValue(const X86Features* features,
|
|||||||
return features->avx512_4vnniw;
|
return features->avx512_4vnniw;
|
||||||
case X86_AVX512_4VBMI2:
|
case X86_AVX512_4VBMI2:
|
||||||
return features->avx512_4vbmi2;
|
return features->avx512_4vbmi2;
|
||||||
|
case X86_SMX:
|
||||||
|
return features->smx;
|
||||||
|
case X86_SGX:
|
||||||
|
return features->sgx;
|
||||||
case X86_LAST_:
|
case X86_LAST_:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -375,6 +382,10 @@ const char* GetX86FeaturesEnumName(X86FeaturesEnum value) {
|
|||||||
return "avx512_4vnniw";
|
return "avx512_4vnniw";
|
||||||
case X86_AVX512_4VBMI2:
|
case X86_AVX512_4VBMI2:
|
||||||
return "avx512_4vbmi2";
|
return "avx512_4vbmi2";
|
||||||
|
case X86_SMX:
|
||||||
|
return "smx";
|
||||||
|
case X86_SGX:
|
||||||
|
return "sgx";
|
||||||
case X86_LAST_:
|
case X86_LAST_:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user