|
|
b1dca6 |
commit 27f8864bd41f0f1b61e8e947d9a030b1a0d23df9
|
|
|
b1dca6 |
Author: H.J. Lu <hjl.tools@gmail.com>
|
|
|
b1dca6 |
Date: Thu Jun 18 05:34:15 2020 -0700
|
|
|
b1dca6 |
|
|
|
b1dca6 |
x86: Update F16C detection [BZ #26133]
|
|
|
b1dca6 |
|
|
|
b1dca6 |
Since F16C requires AVX, set F16C usable only when AVX is usable.
|
|
|
b1dca6 |
|
|
|
b1dca6 |
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
|
|
b1dca6 |
index 2a801e1856cfe1b3..37619c93f8dbcc5d 100644
|
|
|
b1dca6 |
--- a/sysdeps/x86/cpu-features.c
|
|
|
b1dca6 |
+++ b/sysdeps/x86/cpu-features.c
|
|
|
b1dca6 |
@@ -146,6 +146,10 @@ get_common_indices (struct cpu_features *cpu_features,
|
|
|
b1dca6 |
if (CPU_FEATURES_CPU_P (cpu_features, XOP))
|
|
|
b1dca6 |
cpu_features->feature[index_arch_XOP_Usable]
|
|
|
b1dca6 |
|= bit_arch_XOP_Usable;
|
|
|
b1dca6 |
+ /* Determine if F16C is usable. */
|
|
|
b1dca6 |
+ if (CPU_FEATURES_CPU_P (cpu_features, F16C))
|
|
|
b1dca6 |
+ cpu_features->feature[index_arch_F16C_Usable]
|
|
|
b1dca6 |
+ |= bit_arch_F16C_Usable;
|
|
|
b1dca6 |
}
|
|
|
b1dca6 |
|
|
|
b1dca6 |
/* Check if OPMASK state, upper 256-bit of ZMM0-ZMM15 and
|
|
|
b1dca6 |
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
|
|
|
b1dca6 |
index 7abfa046c4b8f6ac..f18f7520fcb7714a 100644
|
|
|
b1dca6 |
--- a/sysdeps/x86/cpu-features.h
|
|
|
b1dca6 |
+++ b/sysdeps/x86/cpu-features.h
|
|
|
b1dca6 |
@@ -142,6 +142,7 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
b1dca6 |
#define bit_arch_VPCLMULQDQ_Usable (1u << 20)
|
|
|
b1dca6 |
#define bit_arch_XOP_Usable (1u << 21)
|
|
|
b1dca6 |
#define bit_arch_XSAVEC_Usable (1u << 22)
|
|
|
b1dca6 |
+#define bit_arch_F16C_Usable (1u << 23)
|
|
|
b1dca6 |
|
|
|
b1dca6 |
#define index_arch_AVX_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_AVX2_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
@@ -166,6 +167,7 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
b1dca6 |
#define index_arch_VPCLMULQDQ_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_XOP_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_XSAVEC_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
+#define index_arch_F16C_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
|
|
|
b1dca6 |
/* Unused. Compiler will optimize them out. */
|
|
|
b1dca6 |
#define bit_arch_SSE3_Usable (1u << 0)
|
|
|
b1dca6 |
@@ -179,7 +181,6 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
b1dca6 |
#define bit_arch_AES_Usable (1u << 0)
|
|
|
b1dca6 |
#define bit_arch_XSAVE_Usable (1u << 0)
|
|
|
b1dca6 |
#define bit_arch_OSXSAVE_Usable (1u << 0)
|
|
|
b1dca6 |
-#define bit_arch_F16C_Usable (1u << 0)
|
|
|
b1dca6 |
#define bit_arch_RDRAND_Usable (1u << 0)
|
|
|
b1dca6 |
#define bit_arch_FPU_Usable (1u << 0)
|
|
|
b1dca6 |
#define bit_arch_TSC_Usable (1u << 0)
|
|
|
b1dca6 |
@@ -236,7 +237,6 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
b1dca6 |
#define index_arch_AES_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_XSAVE_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_OSXSAVE_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
-#define index_arch_F16C_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_RDRAND_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_FPU_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
#define index_arch_TSC_Usable FEATURE_INDEX_1
|
|
|
b1dca6 |
@@ -296,7 +296,7 @@ extern const struct cpu_features *__get_cpu_features (void)
|
|
|
b1dca6 |
#define need_arch_feature_XSAVE 0
|
|
|
b1dca6 |
#define need_arch_feature_OSXSAVE 0
|
|
|
b1dca6 |
#define need_arch_feature_AVX 1
|
|
|
b1dca6 |
-#define need_arch_feature_F16C 0
|
|
|
b1dca6 |
+#define need_arch_feature_F16C 1
|
|
|
b1dca6 |
#define need_arch_feature_RDRAND 0
|
|
|
b1dca6 |
|
|
|
b1dca6 |
/* EDX. */
|