diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2023-07-26 08:20:16 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2023-07-27 08:42:32 -0700 |
commit | 1547d6a64f4b981a06fd46ee446425a32558f2d0 (patch) | |
tree | 04c1d9b268be4d36880792b115c88ebe135dd6d9 /sysdeps | |
parent | c8c8dbbf279b0ebaed3e871f626ba7dde876d247 (diff) | |
download | glibc-1547d6a64f4b981a06fd46ee446425a32558f2d0.zip glibc-1547d6a64f4b981a06fd46ee446425a32558f2d0.tar.gz glibc-1547d6a64f4b981a06fd46ee446425a32558f2d0.tar.bz2 |
<sys/platform/x86.h>: Add APX support
Add support for Intel Advanced Performance Extensions:
https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-performance-extensions-apx.html
to <sys/platform/x86.h>.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/x86/bits/platform/x86.h | 1 | ||||
-rw-r--r-- | sysdeps/x86/cpu-features.c | 4 | ||||
-rw-r--r-- | sysdeps/x86/include/cpu-features.h | 4 | ||||
-rw-r--r-- | sysdeps/x86/tst-get-cpu-features.c | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h index 6555f9b..88ca071 100644 --- a/sysdeps/x86/bits/platform/x86.h +++ b/sysdeps/x86/bits/platform/x86.h @@ -312,6 +312,7 @@ enum x86_cpu_AVX_NE_CONVERT = x86_cpu_index_7_ecx_1_edx + 5, x86_cpu_AMX_COMPLEX = x86_cpu_index_7_ecx_1_edx + 8, x86_cpu_PREFETCHI = x86_cpu_index_7_ecx_1_edx + 14, + x86_cpu_APX_F = x86_cpu_index_7_ecx_1_edx + 21, x86_cpu_index_19_ebx = (CPUID_INDEX_19 * 8 * 4 * sizeof (unsigned int) diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 9ac1958..badf088 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -226,6 +226,10 @@ update_active (struct cpu_features *cpu_features) CPU_FEATURE_SET_ACTIVE (cpu_features, AMX_COMPLEX); } + /* APX is usable only if the APX state is supported by kernel. */ + if ((xcrlow & bit_APX_state) != 0) + CPU_FEATURE_SET_ACTIVE (cpu_features, APX_F); + /* These features are usable only when OSXSAVE is enabled. */ CPU_FEATURE_SET (cpu_features, XSAVE); CPU_FEATURE_SET_ACTIVE (cpu_features, XSAVEOPT); diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h index c740e1a..eb30d34 100644 --- a/sysdeps/x86/include/cpu-features.h +++ b/sysdeps/x86/include/cpu-features.h @@ -319,6 +319,7 @@ enum #define bit_cpu_AVX_NE_CONVERT (1u << 5) #define bit_cpu_AMX_COMPLEX (1u << 8) #define bit_cpu_PREFETCHI (1u << 14) +#define bit_cpu_APX_F (1u << 21) /* CPUID_INDEX_19. */ @@ -562,6 +563,7 @@ enum #define index_cpu_AVX_NE_CONVERT CPUID_INDEX_7_ECX_1 #define index_cpu_AMX_COMPLEX CPUID_INDEX_7_ECX_1 #define index_cpu_PREFETCHI CPUID_INDEX_7_ECX_1 +#define index_cpu_APX_F CPUID_INDEX_7_ECX_1 /* CPUID_INDEX_19. */ @@ -807,6 +809,7 @@ enum #define reg_AVX_NE_CONVERT edx #define reg_AMX_COMPLEX edx #define reg_PREFETCHI edx +#define reg_APX_F edx /* CPUID_INDEX_19. */ @@ -845,6 +848,7 @@ enum #define bit_ZMM16_31_state (1u << 7) #define bit_XTILECFG_state (1u << 17) #define bit_XTILEDATA_state (1u << 18) +#define bit_APX_state (1u << 19) enum cpu_features_kind { diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c index 1bd7e0b..b27fa73 100644 --- a/sysdeps/x86/tst-get-cpu-features.c +++ b/sysdeps/x86/tst-get-cpu-features.c @@ -219,6 +219,7 @@ do_test (void) CHECK_CPU_FEATURE_PRESENT (AVX_NE_CONVERT); CHECK_CPU_FEATURE_PRESENT (AMX_COMPLEX); CHECK_CPU_FEATURE_PRESENT (PREFETCHI); + CHECK_CPU_FEATURE_PRESENT (APX_F); CHECK_CPU_FEATURE_PRESENT (AESKLE); CHECK_CPU_FEATURE_PRESENT (WIDE_KL); CHECK_CPU_FEATURE_PRESENT (PTWRITE); @@ -390,6 +391,7 @@ do_test (void) CHECK_CPU_FEATURE_ACTIVE (AVX_NE_CONVERT); CHECK_CPU_FEATURE_ACTIVE (AMX_COMPLEX); CHECK_CPU_FEATURE_ACTIVE (PREFETCHI); + CHECK_CPU_FEATURE_ACTIVE (APX_F); CHECK_CPU_FEATURE_ACTIVE (AESKLE); CHECK_CPU_FEATURE_ACTIVE (WIDE_KL); CHECK_CPU_FEATURE_ACTIVE (PTWRITE); |