|
|
e354a5 |
commit ecbbadbf107ea1155ae5b71a8b7bd48f38c76731
|
|
|
e354a5 |
Author: H.J. Lu <hjl.tools@gmail.com>
|
|
|
e354a5 |
Date: Wed Jun 17 06:34:46 2020 -0700
|
|
|
e354a5 |
|
|
|
e354a5 |
x86: Update CPU feature detection [BZ #26149]
|
|
|
e354a5 |
|
|
|
e354a5 |
1. Divide architecture features into the usable features and the preferred
|
|
|
e354a5 |
features. The usable features are for correctness and can be exported in
|
|
|
e354a5 |
a stable ABI. The preferred features are for performance and only for
|
|
|
e354a5 |
glibc internal use.
|
|
|
e354a5 |
2. Change struct cpu_features to
|
|
|
e354a5 |
|
|
|
e354a5 |
struct cpu_features
|
|
|
e354a5 |
{
|
|
|
e354a5 |
struct cpu_features_basic basic;
|
|
|
e354a5 |
unsigned int *usable_p;
|
|
|
e354a5 |
struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
|
|
|
e354a5 |
unsigned int usable[USABLE_FEATURE_INDEX_MAX];
|
|
|
e354a5 |
unsigned int preferred[PREFERRED_FEATURE_INDEX_MAX];
|
|
|
e354a5 |
...
|
|
|
e354a5 |
};
|
|
|
e354a5 |
|
|
|
e354a5 |
and initialize usable_p to pointer to the usable arary so that
|
|
|
e354a5 |
|
|
|
e354a5 |
struct cpu_features
|
|
|
e354a5 |
{
|
|
|
e354a5 |
struct cpu_features_basic basic;
|
|
|
e354a5 |
unsigned int *usable_p;
|
|
|
e354a5 |
struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
|
|
|
e354a5 |
};
|
|
|
e354a5 |
|
|
|
e354a5 |
can be exported via a stable ABI. The cpuid and usable arrays can be
|
|
|
e354a5 |
expanded with backward binary compatibility for both .o and .so files.
|
|
|
e354a5 |
3. Add COMMON_CPUID_INDEX_7_ECX_1 for AVX512_BF16.
|
|
|
e354a5 |
4. Detect ENQCMD, PKS, AVX512_VP2INTERSECT, MD_CLEAR, SERIALIZE, HYBRID,
|
|
|
e354a5 |
TSXLDTRK, L1D_FLUSH, CORE_CAPABILITIES and AVX512_BF16.
|
|
|
e354a5 |
5. Rename CAPABILITIES to ARCH_CAPABILITIES.
|
|
|
e354a5 |
6. Check if AVX512_VP2INTERSECT, AVX512_BF16 and PKU are usable.
|
|
|
e354a5 |
7. Update CPU feature detection test.
|
|
|
e354a5 |
|
|
|
e354a5 |
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
|
|
|
e354a5 |
index ac694c032e7baf87..32f93bb3773a318b 100644
|
|
|
e354a5 |
--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
|
|
|
e354a5 |
+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
|
|
|
e354a5 |
@@ -33,7 +33,7 @@
|
|
|
e354a5 |
case 21: \
|
|
|
e354a5 |
if (!__libc_enable_secure \
|
|
|
e354a5 |
&& memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
|
|
|
e354a5 |
- GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
|
|
|
e354a5 |
+ GLRO(dl_x86_cpu_features).preferred[index_arch_Prefer_MAP_32BIT_EXEC] \
|
|
|
e354a5 |
|= bit_arch_Prefer_MAP_32BIT_EXEC; \
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
|
|
|
e354a5 |
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
index 37619c93f8dbcc5d..7b2a5bc3ed27ec39 100644
|
|
|
e354a5 |
--- a/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
+++ b/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
@@ -90,11 +90,18 @@ get_common_indices (struct cpu_features *cpu_features,
|
|
|
e354a5 |
}
|
|
|
e354a5 |
|
|
|
e354a5 |
if (cpu_features->basic.max_cpuid >= 7)
|
|
|
e354a5 |
- __cpuid_count (7, 0,
|
|
|
e354a5 |
- cpu_features->cpuid[COMMON_CPUID_INDEX_7].eax,
|
|
|
e354a5 |
- cpu_features->cpuid[COMMON_CPUID_INDEX_7].ebx,
|
|
|
e354a5 |
- cpu_features->cpuid[COMMON_CPUID_INDEX_7].ecx,
|
|
|
e354a5 |
- cpu_features->cpuid[COMMON_CPUID_INDEX_7].edx);
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ __cpuid_count (7, 0,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].eax,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].ebx,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].ecx,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].edx);
|
|
|
e354a5 |
+ __cpuid_count (7, 1,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7_ECX_1].eax,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7_ECX_1].ebx,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7_ECX_1].ecx,
|
|
|
e354a5 |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7_ECX_1].edx);
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
|
|
|
e354a5 |
if (cpu_features->basic.max_cpuid >= 0xd)
|
|
|
e354a5 |
__cpuid_count (0xd, 1,
|
|
|
e354a5 |
@@ -116,39 +123,39 @@ get_common_indices (struct cpu_features *cpu_features,
|
|
|
e354a5 |
/* Determine if AVX is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX))
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX_Usable;
|
|
|
e354a5 |
/* The following features depend on AVX being usable. */
|
|
|
e354a5 |
/* Determine if AVX2 is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX2))
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX2_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX2_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX2_Usable;
|
|
|
e354a5 |
|
|
|
e354a5 |
/* Unaligned load with 256-bit AVX registers are faster on
|
|
|
e354a5 |
Intel/AMD processors with AVX2. */
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
|= bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
/* Determine if FMA is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, FMA))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_FMA_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_FMA_Usable]
|
|
|
e354a5 |
|= bit_arch_FMA_Usable;
|
|
|
e354a5 |
/* Determine if VAES is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, VAES))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_VAES_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_VAES_Usable]
|
|
|
e354a5 |
|= bit_arch_VAES_Usable;
|
|
|
e354a5 |
/* Determine if VPCLMULQDQ is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, VPCLMULQDQ))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_VPCLMULQDQ_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_VPCLMULQDQ_Usable]
|
|
|
e354a5 |
|= bit_arch_VPCLMULQDQ_Usable;
|
|
|
e354a5 |
/* Determine if XOP is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, XOP))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_XOP_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_XOP_Usable]
|
|
|
e354a5 |
|= bit_arch_XOP_Usable;
|
|
|
e354a5 |
/* Determine if F16C is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, F16C))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_F16C_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_F16C_Usable]
|
|
|
e354a5 |
|= bit_arch_F16C_Usable;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -161,64 +168,73 @@ get_common_indices (struct cpu_features *cpu_features,
|
|
|
e354a5 |
/* Determine if AVX512F is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512F))
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512F_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512F_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512F_Usable;
|
|
|
e354a5 |
/* Determine if AVX512CD is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512CD))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512CD_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512CD_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512CD_Usable;
|
|
|
e354a5 |
/* Determine if AVX512ER is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512ER_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512ER_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512ER_Usable;
|
|
|
e354a5 |
/* Determine if AVX512PF is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512PF))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512PF_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512PF_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512PF_Usable;
|
|
|
e354a5 |
/* Determine if AVX512VL is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512VL))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512VL_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512VL_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512VL_Usable;
|
|
|
e354a5 |
/* Determine if AVX512DQ is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512DQ))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512DQ_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512DQ_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512DQ_Usable;
|
|
|
e354a5 |
/* Determine if AVX512BW is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512BW))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512BW_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512BW_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512BW_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_4FMAPS is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_4FMAPS))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_4FMAPS_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_4FMAPS_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_4FMAPS_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_4VNNIW is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_4VNNIW))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_4VNNIW_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_4VNNIW_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_4VNNIW_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_BITALG is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_BITALG))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_BITALG_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_BITALG_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_BITALG_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_IFMA is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_IFMA))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_IFMA_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_IFMA_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_IFMA_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_VBMI is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_VBMI))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_VBMI_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_VBMI_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_VBMI_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_VBMI2 is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_VBMI2))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_VBMI2_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_VBMI2_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_VBMI2_Usable;
|
|
|
e354a5 |
/* Determine if is AVX512_VNNI usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_VNNI))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_VNNI_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_VNNI_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_VNNI_Usable;
|
|
|
e354a5 |
/* Determine if AVX512_VPOPCNTDQ is usable. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512_VPOPCNTDQ))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX512_VPOPCNTDQ_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_VPOPCNTDQ_Usable]
|
|
|
e354a5 |
|= bit_arch_AVX512_VPOPCNTDQ_Usable;
|
|
|
e354a5 |
+ /* Determine if AVX512_VP2INTERSECT is usable. */
|
|
|
e354a5 |
+ if (CPU_FEATURES_CPU_P (cpu_features,
|
|
|
e354a5 |
+ AVX512_VP2INTERSECT))
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_VP2INTERSECT_Usable]
|
|
|
e354a5 |
+ |= bit_arch_AVX512_VP2INTERSECT_Usable;
|
|
|
e354a5 |
+ /* Determine if AVX512_BF16 is usable. */
|
|
|
e354a5 |
+ if (CPU_FEATURES_CPU_P (cpu_features, AVX512_BF16))
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX512_BF16_Usable]
|
|
|
e354a5 |
+ |= bit_arch_AVX512_BF16_Usable;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
@@ -284,13 +300,18 @@ get_common_indices (struct cpu_features *cpu_features,
|
|
|
e354a5 |
{
|
|
|
e354a5 |
cpu_features->xsave_state_size
|
|
|
e354a5 |
= ALIGN_UP (size + STATE_SAVE_OFFSET, 64);
|
|
|
e354a5 |
- cpu_features->feature[index_arch_XSAVEC_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_XSAVEC_Usable]
|
|
|
e354a5 |
|= bit_arch_XSAVEC_Usable;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ /* Determine if PKU is usable. */
|
|
|
e354a5 |
+ if (CPU_FEATURES_CPU_P (cpu_features, OSPKE))
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_PKU_Usable]
|
|
|
e354a5 |
+ |= bit_arch_PKU_Usable;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
|
|
|
e354a5 |
_Static_assert (((index_arch_Fast_Unaligned_Load
|
|
|
e354a5 |
@@ -314,6 +335,8 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
unsigned int stepping = 0;
|
|
|
e354a5 |
enum cpu_features_kind kind;
|
|
|
e354a5 |
|
|
|
e354a5 |
+ cpu_features->usable_p = cpu_features->usable;
|
|
|
e354a5 |
+
|
|
|
e354a5 |
#if !HAS_CPUID
|
|
|
e354a5 |
if (__get_cpuid_max (0, 0) == 0)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
@@ -344,7 +367,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
case 0x1c:
|
|
|
e354a5 |
case 0x26:
|
|
|
e354a5 |
/* BSF is slow on Atom. */
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Slow_BSF]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Slow_BSF]
|
|
|
e354a5 |
|= bit_arch_Slow_BSF;
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -371,7 +394,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
case 0x5d:
|
|
|
e354a5 |
/* Unaligned load versions are faster than SSSE3
|
|
|
e354a5 |
on Silvermont. */
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Fast_Unaligned_Load]
|
|
|
e354a5 |
|= (bit_arch_Fast_Unaligned_Load
|
|
|
e354a5 |
| bit_arch_Fast_Unaligned_Copy
|
|
|
e354a5 |
| bit_arch_Prefer_PMINUB_for_stringop
|
|
|
e354a5 |
@@ -383,7 +406,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
case 0x9c:
|
|
|
e354a5 |
/* Enable rep string instructions, unaligned load, unaligned
|
|
|
e354a5 |
copy, pminub and avoid SSE 4.2 on Tremont. */
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Fast_Rep_String]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Fast_Rep_String]
|
|
|
e354a5 |
|= (bit_arch_Fast_Rep_String
|
|
|
e354a5 |
| bit_arch_Fast_Unaligned_Load
|
|
|
e354a5 |
| bit_arch_Fast_Unaligned_Copy
|
|
|
e354a5 |
@@ -407,7 +430,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
case 0x2f:
|
|
|
e354a5 |
/* Rep string instructions, unaligned load, unaligned copy,
|
|
|
e354a5 |
and pminub are fast on Intel Core i3, i5 and i7. */
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Fast_Rep_String]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Fast_Rep_String]
|
|
|
e354a5 |
|= (bit_arch_Fast_Rep_String
|
|
|
e354a5 |
| bit_arch_Fast_Unaligned_Load
|
|
|
e354a5 |
| bit_arch_Fast_Unaligned_Copy
|
|
|
e354a5 |
@@ -442,10 +465,10 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
if AVX512ER is available. Don't use AVX512 to avoid lower CPU
|
|
|
e354a5 |
frequency if AVX512ER isn't available. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Prefer_No_VZEROUPPER]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Prefer_No_VZEROUPPER]
|
|
|
e354a5 |
|= bit_arch_Prefer_No_VZEROUPPER;
|
|
|
e354a5 |
else
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Prefer_No_AVX512]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Prefer_No_AVX512]
|
|
|
e354a5 |
|= bit_arch_Prefer_No_AVX512;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
/* This spells out "AuthenticAMD". */
|
|
|
e354a5 |
@@ -467,7 +490,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
/* Since the FMA4 bit is in COMMON_CPUID_INDEX_80000001 and
|
|
|
e354a5 |
FMA4 requires AVX, determine if FMA4 is usable here. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, FMA4))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_FMA4_Usable]
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_FMA4_Usable]
|
|
|
e354a5 |
|= bit_arch_FMA4_Usable;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -476,13 +499,13 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
/* "Excavator" */
|
|
|
e354a5 |
if (model >= 0x60 && model <= 0x7f)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Fast_Unaligned_Load]
|
|
|
e354a5 |
|= (bit_arch_Fast_Unaligned_Load
|
|
|
e354a5 |
| bit_arch_Fast_Copy_Backward);
|
|
|
e354a5 |
|
|
|
e354a5 |
/* Unaligned AVX loads are slower.*/
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
- &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
@@ -504,41 +527,38 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
if (model == 0xf || model == 0x19)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Usable]
|
|
|
e354a5 |
- &= (~bit_arch_AVX_Usable
|
|
|
e354a5 |
- & ~bit_arch_AVX2_Usable);
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX_Usable]
|
|
|
e354a5 |
+ &= ~(bit_arch_AVX_Usable | bit_arch_AVX2_Usable);
|
|
|
e354a5 |
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Slow_SSE4_2]
|
|
|
e354a5 |
- |= (bit_arch_Slow_SSE4_2);
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Slow_SSE4_2]
|
|
|
e354a5 |
+ |= bit_arch_Slow_SSE4_2;
|
|
|
e354a5 |
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
- &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
}
|
|
|
e354a5 |
else if (family == 0x7)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- if (model == 0x1b)
|
|
|
e354a5 |
- {
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Usable]
|
|
|
e354a5 |
- &= (~bit_arch_AVX_Usable
|
|
|
e354a5 |
- & ~bit_arch_AVX2_Usable);
|
|
|
e354a5 |
+ if (model == 0x1b)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX_Usable]
|
|
|
e354a5 |
+ &= ~(bit_arch_AVX_Usable | bit_arch_AVX2_Usable);
|
|
|
e354a5 |
|
|
|
e354a5 |
- cpu_features->feature[index_arch_Slow_SSE4_2]
|
|
|
e354a5 |
- |= bit_arch_Slow_SSE4_2;
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_Slow_SSE4_2]
|
|
|
e354a5 |
+ |= bit_arch_Slow_SSE4_2;
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+ else if (model == 0x3b)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ cpu_features->usable[index_arch_AVX_Usable]
|
|
|
e354a5 |
+ &= ~(bit_arch_AVX_Usable | bit_arch_AVX2_Usable);
|
|
|
e354a5 |
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
- &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
- }
|
|
|
e354a5 |
- else if (model == 0x3b)
|
|
|
e354a5 |
- {
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Usable]
|
|
|
e354a5 |
- &= (~bit_arch_AVX_Usable
|
|
|
e354a5 |
- & ~bit_arch_AVX2_Usable);
|
|
|
e354a5 |
-
|
|
|
e354a5 |
- cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
- &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
- }
|
|
|
e354a5 |
- }
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
|
|
|
e354a5 |
+ &= ~bit_arch_AVX_Fast_Unaligned_Load;
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
}
|
|
|
e354a5 |
else
|
|
|
e354a5 |
{
|
|
|
e354a5 |
@@ -548,11 +568,11 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
|
|
|
e354a5 |
/* Support i586 if CX8 is available. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, CX8))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_I586] |= bit_arch_I586;
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_I586] |= bit_arch_I586;
|
|
|
e354a5 |
|
|
|
e354a5 |
/* Support i686 if CMOV is available. */
|
|
|
e354a5 |
if (CPU_FEATURES_CPU_P (cpu_features, CMOV))
|
|
|
e354a5 |
- cpu_features->feature[index_arch_I686] |= bit_arch_I686;
|
|
|
e354a5 |
+ cpu_features->preferred[index_arch_I686] |= bit_arch_I686;
|
|
|
e354a5 |
|
|
|
e354a5 |
#if !HAS_CPUID
|
|
|
e354a5 |
no_cpuid:
|
|
|
e354a5 |
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
|
|
|
e354a5 |
index f18f7520fcb7714a..41c3855e94d16b49 100644
|
|
|
e354a5 |
--- a/sysdeps/x86/cpu-features.h
|
|
|
e354a5 |
+++ b/sysdeps/x86/cpu-features.h
|
|
|
e354a5 |
@@ -20,12 +20,20 @@
|
|
|
e354a5 |
|
|
|
e354a5 |
enum
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- /* The integer bit array index for the first set of internal feature
|
|
|
e354a5 |
+ /* The integer bit array index for the first set of usable feature
|
|
|
e354a5 |
bits. */
|
|
|
e354a5 |
- FEATURE_INDEX_1 = 0,
|
|
|
e354a5 |
- FEATURE_INDEX_2,
|
|
|
e354a5 |
+ USABLE_FEATURE_INDEX_1 = 0,
|
|
|
e354a5 |
/* The current maximum size of the feature integer bit array. */
|
|
|
e354a5 |
- FEATURE_INDEX_MAX
|
|
|
e354a5 |
+ USABLE_FEATURE_INDEX_MAX
|
|
|
e354a5 |
+};
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+enum
|
|
|
e354a5 |
+{
|
|
|
e354a5 |
+ /* The integer bit array index for the first set of preferred feature
|
|
|
e354a5 |
+ bits. */
|
|
|
e354a5 |
+ PREFERRED_FEATURE_INDEX_1 = 0,
|
|
|
e354a5 |
+ /* The current maximum size of the feature integer bit array. */
|
|
|
e354a5 |
+ PREFERRED_FEATURE_INDEX_MAX
|
|
|
e354a5 |
};
|
|
|
e354a5 |
|
|
|
e354a5 |
enum
|
|
|
e354a5 |
@@ -36,6 +44,7 @@ enum
|
|
|
e354a5 |
COMMON_CPUID_INDEX_D_ECX_1,
|
|
|
e354a5 |
COMMON_CPUID_INDEX_80000007,
|
|
|
e354a5 |
COMMON_CPUID_INDEX_80000008,
|
|
|
e354a5 |
+ COMMON_CPUID_INDEX_7_ECX_1,
|
|
|
e354a5 |
/* Keep the following line at the end. */
|
|
|
e354a5 |
COMMON_CPUID_INDEX_MAX
|
|
|
e354a5 |
};
|
|
|
e354a5 |
@@ -68,9 +77,11 @@ struct cpu_features_basic
|
|
|
e354a5 |
|
|
|
e354a5 |
struct cpu_features
|
|
|
e354a5 |
{
|
|
|
e354a5 |
- struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
|
|
|
e354a5 |
- unsigned int feature[FEATURE_INDEX_MAX];
|
|
|
e354a5 |
struct cpu_features_basic basic;
|
|
|
e354a5 |
+ unsigned int *usable_p;
|
|
|
e354a5 |
+ struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
|
|
|
e354a5 |
+ unsigned int usable[USABLE_FEATURE_INDEX_MAX];
|
|
|
e354a5 |
+ unsigned int preferred[PREFERRED_FEATURE_INDEX_MAX];
|
|
|
e354a5 |
/* The state size for XSAVEC or XSAVE. The type must be unsigned long
|
|
|
e354a5 |
int so that we use
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -102,7 +113,7 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
# define CPU_FEATURES_CPU_P(ptr, name) \
|
|
|
e354a5 |
((ptr->cpuid[index_cpu_##name].reg_##name & (bit_cpu_##name)) != 0)
|
|
|
e354a5 |
# define CPU_FEATURES_ARCH_P(ptr, name) \
|
|
|
e354a5 |
- ((ptr->feature[index_arch_##name] & (bit_arch_##name)) != 0)
|
|
|
e354a5 |
+ ((ptr->feature_##name[index_arch_##name] & (bit_arch_##name)) != 0)
|
|
|
e354a5 |
|
|
|
e354a5 |
/* HAS_CPU_FEATURE evaluates to true if CPU supports the feature. */
|
|
|
e354a5 |
#define HAS_CPU_FEATURE(name) \
|
|
|
e354a5 |
@@ -112,13 +123,12 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
# define HAS_ARCH_FEATURE(name) \
|
|
|
e354a5 |
CPU_FEATURES_ARCH_P (__get_cpu_features (), name)
|
|
|
e354a5 |
/* CPU_FEATURE_USABLE evaluates to true if the feature is usable. */
|
|
|
e354a5 |
-#define CPU_FEATURE_USABLE(name) \
|
|
|
e354a5 |
- ((need_arch_feature_##name && HAS_ARCH_FEATURE (name##_Usable)) \
|
|
|
e354a5 |
- || (!need_arch_feature_##name && HAS_CPU_FEATURE(name)))
|
|
|
e354a5 |
+#define CPU_FEATURE_USABLE(name) \
|
|
|
e354a5 |
+ HAS_ARCH_FEATURE (name##_Usable)
|
|
|
e354a5 |
|
|
|
e354a5 |
/* Architecture features. */
|
|
|
e354a5 |
|
|
|
e354a5 |
-/* FEATURE_INDEX_1. */
|
|
|
e354a5 |
+/* USABLE_FEATURE_INDEX_1. */
|
|
|
e354a5 |
#define bit_arch_AVX_Usable (1u << 0)
|
|
|
e354a5 |
#define bit_arch_AVX2_Usable (1u << 1)
|
|
|
e354a5 |
#define bit_arch_AVX512F_Usable (1u << 2)
|
|
|
e354a5 |
@@ -143,237 +153,65 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
#define bit_arch_XOP_Usable (1u << 21)
|
|
|
e354a5 |
#define bit_arch_XSAVEC_Usable (1u << 22)
|
|
|
e354a5 |
#define bit_arch_F16C_Usable (1u << 23)
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-#define index_arch_AVX_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX2_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512F_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512CD_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512ER_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512PF_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512VL_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512BW_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512DQ_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_4FMAPS_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_4VNNIW_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_BITALG_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_IFMA_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_VBMI_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_VBMI2_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_VNNI_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AVX512_VPOPCNTDQ_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FMA_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FMA4_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_VAES_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_VPCLMULQDQ_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XOP_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XSAVEC_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_F16C_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* Unused. Compiler will optimize them out. */
|
|
|
e354a5 |
-#define bit_arch_SSE3_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_PCLMULQDQ_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSSE3_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CMPXCHG16B_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSE4_1_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSE4_2_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_MOVBE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_POPCNT_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_AES_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_XSAVE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_OSXSAVE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_RDRAND_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_FPU_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_TSC_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_MSR_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CX8_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SEP_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CMOV_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CLFSH_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_MMX_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_FXSR_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSE2_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_FSGSBASE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_BMI1_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_HLE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_BMI2_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_ERMS_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_RTM_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_RDSEED_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_ADX_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CLFLUSHOPT_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CLWB_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SHA_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_PREFETCHWT1_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_GFNI_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_RDPID_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_CLDEMOTE_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_MOVDIRI_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_MOVDIR64B_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_FSRM_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_LAHF64_SAHF64_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SVM_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_LZCNT_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SSE4A_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_PREFETCHW_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_TBM_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_SYSCALL_SYSRET_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_RDTSCP_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_XSAVEOPT_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_XGETBV_ECX_1_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_XSAVES_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_INVARIANT_TSC_Usable (1u << 0)
|
|
|
e354a5 |
-#define bit_arch_WBNOINVD_Usable (1u << 0)
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* Unused. Compiler will optimize them out. */
|
|
|
e354a5 |
-#define index_arch_SSE3_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_PCLMULQDQ_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSSE3_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CMPXCHG16B_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSE4_1_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSE4_2_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_MOVBE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_POPCNT_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_AES_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XSAVE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_OSXSAVE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_RDRAND_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FPU_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_TSC_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_MSR_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CX8_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SEP_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CMOV_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CLFSH_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_MMX_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FXSR_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSE2_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FSGSBASE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_BMI1_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_HLE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_BMI2_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_ERMS_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_RTM_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_RDSEED_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_ADX_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CLFLUSHOPT_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CLWB_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SHA_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_PREFETCHWT1_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_GFNI_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_RDPID_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_CLDEMOTE_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_MOVDIRI_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_MOVDIR64B_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_FSRM_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_LAHF64_SAHF64_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_LZCNT_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SSE4A_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_PREFETCHW_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_TBM_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_SYSCALL_SYSRET_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_RDTSCP_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XSAVEOPT_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XGETBV_ECX_1_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_XSAVES_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_INVARIANT_TSC_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-#define index_arch_WBNOINVD_Usable FEATURE_INDEX_1
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* COMMON_CPUID_INDEX_1. */
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* ECX. */
|
|
|
e354a5 |
-#define need_arch_feature_SSE3 0
|
|
|
e354a5 |
-#define need_arch_feature_PCLMULQDQ 0
|
|
|
e354a5 |
-#define need_arch_feature_SSSE3 0
|
|
|
e354a5 |
-#define need_arch_feature_FMA 1
|
|
|
e354a5 |
-#define need_arch_feature_CMPXCHG16B 0
|
|
|
e354a5 |
-#define need_arch_feature_SSE4_1 0
|
|
|
e354a5 |
-#define need_arch_feature_SSE4_2 0
|
|
|
e354a5 |
-#define need_arch_feature_MOVBE 0
|
|
|
e354a5 |
-#define need_arch_feature_POPCNT 0
|
|
|
e354a5 |
-#define need_arch_feature_AES 0
|
|
|
e354a5 |
-#define need_arch_feature_XSAVE 0
|
|
|
e354a5 |
-#define need_arch_feature_OSXSAVE 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX 1
|
|
|
e354a5 |
-#define need_arch_feature_F16C 1
|
|
|
e354a5 |
-#define need_arch_feature_RDRAND 0
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* EDX. */
|
|
|
e354a5 |
-#define need_arch_feature_FPU 0
|
|
|
e354a5 |
-#define need_arch_feature_TSC 0
|
|
|
e354a5 |
-#define need_arch_feature_MSR 0
|
|
|
e354a5 |
-#define need_arch_feature_CX8 0
|
|
|
e354a5 |
-#define need_arch_feature_SEP 0
|
|
|
e354a5 |
-#define need_arch_feature_CMOV 0
|
|
|
e354a5 |
-#define need_arch_feature_CLFSH 0
|
|
|
e354a5 |
-#define need_arch_feature_MMX 0
|
|
|
e354a5 |
-#define need_arch_feature_FXSR 0
|
|
|
e354a5 |
-#define need_arch_feature_SSE 0
|
|
|
e354a5 |
-#define need_arch_feature_SSE2 0
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* COMMON_CPUID_INDEX_7. */
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* EBX. */
|
|
|
e354a5 |
-#define need_arch_feature_FSGSBASE 0
|
|
|
e354a5 |
-#define need_arch_feature_BMI1 0
|
|
|
e354a5 |
-#define need_arch_feature_HLE 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX2 1
|
|
|
e354a5 |
-#define need_arch_feature_BMI2 0
|
|
|
e354a5 |
-#define need_arch_feature_ERMS 0
|
|
|
e354a5 |
-#define need_arch_feature_RTM 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX512F 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512DQ 1
|
|
|
e354a5 |
-#define need_arch_feature_RDSEED 0
|
|
|
e354a5 |
-#define need_arch_feature_ADX 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_IFMA 1
|
|
|
e354a5 |
-#define need_arch_feature_CLFLUSHOPT 0
|
|
|
e354a5 |
-#define need_arch_feature_CLWB 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX512PF 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512ER 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512CD 1
|
|
|
e354a5 |
-#define need_arch_feature_SHA 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX512BW 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512VL 1
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* ECX. */
|
|
|
e354a5 |
-#define need_arch_feature_PREFETCHWT1 0
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_VBMI 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_VBMI2 1
|
|
|
e354a5 |
-#define need_arch_feature_GFNI 0
|
|
|
e354a5 |
-#define need_arch_feature_VAES 1
|
|
|
e354a5 |
-#define need_arch_feature_VPCLMULQDQ 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_VNNI 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_BITALG 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_VPOPCNTDQ 1
|
|
|
e354a5 |
-#define need_arch_feature_RDPID 0
|
|
|
e354a5 |
-#define need_arch_feature_CLDEMOTE 0
|
|
|
e354a5 |
-#define need_arch_feature_MOVDIRI 0
|
|
|
e354a5 |
-#define need_arch_feature_MOVDIR64B 0
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* EDX. */
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_4VNNIW 1
|
|
|
e354a5 |
-#define need_arch_feature_AVX512_4FMAPS 1
|
|
|
e354a5 |
-#define need_arch_feature_FSRM 0
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* COMMON_CPUID_INDEX_80000001. */
|
|
|
e354a5 |
-
|
|
|
e354a5 |
-/* ECX. */
|
|
|
e354a5 |
-#define need_arch_feature_LAHF64_SAHF64 0
|
|
|
e354a5 |
-#define need_arch_feature_LZCNT 0
|
|
|
e354a5 |
-#define need_arch_feature_SSE4A 0
|
|
|
e354a5 |
-#define need_arch_feature_PREFETCHW 0
|
|
|
e354a5 |
-#define need_arch_feature_XOP 1
|
|
|
e354a5 |
-#define need_arch_feature_FMA4 1
|
|
|
e354a5 |
-#define need_arch_feature_TBM 0
|
|
|
e354a5 |
-#define need_arch_feature_SYSCALL_SYSRET 0
|
|
|
e354a5 |
-#define need_arch_feature_RDTSCP 0
|
|
|
e354a5 |
-#define need_arch_feature_XSAVEOPT 0
|
|
|
e354a5 |
-#define need_arch_feature_XSAVEC 1
|
|
|
e354a5 |
-#define need_arch_feature_XGETBV_ECX_1 0
|
|
|
e354a5 |
-#define need_arch_feature_XSAVES 0
|
|
|
e354a5 |
-#define need_arch_feature_INVARIANT_TSC 0
|
|
|
e354a5 |
-#define need_arch_feature_WBNOINVD 0
|
|
|
e354a5 |
+#define bit_arch_AVX512_VP2INTERSECT_Usable (1u << 24)
|
|
|
e354a5 |
+#define bit_arch_AVX512_BF16_Usable (1u << 25)
|
|
|
e354a5 |
+#define bit_arch_PKU_Usable (1u << 26)
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+#define index_arch_AVX_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX2_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512F_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512CD_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512ER_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512PF_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512VL_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512BW_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512DQ_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_4FMAPS_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_4VNNIW_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_BITALG_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_IFMA_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_VBMI_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_VBMI2_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_VNNI_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_VPOPCNTDQ_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_FMA_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_FMA4_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_VAES_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_VPCLMULQDQ_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_XOP_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_XSAVEC_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_F16C_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_VP2INTERSECT_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX512_BF16_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_PKU_Usable USABLE_FEATURE_INDEX_1
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+#define feature_AVX_Usable usable
|
|
|
e354a5 |
+#define feature_AVX2_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512F_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512CD_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512ER_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512PF_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512VL_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512BW_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512DQ_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_4FMAPS_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_4VNNIW_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_BITALG_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_IFMA_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_VBMI_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_VBMI2_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_VNNI_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_VPOPCNTDQ_Usable usable
|
|
|
e354a5 |
+#define feature_FMA_Usable usable
|
|
|
e354a5 |
+#define feature_FMA4_Usable usable
|
|
|
e354a5 |
+#define feature_VAES_Usable usable
|
|
|
e354a5 |
+#define feature_VPCLMULQDQ_Usable usable
|
|
|
e354a5 |
+#define feature_XOP_Usable usable
|
|
|
e354a5 |
+#define feature_XSAVEC_Usable usable
|
|
|
e354a5 |
+#define feature_F16C_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_VP2INTERSECT_Usable usable
|
|
|
e354a5 |
+#define feature_AVX512_BF16_Usable usable
|
|
|
e354a5 |
+#define feature_PKU_Usable usable
|
|
|
e354a5 |
|
|
|
e354a5 |
/* CPU features. */
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -494,17 +332,26 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
#define bit_cpu_CLDEMOTE (1u << 25)
|
|
|
e354a5 |
#define bit_cpu_MOVDIRI (1u << 27)
|
|
|
e354a5 |
#define bit_cpu_MOVDIR64B (1u << 28)
|
|
|
e354a5 |
+#define bit_cpu_ENQCMD (1u << 29)
|
|
|
e354a5 |
#define bit_cpu_SGX_LC (1u << 30)
|
|
|
e354a5 |
+#define bit_cpu_PKS (1u << 31)
|
|
|
e354a5 |
|
|
|
e354a5 |
/* EDX. */
|
|
|
e354a5 |
#define bit_cpu_AVX512_4VNNIW (1u << 2)
|
|
|
e354a5 |
#define bit_cpu_AVX512_4FMAPS (1u << 3)
|
|
|
e354a5 |
#define bit_cpu_FSRM (1u << 4)
|
|
|
e354a5 |
+#define bit_cpu_AVX512_VP2INTERSECT (1u << 8)
|
|
|
e354a5 |
+#define bit_cpu_MD_CLEAR (1u << 10)
|
|
|
e354a5 |
+#define bit_cpu_SERIALIZE (1u << 14)
|
|
|
e354a5 |
+#define bit_cpu_HYBRID (1u << 15)
|
|
|
e354a5 |
+#define bit_cpu_TSXLDTRK (1u << 16)
|
|
|
e354a5 |
#define bit_cpu_PCONFIG (1u << 18)
|
|
|
e354a5 |
#define bit_cpu_IBT (1u << 20)
|
|
|
e354a5 |
#define bit_cpu_IBRS_IBPB (1u << 26)
|
|
|
e354a5 |
#define bit_cpu_STIBP (1u << 27)
|
|
|
e354a5 |
-#define bit_cpu_CAPABILITIES (1u << 29)
|
|
|
e354a5 |
+#define bit_cpu_L1D_FLUSH (1u << 28)
|
|
|
e354a5 |
+#define bit_cpu_ARCH_CAPABILITIES (1u << 29)
|
|
|
e354a5 |
+#define bit_cpu_CORE_CAPABILITIES (1u << 30)
|
|
|
e354a5 |
#define bit_cpu_SSBD (1u << 31)
|
|
|
e354a5 |
|
|
|
e354a5 |
/* COMMON_CPUID_INDEX_80000001. */
|
|
|
e354a5 |
@@ -545,6 +392,11 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
/* EBX. */
|
|
|
e354a5 |
#define bit_cpu_WBNOINVD (1u << 9)
|
|
|
e354a5 |
|
|
|
e354a5 |
+/* COMMON_CPUID_INDEX_7_ECX_1. */
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+/* EAX. */
|
|
|
e354a5 |
+#define bit_cpu_AVX512_BF16 (1u << 5)
|
|
|
e354a5 |
+
|
|
|
e354a5 |
/* COMMON_CPUID_INDEX_1. */
|
|
|
e354a5 |
|
|
|
e354a5 |
/* ECX. */
|
|
|
e354a5 |
@@ -662,17 +514,26 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
#define index_cpu_CLDEMOTE COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_MOVDIRI COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_MOVDIR64B COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_ENQCMD COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_SGX_LC COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_PKS COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
|
|
|
e354a5 |
/* EDX. */
|
|
|
e354a5 |
#define index_cpu_AVX512_4VNNIW COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_AVX512_4FMAPS COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_FSRM COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_AVX512_VP2INTERSECT COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_MD_CLEAR COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_SERIALIZE COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_HYBRID COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_TSXLDTRK COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_PCONFIG COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_IBT COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_IBRS_IBPB COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_STIBP COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
-#define index_cpu_CAPABILITIES COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_L1D_FLUSH COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_ARCH_CAPABILITIES COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
+#define index_cpu_CORE_CAPABILITIES COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
#define index_cpu_SSBD COMMON_CPUID_INDEX_7
|
|
|
e354a5 |
|
|
|
e354a5 |
/* COMMON_CPUID_INDEX_80000001. */
|
|
|
e354a5 |
@@ -713,6 +574,11 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
/* EBX. */
|
|
|
e354a5 |
#define index_cpu_WBNOINVD COMMON_CPUID_INDEX_80000008
|
|
|
e354a5 |
|
|
|
e354a5 |
+/* COMMON_CPUID_INDEX_7_ECX_1. */
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+/* EAX. */
|
|
|
e354a5 |
+#define index_cpu_AVX512_BF16 COMMON_CPUID_INDEX_7_ECX_1
|
|
|
e354a5 |
+
|
|
|
e354a5 |
/* COMMON_CPUID_INDEX_1. */
|
|
|
e354a5 |
|
|
|
e354a5 |
/* ECX. */
|
|
|
e354a5 |
@@ -830,17 +696,26 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
#define reg_CLDEMOTE ecx
|
|
|
e354a5 |
#define reg_MOVDIRI ecx
|
|
|
e354a5 |
#define reg_MOVDIR64B ecx
|
|
|
e354a5 |
+#define reg_ENQCMD ecx
|
|
|
e354a5 |
#define reg_SGX_LC ecx
|
|
|
e354a5 |
+#define reg_PKS ecx
|
|
|
e354a5 |
|
|
|
e354a5 |
/* EDX. */
|
|
|
e354a5 |
#define reg_AVX512_4VNNIW edx
|
|
|
e354a5 |
#define reg_AVX512_4FMAPS edx
|
|
|
e354a5 |
#define reg_FSRM edx
|
|
|
e354a5 |
+#define reg_AVX512_VP2INTERSECT edx
|
|
|
e354a5 |
+#define reg_MD_CLEAR edx
|
|
|
e354a5 |
+#define reg_SERIALIZE edx
|
|
|
e354a5 |
+#define reg_HYBRID edx
|
|
|
e354a5 |
+#define reg_TSXLDTRK edx
|
|
|
e354a5 |
#define reg_PCONFIG edx
|
|
|
e354a5 |
#define reg_IBT edx
|
|
|
e354a5 |
#define reg_IBRS_IBPB edx
|
|
|
e354a5 |
#define reg_STIBP edx
|
|
|
e354a5 |
-#define reg_CAPABILITIES edx
|
|
|
e354a5 |
+#define reg_L1D_FLUSH edx
|
|
|
e354a5 |
+#define reg_ARCH_CAPABILITIES edx
|
|
|
e354a5 |
+#define reg_CORE_CAPABILITIES edx
|
|
|
e354a5 |
#define reg_SSBD edx
|
|
|
e354a5 |
|
|
|
e354a5 |
/* COMMON_CPUID_INDEX_80000001. */
|
|
|
e354a5 |
@@ -881,6 +756,11 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
/* EBX. */
|
|
|
e354a5 |
#define reg_WBNOINVD ebx
|
|
|
e354a5 |
|
|
|
e354a5 |
+/* COMMON_CPUID_INDEX_7_ECX_1. */
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+/* EAX. */
|
|
|
e354a5 |
+#define reg_AVX512_BF16 eax
|
|
|
e354a5 |
+
|
|
|
e354a5 |
/* FEATURE_INDEX_2. */
|
|
|
e354a5 |
#define bit_arch_I586 (1u << 0)
|
|
|
e354a5 |
#define bit_arch_I686 (1u << 1)
|
|
|
e354a5 |
@@ -899,22 +779,39 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
e354a5 |
#define bit_arch_Prefer_No_AVX512 (1u << 14)
|
|
|
e354a5 |
#define bit_arch_MathVec_Prefer_No_AVX512 (1u << 15)
|
|
|
e354a5 |
|
|
|
e354a5 |
-#define index_arch_Fast_Rep_String FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Fast_Copy_Backward FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Slow_BSF FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Fast_Unaligned_Load FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_PMINUB_for_stringop FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_I586 FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_I686 FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Slow_SSE4_2 FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_AVX_Fast_Unaligned_Load FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_MAP_32BIT_EXEC FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_ERMS FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_No_AVX512 FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_MathVec_Prefer_No_AVX512 FEATURE_INDEX_2
|
|
|
e354a5 |
-#define index_arch_Prefer_FSRM FEATURE_INDEX_2
|
|
|
e354a5 |
+#define index_arch_Fast_Rep_String PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Fast_Copy_Backward PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Slow_BSF PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_PMINUB_for_stringop PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Fast_Unaligned_Copy PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_I586 PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_I686 PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Slow_SSE4_2 PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_AVX_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_MAP_32BIT_EXEC PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_No_VZEROUPPER PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_ERMS PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_MathVec_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+#define index_arch_Prefer_FSRM PREFERRED_FEATURE_INDEX_1
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+#define feature_Fast_Rep_String preferred
|
|
|
e354a5 |
+#define feature_Fast_Copy_Backward preferred
|
|
|
e354a5 |
+#define feature_Slow_BSF preferred
|
|
|
e354a5 |
+#define feature_Fast_Unaligned_Load preferred
|
|
|
e354a5 |
+#define feature_Prefer_PMINUB_for_stringop preferred
|
|
|
e354a5 |
+#define feature_Fast_Unaligned_Copy preferred
|
|
|
e354a5 |
+#define feature_I586 preferred
|
|
|
e354a5 |
+#define feature_I686 preferred
|
|
|
e354a5 |
+#define feature_Slow_SSE4_2 preferred
|
|
|
e354a5 |
+#define feature_AVX_Fast_Unaligned_Load preferred
|
|
|
e354a5 |
+#define feature_Prefer_MAP_32BIT_EXEC preferred
|
|
|
e354a5 |
+#define feature_Prefer_No_VZEROUPPER preferred
|
|
|
e354a5 |
+#define feature_Prefer_ERMS preferred
|
|
|
e354a5 |
+#define feature_Prefer_No_AVX512 preferred
|
|
|
e354a5 |
+#define feature_MathVec_Prefer_No_AVX512 preferred
|
|
|
e354a5 |
+#define feature_Prefer_FSRM preferred
|
|
|
e354a5 |
|
|
|
e354a5 |
/* XCR0 Feature flags. */
|
|
|
e354a5 |
#define bit_XMM_state (1u << 1)
|
|
|
e354a5 |
diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
|
|
|
e354a5 |
index 2e5d37753713e975..012ae48933055eaa 100644
|
|
|
e354a5 |
--- a/sysdeps/x86/cpu-tunables.c
|
|
|
e354a5 |
+++ b/sysdeps/x86/cpu-tunables.c
|
|
|
e354a5 |
@@ -54,7 +54,7 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
|
|
|
e354a5 |
_Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
|
|
|
e354a5 |
if (!DEFAULT_MEMCMP (f, #name, len)) \
|
|
|
e354a5 |
{ \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
&= ~bit_arch_##name; \
|
|
|
e354a5 |
break; \
|
|
|
e354a5 |
}
|
|
|
e354a5 |
@@ -66,10 +66,10 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
|
|
|
e354a5 |
if (!DEFAULT_MEMCMP (f, #name, len)) \
|
|
|
e354a5 |
{ \
|
|
|
e354a5 |
if (disable) \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
&= ~bit_arch_##name; \
|
|
|
e354a5 |
else \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
|= bit_arch_##name; \
|
|
|
e354a5 |
break; \
|
|
|
e354a5 |
}
|
|
|
e354a5 |
@@ -82,10 +82,10 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
|
|
|
e354a5 |
if (!DEFAULT_MEMCMP (f, #name, len)) \
|
|
|
e354a5 |
{ \
|
|
|
e354a5 |
if (disable) \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
&= ~bit_arch_##name; \
|
|
|
e354a5 |
else if (CPU_FEATURES_ARCH_P (cpu_features, need)) \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
|= bit_arch_##name; \
|
|
|
e354a5 |
break; \
|
|
|
e354a5 |
}
|
|
|
e354a5 |
@@ -98,10 +98,10 @@ extern __typeof (memcmp) DEFAULT_MEMCMP;
|
|
|
e354a5 |
if (!DEFAULT_MEMCMP (f, #name, len)) \
|
|
|
e354a5 |
{ \
|
|
|
e354a5 |
if (disable) \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
&= ~bit_arch_##name; \
|
|
|
e354a5 |
else if (CPU_FEATURES_CPU_P (cpu_features, need)) \
|
|
|
e354a5 |
- cpu_features->feature[index_arch_##name] \
|
|
|
e354a5 |
+ cpu_features->feature_##name[index_arch_##name] \
|
|
|
e354a5 |
|= bit_arch_##name; \
|
|
|
e354a5 |
break; \
|
|
|
e354a5 |
}
|
|
|
e354a5 |
diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
|
|
|
e354a5 |
index 64a7fd6157242bdd..08688ace2a0ae35e 100644
|
|
|
e354a5 |
--- a/sysdeps/x86/tst-get-cpu-features.c
|
|
|
e354a5 |
+++ b/sysdeps/x86/tst-get-cpu-features.c
|
|
|
e354a5 |
@@ -172,15 +172,24 @@ do_test (void)
|
|
|
e354a5 |
CHECK_CPU_FEATURE (CLDEMOTE);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (MOVDIRI);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (MOVDIR64B);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (ENQCMD);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (SGX_LC);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (PKS);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (AVX512_4VNNIW);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (AVX512_4FMAPS);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (FSRM);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (AVX512_VP2INTERSECT);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (MD_CLEAR);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (SERIALIZE);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (HYBRID);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (TSXLDTRK);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (PCONFIG);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (IBT);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (IBRS_IBPB);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (STIBP);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE (CAPABILITIES);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (L1D_FLUSH);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (ARCH_CAPABILITIES);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (CORE_CAPABILITIES);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (SSBD);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (LAHF64_SAHF64);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (SVM);
|
|
|
e354a5 |
@@ -202,84 +211,36 @@ do_test (void)
|
|
|
e354a5 |
CHECK_CPU_FEATURE (XSAVES);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (INVARIANT_TSC);
|
|
|
e354a5 |
CHECK_CPU_FEATURE (WBNOINVD);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE (AVX512_BF16);
|
|
|
e354a5 |
|
|
|
e354a5 |
printf ("Usable CPU features:\n");
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE3);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (PCLMULQDQ);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSSE3);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (FMA);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CMPXCHG16B);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE4_1);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE4_2);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (MOVBE);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (POPCNT);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (AES);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (XSAVE);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (OSXSAVE);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (F16C);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (RDRAND);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (FPU);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (TSC);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (MSR);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CX8);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SEP);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CMOV);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CLFSH);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (MMX);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (FXSR);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE2);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (FSGSBASE);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (BMI1);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (HLE);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX2);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (BMI2);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (ERMS);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512F);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512DQ);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (RDSEED);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (ADX);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_IFMA);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CLFLUSHOPT);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CLWB);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512PF);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512ER);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512CD);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SHA);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512BW);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512VL);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (PREFETCHWT1);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_VBMI);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE_USABLE (PKU);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_VBMI2);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (GFNI);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (VAES);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (VPCLMULQDQ);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_VNNI);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_BITALG);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_VPOPCNTDQ);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (RDPID);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (CLDEMOTE);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (MOVDIRI);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (MOVDIR64B);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_4VNNIW);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (AVX512_4FMAPS);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (FSRM);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (LAHF64_SAHF64);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (LZCNT);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SSE4A);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (PREFETCHW);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE_USABLE (AVX512_VP2INTERSECT);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (XOP);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (FMA4);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (TBM);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (SYSCALL_SYSRET);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (RDTSCP);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (XSAVEOPT);
|
|
|
e354a5 |
CHECK_CPU_FEATURE_USABLE (XSAVEC);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (XGETBV_ECX_1);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (XSAVES);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (INVARIANT_TSC);
|
|
|
e354a5 |
- CHECK_CPU_FEATURE_USABLE (WBNOINVD);
|
|
|
e354a5 |
+ CHECK_CPU_FEATURE_USABLE (AVX512_BF16);
|
|
|
e354a5 |
|
|
|
e354a5 |
return 0;
|
|
|
e354a5 |
}
|