public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: GNU C Library <libc-alpha@sourceware.org>
Cc: Florian Weimer <fweimer@redhat.com>
Subject: Re: PING: V7: [PATCH 2/2] x86: Install <sys/platform/x86.h> [BZ #26124]
Date: Wed, 15 Jul 2020 07:58:39 -0700	[thread overview]
Message-ID: <CAMe9rOof7hXpWTe0gRgBvWV9dY2rBX_erPP6vJejaB+=VAZ_aQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOpL=ZY6K3BtKU2tywHfX_y6n1O+p4Q8k0FZC_kFf+i1DQ@mail.gmail.com>

On Wed, Jul 15, 2020 at 7:55 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Jun 29, 2020 at 9:35 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 falses 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.
>
> https://sourceware.org/pipermail/libc-alpha/2020-June/115546.html
>

The first patch has been checked into master branch.   The second patch is at:

https://sourceware.org/pipermail/libc-alpha/2020-June/115547.html

-- 
H.J.

  reply	other threads:[~2020-07-15 14:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  4:35 V7: [PATCH 0/2] x86: Install <sys/platform/x86.h> H.J. Lu
2020-06-30  4:35 ` V7: [PATCH 1/2] x86: Support usable check for all CPU features H.J. Lu
2020-07-04 17:17   ` H.J. Lu
2020-07-06 10:45     ` Florian Weimer
2020-07-06 14:28       ` V8: [PATCH] " H.J. Lu
2020-07-07 11:18         ` Florian Weimer
2020-07-07 11:46           ` V9 " H.J. Lu
2020-07-08 15:49             ` Florian Weimer
2020-07-08 16:32               ` V10 " H.J. Lu
2020-07-12 12:36                 ` H.J. Lu
2020-07-13 11:19                 ` Florian Weimer
2020-07-13 12:40                   ` H.J. Lu
2021-03-08 14:26                     ` Andreas Schwab
2021-03-08 14:29                       ` Florian Weimer
2020-06-30  4:35 ` V7: [PATCH 2/2] x86: Install <sys/platform/x86.h> [BZ #26124] H.J. Lu
2020-07-15 14:55   ` PING: " H.J. Lu
2020-07-15 14:58     ` H.J. Lu [this message]
2020-07-16 20:15   ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOof7hXpWTe0gRgBvWV9dY2rBX_erPP6vJejaB+=VAZ_aQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).