This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: V4 [PATCH] x86: Add <sys/platform/x86.h>


* H. J. Lu:

> Add <sys/platform/x86.h> to provide an API to access x86 specific platform
> features.  It makes raw and derived CPUID information available to
> applications so that programmers can avoid complicated steps to retrieve
> the same information with CPUID instructions.

Sorry, I still think that this patch semantically depends on delayed
IFUNC processing.

Furthermore, I strongly prefer a simplified interface, like:

  enum {
    X86_FEATURE_MMX,
    X86_FEATURE_SSE,
    X86_FEATURE_SSE2,
    …
    X86_FEATURE_AVX512F,
    …
  };

  _Bool x86_feature_usable (int index) __attribute__ ((pure));

Applications could then do something like this:

  if (x86_feature_usable (X86_FEATURE_AVX512F))
    return &__matmul_avx512f;

I don't think there is value in exposing the CPUID data directly.  If
programmers need it, they can use <cpuid.h> from GCC instead, without
needing to worry how glibc populates its data structures.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]