This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: V4 [PATCH] x86: Add <sys/platform/x86.h>
- From: Florian Weimer <fweimer at redhat dot com>
- To: "H.J. Lu" <hongjiu dot lu at intel dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Thu, 20 Sep 2018 13:41:44 +0200
- Subject: Re: V4 [PATCH] x86: Add <sys/platform/x86.h>
- References: <20180919131313.GA7503@intel.com>
* 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