glibc/sysdeps
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
..
aarch64 AArch64: Improve backwards memmove performance 2020-08-28 17:51:40 +01:00
alpha alpha: Use builtin sqrt{f} 2020-06-22 11:09:49 -03:00
arc ARC: Build Infrastructure 2020-07-10 16:08:45 -07:00
arm arm: remove string/tst-memmove-overflow XFAIL 2020-07-16 06:56:52 +02:00
csky semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
generic Linux: Remove rseq support 2020-07-16 17:55:35 +02:00
gnu Remove internal usage of extensible stat functions 2020-09-11 14:35:32 -03:00
hppa dl-runtime: reloc_{offset,index} now functions arch overide'able 2020-06-05 13:45:46 -07:00
htl htl: Move cleanup handling to non-private libc-lock 2020-06-28 00:13:57 +00:00
hurd hurd: Fix build-many-glibcs.py 2020-07-13 14:25:03 -03:00
i386 x86: Install <sys/platform/x86.h> [BZ #26124] 2020-09-11 17:20:52 -07:00
ia64 ia64: Use generic exp10f 2020-06-19 12:08:52 -03:00
ieee754 math: Fix inaccuracy of j0f for x >= 2^127 when sin(x)+cos(x) is tiny 2020-08-07 16:33:13 -03:00
m68k m68k: Use sqrt{f} builtin for coldfire 2020-06-22 11:09:50 -03:00
mach Remove internal usage of extensible stat functions 2020-09-11 14:35:32 -03:00
microblaze semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
mips mips: Use sqrt{f} builtin 2020-06-22 11:09:49 -03:00
nios2 Update Nios II libm-test-ulps file. 2020-08-03 01:42:48 -07:00
nptl nptl: futex: Provide correct indentation for part of __futex_abstimed_wait_cancelable64 2020-09-09 09:23:43 +02:00
posix Remove internal usage of extensible stat functions 2020-09-11 14:35:32 -03:00
powerpc Update powerpc libm-test-ulps 2020-09-10 15:52:01 -03:00
pthread C11 threads: Fix inaccuracies in testsuite 2020-09-07 11:42:52 +02:00
riscv RISC-V: Build infrastructure for 32-bit port 2020-08-27 08:17:43 -07:00
s390 S390: Sync HWCAP names with kernel by adding aliases [BZ #25971] 2020-08-21 11:23:17 +02:00
sh semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
sparc Update sparc libm-test-ulps 2020-09-11 14:39:03 -03:00
unix x86: Install <sys/platform/x86.h> [BZ #26124] 2020-09-11 17:20:52 -07:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
x86 x86: Install <sys/platform/x86.h> [BZ #26124] 2020-09-11 17:20:52 -07:00
x86_64 x86: Install <sys/platform/x86.h> [BZ #26124] 2020-09-11 17:20:52 -07:00