glibc/sysdeps/x86_64/multiarch
H.J. Lu 9620398097 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-09-11 17:20:52 -07:00
..
bcopy.S
ifunc-avx2.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-impl-list.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-memcmp.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-memmove.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-memset.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-sse4_2.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-strcasecmp.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-strcpy.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
ifunc-wmemset.h x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
Makefile x86: Install <sys/platform/x86.h> [BZ #26124] 2020-09-11 17:20:52 -07:00
memchr-avx2.S
memchr-sse2.S
memchr.c
memcmp-avx2-movbe.S
memcmp-sse2.S
memcmp-sse4.S
memcmp-ssse3.S
memcmp.c
memcpy_chk-nonshared.S
memcpy_chk.c
memcpy-ssse3-back.S
memcpy-ssse3.S
memcpy.c
memmove_chk-nonshared.S
memmove_chk.c
memmove-avx512-no-vzeroupper.S
memmove-avx512-unaligned-erms.S
memmove-avx-unaligned-erms.S
memmove-sse2-unaligned-erms.S
memmove-ssse3-back.S
memmove-ssse3.S
memmove-vec-unaligned-erms.S x86: Add thresholds for "rep movsb/stosb" to tunables 2020-07-06 11:48:42 -07:00
memmove.c
mempcpy_chk-nonshared.S
mempcpy_chk.c
mempcpy.c
memrchr-avx2.S
memrchr-sse2.S
memrchr.c
memset_chk-nonshared.S
memset_chk.c
memset-avx2-unaligned-erms.S
memset-avx512-no-vzeroupper.S
memset-avx512-unaligned-erms.S
memset-sse2-unaligned-erms.S
memset-vec-unaligned-erms.S x86: Add thresholds for "rep movsb/stosb" to tunables 2020-07-06 11:48:42 -07:00
memset.c
rawmemchr-avx2.S
rawmemchr-sse2.S
rawmemchr.c
sched_cpucount.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
stpcpy-avx2.S
stpcpy-sse2-unaligned.S
stpcpy-sse2.S
stpcpy-ssse3.S
stpcpy.c
stpncpy-avx2.S
stpncpy-c.c
stpncpy-sse2-unaligned.S
stpncpy-ssse3.S
stpncpy.c
strcasecmp_l-avx.S
strcasecmp_l-sse2.S
strcasecmp_l-sse4_2.S
strcasecmp_l-ssse3.S
strcasecmp_l.c
strcasecmp.c
strcat-avx2.S
strcat-sse2-unaligned.S
strcat-sse2.S
strcat-ssse3.S
strcat.c
strchr-avx2.S
strchr-sse2-no-bsf.S
strchr-sse2.S
strchr.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
strchrnul-avx2.S
strchrnul-sse2.S
strchrnul.c
strcmp-avx2.S Fix avx2 strncmp offset compare condition check [BZ #25933] 2020-06-17 07:07:38 -07:00
strcmp-sse2-unaligned.S
strcmp-sse2.S
strcmp-sse4_2.S
strcmp-sse42.S
strcmp-ssse3.S
strcmp.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
strcpy-avx2.S
strcpy-sse2-unaligned.S
strcpy-sse2.S
strcpy-ssse3.S
strcpy.c
strcspn-c.c
strcspn-sse2.S
strcspn.c
strlen-avx2.S
strlen-sse2.S
strlen.c
strncase_l-avx.S
strncase_l-sse2.S
strncase_l-sse4_2.S
strncase_l-ssse3.S
strncase_l.c
strncase.c
strncat-avx2.S
strncat-c.c
strncat-sse2-unaligned.S
strncat-ssse3.S
strncat.c
strncmp-avx2.S
strncmp-sse2.S
strncmp-sse4_2.S
strncmp-ssse3.S
strncmp.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
strncpy-avx2.S
strncpy-c.c
strncpy-sse2-unaligned.S
strncpy-ssse3.S
strncpy.c
strnlen-avx2.S
strnlen-sse2.S
strnlen.c
strpbrk-c.c
strpbrk-sse2.S
strpbrk.c
strrchr-avx2.S x86_64: Use %xmmN with vpxor to clear a vector register 2020-06-17 05:44:02 -07:00
strrchr-sse2.S
strrchr.c
strspn-c.c
strspn-sse2.S
strspn.c
strstr-sse2-unaligned.S
strstr.c
varshift.c
varshift.h
wcschr-avx2.S
wcschr-sse2.S
wcschr.c
wcscmp-avx2.S
wcscmp-sse2.S
wcscmp.c
wcscpy-c.c
wcscpy-ssse3.S
wcscpy.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
wcslen-avx2.S
wcslen-sse2.S
wcslen.c
wcsncmp-avx2.S
wcsncmp-sse2.c
wcsncmp.c
wcsnlen-avx2.S
wcsnlen-c.c
wcsnlen-sse4_1.S
wcsnlen.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
wcsrchr-avx2.S
wcsrchr-sse2.S
wcsrchr.c
wmemchr-avx2.S
wmemchr-sse2.S
wmemchr.c
wmemcmp-avx2-movbe.S
wmemcmp-c.c
wmemcmp-sse4.S
wmemcmp-ssse3.S
wmemcmp.c
wmemset_chk-nonshared.S
wmemset_chk.c
wmemset.c