This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Add _arch_/_cpu_ to index_*/bit_* in x86 cpu-features.h
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 28 Mar 2016 15:15:53 -0700 (PDT)
- Subject: Re: [PATCH 1/2] Add _arch_/_cpu_ to index_*/bit_* in x86 cpu-features.h
- Authentication-results: sourceware.org; auth=none
- References: <1457049161-13783-1-git-send-email-hjl dot tools at gmail dot com> <CAMe9rOqmnA8TOOEo_KbxYnxaDDvzEcb+hqLHwK=dZ5J75W8d5Q at mail dot gmail dot com> <20160311214735 dot 4CAE52C3C21 at topped-with-meat dot com> <CAMe9rOovPk+-DokpWoR7c6cG4bHydhaXPyNbZPyL6fRcapoD1Q at mail dot gmail dot com> <20160311220031 dot 3A5672C3BC5 at topped-with-meat dot com> <CAMe9rOrHS0g_EZ7dgkz02SgHoxqHwp5yazt3fR9Qj9NvYG+1Jg at mail dot gmail dot com> <20160311222939 dot 654342C3C24 at topped-with-meat dot com> <CAMe9rOo3m_x-EpY2w=ZzbLDd2MjjLhrBY6fP-ngDFGDG-Z+94A at mail dot gmail dot com> <874mcc636j dot fsf at mid dot deneb dot enyo dot de> <20160311225548 dot C6A7E2C3C24 at topped-with-meat dot com> <CAMe9rOoNryvq8nZ7E_00n7C19u9rX=xD9EBetwMm+3KoPNw0fQ at mail dot gmail dot com> <87y49o4ntk dot fsf at mid dot deneb dot enyo dot de> <56F5158A dot 5040302 at redhat dot com>
> > --- a/sysdeps/x86_64/tst-audit10.c
> > +++ b/sysdeps/x86_64/tst-audit10.c
> > @@ -17,13 +17,13 @@
> > <http://www.gnu.org/licenses/>. */
> >
> > #include <cpuid.h>
> > -#include <cpu-features.h>
> >
> > int tst_audit10_aux (void);
> >
> > static int
> > avx512_enabled (void)
> > {
> > +#ifdef bit_AVX512F
> > unsigned int eax, ebx, ecx, edx;
> >
> > if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
> > @@ -38,6 +38,9 @@ avx512_enabled (void)
> >
> > /* Verify that ZMM, YMM and XMM states are enabled. */
> > return (eax & 0xe6) == 0xe6;
> > +#else
> > + return 0;
> > +#endif
> > }
> >
> > static int
>
> I have committed this, after testing compilation with GCC 4.7 and GCC
> 5.3. Bug 19860 mentions a second compilation error, which I did not
> see. I'm waiting for details on that one, maybe it was a spurious issue.
It occurred to me later that having this use #ifdef HAVE_AVX512_SUPPORT
would be better. That is, we expect a compiler that accepts -mavx512f
to provide a <cpuid.h> that defines bit_AVX512F. If we have -mavx512f
support but somehow get a <cpuid.h> missing bit_AVX512F, that should be
a build error because the compiler installation is self-inconsistent.
Thanks,
Roland