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