PING^3: V8 [PATCH 2/2] x86: Install <sys/platform/x86.h> [BZ #26124]

H.J. Lu hjl.tools@gmail.com
Mon Sep 7 18:21:47 GMT 2020


On Wed, Sep 2, 2020 at 5:55 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Aug 19, 2020 at 5:52 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Aug 12, 2020 at 7:00 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Aug 5, 2020 at 4:01 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > 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.
> >
> > PING:
> >
> > https://sourceware.org/pipermail/libc-alpha/2020-August/116865.html
> >
>
> If there are no more comments, I will check it next Friday,
> Sept 11.
>

I am enclosing the rebased patch I am checking in this Friday.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Install-sys-platform-x86.h-BZ-26124.patch
Type: text/x-patch
Size: 52609 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200907/b757f7b8/attachment-0001.bin>


More information about the Libc-alpha mailing list