x86: Install <sys/platform/x86.h> [BZ #26124]
Install <sys/platform/x86.h> so that programmers can do
#if __has_include(<sys/platform/x86.h>)
#include <sys/platform/x86.h>
#endif
...
if (CPU_FEATURE_USABLE (SSE2))
...
if (CPU_FEATURE_USABLE (AVX2))
...
<sys/platform/x86.h> exports only:
enum
{
COMMON_CPUID_INDEX_1 = 0,
COMMON_CPUID_INDEX_7,
COMMON_CPUID_INDEX_80000001,
COMMON_CPUID_INDEX_D_ECX_1,
COMMON_CPUID_INDEX_80000007,
COMMON_CPUID_INDEX_80000008,
COMMON_CPUID_INDEX_7_ECX_1,
/* Keep the following line at the end. */
COMMON_CPUID_INDEX_MAX
};
struct cpuid_features
{
struct cpuid_registers cpuid;
struct cpuid_registers usable;
};
struct cpu_features
{
struct cpu_features_basic basic;
struct cpuid_features features[COMMON_CPUID_INDEX_MAX];
};
/* Get a pointer to the CPU features structure. */
extern const struct cpu_features *__x86_get_cpu_features
(unsigned int max) __attribute__ ((const));
Since all feature checks are done through macros, programs compiled with
a newer <sys/platform/x86.h> are compatible with the older glibc binaries
as long as the layout of struct cpu_features is identical. The features
array can be expanded with backward binary compatibility for both .o and
.so files. When COMMON_CPUID_INDEX_MAX is increased to support new
processor features, __x86_get_cpu_features in the older glibc binaries
returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return false on the
new processor feature. No new symbol version is neeeded.
Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided. HAS_CPU_FEATURE
can be used to identify processor features.
Note: Although GCC has __builtin_cpu_supports, it only supports a subset
of <sys/platform/x86.h> and it is equivalent to CPU_FEATURE_USABLE. It
doesn't support HAS_CPU_FEATURE.
2020-06-30 01:30:54 +00:00
|
|
|
/* Test case for __x86_get_cpu_features interface
|
2020-01-01 00:14:33 +00:00
|
|
|
Copyright (C) 2015-2020 Free Software Foundation, Inc.
|
2015-08-13 10:37:47 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2015-08-13 10:37:47 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2018-12-03 13:54:43 +00:00
|
|
|
#include <stdio.h>
|
x86: Install <sys/platform/x86.h> [BZ #26124]
Install <sys/platform/x86.h> so that programmers can do
#if __has_include(<sys/platform/x86.h>)
#include <sys/platform/x86.h>
#endif
...
if (CPU_FEATURE_USABLE (SSE2))
...
if (CPU_FEATURE_USABLE (AVX2))
...
<sys/platform/x86.h> exports only:
enum
{
COMMON_CPUID_INDEX_1 = 0,
COMMON_CPUID_INDEX_7,
COMMON_CPUID_INDEX_80000001,
COMMON_CPUID_INDEX_D_ECX_1,
COMMON_CPUID_INDEX_80000007,
COMMON_CPUID_INDEX_80000008,
COMMON_CPUID_INDEX_7_ECX_1,
/* Keep the following line at the end. */
COMMON_CPUID_INDEX_MAX
};
struct cpuid_features
{
struct cpuid_registers cpuid;
struct cpuid_registers usable;
};
struct cpu_features
{
struct cpu_features_basic basic;
struct cpuid_features features[COMMON_CPUID_INDEX_MAX];
};
/* Get a pointer to the CPU features structure. */
extern const struct cpu_features *__x86_get_cpu_features
(unsigned int max) __attribute__ ((const));
Since all feature checks are done through macros, programs compiled with
a newer <sys/platform/x86.h> are compatible with the older glibc binaries
as long as the layout of struct cpu_features is identical. The features
array can be expanded with backward binary compatibility for both .o and
.so files. When COMMON_CPUID_INDEX_MAX is increased to support new
processor features, __x86_get_cpu_features in the older glibc binaries
returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return false on the
new processor feature. No new symbol version is neeeded.
Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided. HAS_CPU_FEATURE
can be used to identify processor features.
Note: Although GCC has __builtin_cpu_supports, it only supports a subset
of <sys/platform/x86.h> and it is equivalent to CPU_FEATURE_USABLE. It
doesn't support HAS_CPU_FEATURE.
2020-06-30 01:30:54 +00:00
|
|
|
#include <sys/platform/x86.h>
|
2018-12-03 13:54:43 +00:00
|
|
|
#include <support/check.h>
|
|
|
|
|
|
|
|
#define CHECK_CPU_FEATURE(name) \
|
|
|
|
{ \
|
|
|
|
if (HAS_CPU_FEATURE (name)) \
|
|
|
|
printf (" " #name "\n"); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CHECK_CPU_FEATURE_USABLE(name) \
|
|
|
|
{ \
|
|
|
|
if (CPU_FEATURE_USABLE(name)) \
|
|
|
|
printf (" " #name "\n"); \
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * const cpu_kinds[] =
|
|
|
|
{
|
|
|
|
"Unknown",
|
|
|
|
"Intel",
|
|
|
|
"AMD",
|
2020-04-26 05:49:44 +00:00
|
|
|
"ZHAOXIN",
|
2018-12-03 13:54:43 +00:00
|
|
|
"Other",
|
|
|
|
};
|
2015-08-13 10:37:47 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
do_test (void)
|
|
|
|
{
|
x86: Install <sys/platform/x86.h> [BZ #26124]
Install <sys/platform/x86.h> so that programmers can do
#if __has_include(<sys/platform/x86.h>)
#include <sys/platform/x86.h>
#endif
...
if (CPU_FEATURE_USABLE (SSE2))
...
if (CPU_FEATURE_USABLE (AVX2))
...
<sys/platform/x86.h> exports only:
enum
{
COMMON_CPUID_INDEX_1 = 0,
COMMON_CPUID_INDEX_7,
COMMON_CPUID_INDEX_80000001,
COMMON_CPUID_INDEX_D_ECX_1,
COMMON_CPUID_INDEX_80000007,
COMMON_CPUID_INDEX_80000008,
COMMON_CPUID_INDEX_7_ECX_1,
/* Keep the following line at the end. */
COMMON_CPUID_INDEX_MAX
};
struct cpuid_features
{
struct cpuid_registers cpuid;
struct cpuid_registers usable;
};
struct cpu_features
{
struct cpu_features_basic basic;
struct cpuid_features features[COMMON_CPUID_INDEX_MAX];
};
/* Get a pointer to the CPU features structure. */
extern const struct cpu_features *__x86_get_cpu_features
(unsigned int max) __attribute__ ((const));
Since all feature checks are done through macros, programs compiled with
a newer <sys/platform/x86.h> are compatible with the older glibc binaries
as long as the layout of struct cpu_features is identical. The features
array can be expanded with backward binary compatibility for both .o and
.so files. When COMMON_CPUID_INDEX_MAX is increased to support new
processor features, __x86_get_cpu_features in the older glibc binaries
returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return false on the
new processor feature. No new symbol version is neeeded.
Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided. HAS_CPU_FEATURE
can be used to identify processor features.
Note: Although GCC has __builtin_cpu_supports, it only supports a subset
of <sys/platform/x86.h> and it is equivalent to CPU_FEATURE_USABLE. It
doesn't support HAS_CPU_FEATURE.
2020-06-30 01:30:54 +00:00
|
|
|
const struct cpu_features *cpu_features = __x86_get_cpu_features (0);
|
2018-12-03 13:54:43 +00:00
|
|
|
|
|
|
|
switch (cpu_features->basic.kind)
|
|
|
|
{
|
|
|
|
case arch_kind_intel:
|
|
|
|
case arch_kind_amd:
|
2020-04-26 05:49:44 +00:00
|
|
|
case arch_kind_zhaoxin:
|
2018-12-03 13:54:43 +00:00
|
|
|
case arch_kind_other:
|
|
|
|
printf ("Vendor: %s\n", cpu_kinds[cpu_features->basic.kind]);
|
|
|
|
printf ("Family: 0x%x\n", cpu_features->basic.family);
|
|
|
|
printf ("Model: 0x%x\n", cpu_features->basic.model);
|
|
|
|
printf ("Stepping: 0x%x\n", cpu_features->basic.stepping);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __SSE2__
|
|
|
|
TEST_VERIFY_EXIT (HAS_CPU_FEATURE (SSE2));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
printf ("CPU features:\n");
|
|
|
|
CHECK_CPU_FEATURE (SSE3);
|
|
|
|
CHECK_CPU_FEATURE (PCLMULQDQ);
|
|
|
|
CHECK_CPU_FEATURE (DTES64);
|
|
|
|
CHECK_CPU_FEATURE (MONITOR);
|
|
|
|
CHECK_CPU_FEATURE (DS_CPL);
|
|
|
|
CHECK_CPU_FEATURE (VMX);
|
|
|
|
CHECK_CPU_FEATURE (SMX);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE (EIST);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (TM2);
|
|
|
|
CHECK_CPU_FEATURE (SSSE3);
|
|
|
|
CHECK_CPU_FEATURE (CNXT_ID);
|
|
|
|
CHECK_CPU_FEATURE (SDBG);
|
|
|
|
CHECK_CPU_FEATURE (FMA);
|
|
|
|
CHECK_CPU_FEATURE (CMPXCHG16B);
|
|
|
|
CHECK_CPU_FEATURE (XTPRUPDCTRL);
|
|
|
|
CHECK_CPU_FEATURE (PDCM);
|
|
|
|
CHECK_CPU_FEATURE (PCID);
|
|
|
|
CHECK_CPU_FEATURE (DCA);
|
|
|
|
CHECK_CPU_FEATURE (SSE4_1);
|
|
|
|
CHECK_CPU_FEATURE (SSE4_2);
|
|
|
|
CHECK_CPU_FEATURE (X2APIC);
|
|
|
|
CHECK_CPU_FEATURE (MOVBE);
|
|
|
|
CHECK_CPU_FEATURE (POPCNT);
|
|
|
|
CHECK_CPU_FEATURE (TSC_DEADLINE);
|
|
|
|
CHECK_CPU_FEATURE (AES);
|
|
|
|
CHECK_CPU_FEATURE (XSAVE);
|
|
|
|
CHECK_CPU_FEATURE (OSXSAVE);
|
|
|
|
CHECK_CPU_FEATURE (AVX);
|
|
|
|
CHECK_CPU_FEATURE (F16C);
|
|
|
|
CHECK_CPU_FEATURE (RDRAND);
|
|
|
|
CHECK_CPU_FEATURE (FPU);
|
|
|
|
CHECK_CPU_FEATURE (VME);
|
|
|
|
CHECK_CPU_FEATURE (DE);
|
|
|
|
CHECK_CPU_FEATURE (PSE);
|
|
|
|
CHECK_CPU_FEATURE (TSC);
|
|
|
|
CHECK_CPU_FEATURE (MSR);
|
|
|
|
CHECK_CPU_FEATURE (PAE);
|
|
|
|
CHECK_CPU_FEATURE (MCE);
|
|
|
|
CHECK_CPU_FEATURE (CX8);
|
|
|
|
CHECK_CPU_FEATURE (APIC);
|
|
|
|
CHECK_CPU_FEATURE (SEP);
|
|
|
|
CHECK_CPU_FEATURE (MTRR);
|
|
|
|
CHECK_CPU_FEATURE (PGE);
|
|
|
|
CHECK_CPU_FEATURE (MCA);
|
|
|
|
CHECK_CPU_FEATURE (CMOV);
|
|
|
|
CHECK_CPU_FEATURE (PAT);
|
|
|
|
CHECK_CPU_FEATURE (PSE_36);
|
|
|
|
CHECK_CPU_FEATURE (PSN);
|
|
|
|
CHECK_CPU_FEATURE (CLFSH);
|
|
|
|
CHECK_CPU_FEATURE (DS);
|
|
|
|
CHECK_CPU_FEATURE (ACPI);
|
|
|
|
CHECK_CPU_FEATURE (MMX);
|
|
|
|
CHECK_CPU_FEATURE (FXSR);
|
|
|
|
CHECK_CPU_FEATURE (SSE);
|
|
|
|
CHECK_CPU_FEATURE (SSE2);
|
|
|
|
CHECK_CPU_FEATURE (SS);
|
|
|
|
CHECK_CPU_FEATURE (HTT);
|
|
|
|
CHECK_CPU_FEATURE (TM);
|
|
|
|
CHECK_CPU_FEATURE (PBE);
|
|
|
|
CHECK_CPU_FEATURE (FSGSBASE);
|
|
|
|
CHECK_CPU_FEATURE (TSC_ADJUST);
|
|
|
|
CHECK_CPU_FEATURE (SGX);
|
|
|
|
CHECK_CPU_FEATURE (BMI1);
|
|
|
|
CHECK_CPU_FEATURE (HLE);
|
|
|
|
CHECK_CPU_FEATURE (AVX2);
|
|
|
|
CHECK_CPU_FEATURE (SMEP);
|
|
|
|
CHECK_CPU_FEATURE (BMI2);
|
|
|
|
CHECK_CPU_FEATURE (ERMS);
|
|
|
|
CHECK_CPU_FEATURE (INVPCID);
|
|
|
|
CHECK_CPU_FEATURE (RTM);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE (RDT_M);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE (DEPR_FPU_CS_DS);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (MPX);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE (RDT_A);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX512F);
|
|
|
|
CHECK_CPU_FEATURE (AVX512DQ);
|
|
|
|
CHECK_CPU_FEATURE (RDSEED);
|
|
|
|
CHECK_CPU_FEATURE (ADX);
|
|
|
|
CHECK_CPU_FEATURE (SMAP);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_IFMA);
|
|
|
|
CHECK_CPU_FEATURE (CLFLUSHOPT);
|
|
|
|
CHECK_CPU_FEATURE (CLWB);
|
|
|
|
CHECK_CPU_FEATURE (TRACE);
|
|
|
|
CHECK_CPU_FEATURE (AVX512PF);
|
|
|
|
CHECK_CPU_FEATURE (AVX512ER);
|
|
|
|
CHECK_CPU_FEATURE (AVX512CD);
|
|
|
|
CHECK_CPU_FEATURE (SHA);
|
|
|
|
CHECK_CPU_FEATURE (AVX512BW);
|
|
|
|
CHECK_CPU_FEATURE (AVX512VL);
|
|
|
|
CHECK_CPU_FEATURE (PREFETCHWT1);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_VBMI);
|
|
|
|
CHECK_CPU_FEATURE (UMIP);
|
|
|
|
CHECK_CPU_FEATURE (PKU);
|
|
|
|
CHECK_CPU_FEATURE (OSPKE);
|
|
|
|
CHECK_CPU_FEATURE (WAITPKG);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_VBMI2);
|
|
|
|
CHECK_CPU_FEATURE (SHSTK);
|
|
|
|
CHECK_CPU_FEATURE (GFNI);
|
|
|
|
CHECK_CPU_FEATURE (VAES);
|
|
|
|
CHECK_CPU_FEATURE (VPCLMULQDQ);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_VNNI);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_BITALG);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_VPOPCNTDQ);
|
|
|
|
CHECK_CPU_FEATURE (RDPID);
|
2020-09-15 12:49:27 +00:00
|
|
|
CHECK_CPU_FEATURE (KL);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (CLDEMOTE);
|
|
|
|
CHECK_CPU_FEATURE (MOVDIRI);
|
|
|
|
CHECK_CPU_FEATURE (MOVDIR64B);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE (ENQCMD);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (SGX_LC);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE (PKS);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX512_4VNNIW);
|
|
|
|
CHECK_CPU_FEATURE (AVX512_4FMAPS);
|
|
|
|
CHECK_CPU_FEATURE (FSRM);
|
2020-10-08 15:19:15 +00:00
|
|
|
CHECK_CPU_FEATURE (UINTR);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX512_VP2INTERSECT);
|
|
|
|
CHECK_CPU_FEATURE (MD_CLEAR);
|
|
|
|
CHECK_CPU_FEATURE (SERIALIZE);
|
|
|
|
CHECK_CPU_FEATURE (HYBRID);
|
|
|
|
CHECK_CPU_FEATURE (TSXLDTRK);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (PCONFIG);
|
|
|
|
CHECK_CPU_FEATURE (IBT);
|
2020-06-25 22:12:57 +00:00
|
|
|
CHECK_CPU_FEATURE (AMX_BF16);
|
2020-10-08 15:24:47 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX512_FP16);
|
2020-06-25 22:12:57 +00:00
|
|
|
CHECK_CPU_FEATURE (AMX_TILE);
|
|
|
|
CHECK_CPU_FEATURE (AMX_INT8);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (IBRS_IBPB);
|
|
|
|
CHECK_CPU_FEATURE (STIBP);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE (L1D_FLUSH);
|
|
|
|
CHECK_CPU_FEATURE (ARCH_CAPABILITIES);
|
|
|
|
CHECK_CPU_FEATURE (CORE_CAPABILITIES);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (SSBD);
|
|
|
|
CHECK_CPU_FEATURE (LAHF64_SAHF64);
|
|
|
|
CHECK_CPU_FEATURE (SVM);
|
|
|
|
CHECK_CPU_FEATURE (LZCNT);
|
|
|
|
CHECK_CPU_FEATURE (SSE4A);
|
|
|
|
CHECK_CPU_FEATURE (PREFETCHW);
|
|
|
|
CHECK_CPU_FEATURE (XOP);
|
|
|
|
CHECK_CPU_FEATURE (LWP);
|
|
|
|
CHECK_CPU_FEATURE (FMA4);
|
|
|
|
CHECK_CPU_FEATURE (TBM);
|
|
|
|
CHECK_CPU_FEATURE (SYSCALL_SYSRET);
|
|
|
|
CHECK_CPU_FEATURE (NX);
|
|
|
|
CHECK_CPU_FEATURE (PAGE1GB);
|
|
|
|
CHECK_CPU_FEATURE (RDTSCP);
|
|
|
|
CHECK_CPU_FEATURE (LM);
|
|
|
|
CHECK_CPU_FEATURE (XSAVEOPT);
|
|
|
|
CHECK_CPU_FEATURE (XSAVEC);
|
|
|
|
CHECK_CPU_FEATURE (XGETBV_ECX_1);
|
|
|
|
CHECK_CPU_FEATURE (XSAVES);
|
2020-07-06 13:57:08 +00:00
|
|
|
CHECK_CPU_FEATURE (XFD);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE (INVARIANT_TSC);
|
|
|
|
CHECK_CPU_FEATURE (WBNOINVD);
|
2020-10-08 15:33:45 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX_VNNI);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE (AVX512_BF16);
|
2020-10-08 15:50:44 +00:00
|
|
|
CHECK_CPU_FEATURE (FZLRM);
|
|
|
|
CHECK_CPU_FEATURE (FSRS);
|
|
|
|
CHECK_CPU_FEATURE (FSRCS);
|
2020-10-08 15:38:03 +00:00
|
|
|
CHECK_CPU_FEATURE (HRESET);
|
2020-09-15 12:49:27 +00:00
|
|
|
CHECK_CPU_FEATURE (AESKLE);
|
|
|
|
CHECK_CPU_FEATURE (WIDE_KL);
|
2018-12-03 13:54:43 +00:00
|
|
|
|
|
|
|
printf ("Usable CPU features:\n");
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE3);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PCLMULQDQ);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (DTES64);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MONITOR);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (DS_CPL);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (VMX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SMX);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (EIST);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (TM2);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSSE3);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CNXT_ID);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SDBG);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (FMA);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (CMPXCHG16B);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (XTPRUPDCTRL);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PDCM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PCID);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (DCA);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE4_1);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE4_2);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (X2APIC);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MOVBE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (POPCNT);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TSC_DEADLINE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AES);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (XSAVE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (OSXSAVE);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (F16C);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (RDRAND);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (FPU);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (VME);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (DE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PSE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TSC);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MSR);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PAE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MCE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CX8);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (APIC);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SEP);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MTRR);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PGE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MCA);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CMOV);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PAT);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PSE_36);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PSN);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CLFSH);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (DS);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (ACPI);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MMX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (FXSR);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE2);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SS);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (HTT);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PBE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (FSGSBASE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TSC_ADJUST);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SGX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (BMI1);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (HLE);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX2);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (SMEP);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (BMI2);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (ERMS);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (INVPCID);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (RTM);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (RDT_M);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (DEPR_FPU_CS_DS);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MPX);
|
2020-08-05 15:20:52 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (RDT_A);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512F);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512DQ);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (RDSEED);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (ADX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SMAP);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_IFMA);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (CLFLUSHOPT);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CLWB);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TRACE);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512PF);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512ER);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512CD);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (SHA);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512BW);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512VL);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (PREFETCHWT1);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_VBMI);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (UMIP);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (PKU);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (OSPKE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (WAITPKG);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_VBMI2);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (GFNI);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (VAES);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (VPCLMULQDQ);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_VNNI);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_BITALG);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_VPOPCNTDQ);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (RDPID);
|
2020-09-15 12:49:27 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (KL);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (CLDEMOTE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MOVDIRI);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (MOVDIR64B);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (ENQCMD);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SGX_LC);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PKS);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_4VNNIW);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_4FMAPS);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (FSRM);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_VP2INTERSECT);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (MD_CLEAR);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SERIALIZE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (HYBRID);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (TSXLDTRK);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PCONFIG);
|
2020-06-25 22:12:57 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AMX_BF16);
|
2020-10-08 15:24:47 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_FP16);
|
2020-06-25 22:12:57 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AMX_TILE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (AMX_INT8);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (IBRS_IBPB);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (STIBP);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (L1D_FLUSH);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (ARCH_CAPABILITIES);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (CORE_CAPABILITIES);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSBD);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (LAHF64_SAHF64);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SVM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (LZCNT);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SSE4A);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PREFETCHW);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (XOP);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (LWP);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (FMA4);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (TBM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (SYSCALL_SYSRET);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (NX);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (PAGE1GB);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (RDTSCP);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (LM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (XSAVEOPT);
|
2018-12-03 13:54:43 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (XSAVEC);
|
2020-06-29 23:36:08 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (XGETBV_ECX_1);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (XSAVES);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (XFD);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (INVARIANT_TSC);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (WBNOINVD);
|
2020-10-08 15:33:45 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX_VNNI);
|
2020-06-17 13:34:46 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AVX512_BF16);
|
2020-10-08 15:50:44 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (FZLRM);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (FSRS);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (FSRCS);
|
2020-09-15 12:49:27 +00:00
|
|
|
CHECK_CPU_FEATURE_USABLE (AESKLE);
|
|
|
|
CHECK_CPU_FEATURE_USABLE (WIDE_KL);
|
2018-12-03 13:54:43 +00:00
|
|
|
|
2015-08-13 10:37:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-12-03 13:54:43 +00:00
|
|
|
#include <support/test-driver.c>
|