diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-12-03 05:54:43 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-12-03 05:54:56 -0800 |
commit | c22e4c2a1431c5e77bf4288d35bf7629f2f093aa (patch) | |
tree | 666ae70088b899ad87a250a08b3be7a24bbc0157 /sysdeps/x86_64/multiarch/test-multiarch.c | |
parent | 7b36d26b22d147ffc347f427f9fd584700578a94 (diff) | |
download | glibc-c22e4c2a1431c5e77bf4288d35bf7629f2f093aa.tar.gz glibc-c22e4c2a1431c5e77bf4288d35bf7629f2f093aa.tar.xz glibc-c22e4c2a1431c5e77bf4288d35bf7629f2f093aa.zip |
x86: Extend CPUID support in struct cpu_features
Extend CPUID support for all feature bits from CPUID. Add a new macro, CPU_FEATURE_USABLE, which can be used to check if a feature is usable at run-time, instead of HAS_CPU_FEATURE and HAS_ARCH_FEATURE. Add COMMON_CPUID_INDEX_D_ECX_1, COMMON_CPUID_INDEX_80000007 and COMMON_CPUID_INDEX_80000008 to check CPU feature bits in them. Tested on i686 and x86-64 as well as using build-many-glibcs.py with x86 targets. * sysdeps/x86/cacheinfo.c (intel_check_word): Updated for cpu_features_basic. (__cache_sysconf): Likewise. (init_cacheinfo): Likewise. * sysdeps/x86/cpu-features.c (get_extended_indeces): Also populate COMMON_CPUID_INDEX_80000007 and COMMON_CPUID_INDEX_80000008. (get_common_indices): Also populate COMMON_CPUID_INDEX_D_ECX_1. Use CPU_FEATURES_CPU_P (cpu_features, XSAVEC) to check if XSAVEC is available. Set the bit_arch_XXX_Usable bits. (init_cpu_features): Use _Static_assert on index_arch_Fast_Unaligned_Load. __get_cpuid_registers and __get_arch_feature. Updated for cpu_features_basic. Set stepping in cpu_features. * sysdeps/x86/cpu-features.h: (FEATURE_INDEX_1): Changed to enum. (FEATURE_INDEX_2): New. (FEATURE_INDEX_MAX): Changed to enum. (COMMON_CPUID_INDEX_D_ECX_1): New. (COMMON_CPUID_INDEX_80000007): Likewise. (COMMON_CPUID_INDEX_80000008): Likewise. (cpuid_registers): Likewise. (cpu_features_basic): Likewise. (CPU_FEATURE_USABLE): Likewise. (bit_arch_XXX_Usable): Likewise. (cpu_features): Use cpuid_registers and cpu_features_basic. (bit_arch_XXX): Reweritten. (bit_cpu_XXX): Likewise. (index_cpu_XXX): Likewise. (reg_XXX): Likewise. * sysdeps/x86/tst-get-cpu-features.c: Include <stdio.h> and <support/check.h>. (CHECK_CPU_FEATURE): New. (CHECK_CPU_FEATURE_USABLE): Likewise. (cpu_kinds): Likewise. (do_test): Print vendor, family, model and stepping. Check HAS_CPU_FEATURE and CPU_FEATURE_USABLE. (TEST_FUNCTION): Removed. Include <support/test-driver.c> instead of "../../test-skeleton.c". * sysdeps/x86_64/multiarch/sched_cpucount.c (__sched_cpucount): Check POPCNT instead of POPCOUNT. * sysdeps/x86_64/multiarch/test-multiarch.c (do_test): Likewise.
Diffstat (limited to 'sysdeps/x86_64/multiarch/test-multiarch.c')
-rw-r--r-- | sysdeps/x86_64/multiarch/test-multiarch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/x86_64/multiarch/test-multiarch.c b/sysdeps/x86_64/multiarch/test-multiarch.c index aa872f27db..417147c3d5 100644 --- a/sysdeps/x86_64/multiarch/test-multiarch.c +++ b/sysdeps/x86_64/multiarch/test-multiarch.c @@ -85,8 +85,8 @@ do_test (int argc, char **argv) , "HAS_CPU_FEATURE (SSE4_1)"); fails += check_proc ("ssse3", HAS_CPU_FEATURE (SSSE3), "HAS_CPU_FEATURE (SSSE3)"); - fails += check_proc ("popcnt", HAS_CPU_FEATURE (POPCOUNT), - "HAS_CPU_FEATURE (POPCOUNT)"); + fails += check_proc ("popcnt", HAS_CPU_FEATURE (POPCNT), + "HAS_CPU_FEATURE (POPCNT)"); printf ("%d differences between /proc/cpuinfo and glibc code.\n", fails); |