This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH x86_64][BZ #20139] Don't allow configure with not supporting AVX512 assembler w/o --disable-avx512.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>, Joseph Myers <joseph at codesourcery dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 1 Jul 2016 06:51:02 -0700
- Subject: Re: [PATCH x86_64][BZ #20139] Don't allow configure with not supporting AVX512 assembler w/o --disable-avx512.
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3tJkhW78PPe4=FUhbm=8HoOY4iouSqXxLObA0GEMTxoZA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606271751470 dot 7438 at digraph dot polyomino dot org dot uk> <CAMXFM3t_92RMmU=u-70nCHqwXL0BsZ6=82Jn=neiDx82HxjjRg at mail dot gmail dot com> <96d24e9d-bf84-a43b-2860-c49d4fe341a4 at redhat dot com> <CAMe9rOqrRTTs=oMHoew3tUtS+ru2WvWfHuOyidOOMaV468SEZw at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 1606272019240 dot 3978 at digraph dot polyomino dot org dot uk> <CAMXFM3v586M2XBqf53KHGsfSLV67tuJ1nrSBez5JQ--x9ZtWpQ at mail dot gmail dot com> <CAMe9rOr7BgZjgEH5NwY-utDZSjDWpu1wzMCATMjw0WrvK_NP9Q at mail dot gmail dot com> <c198f016-9b0d-f3e5-21a1-b4e54b210b35 at redhat dot com> <CAMe9rOp3m68KQPFkDCu+ckETGGeQjEot=b7v0zY9g-bPPVk6eg at mail dot gmail dot com> <53986bbf-b12c-7d68-01de-5506ddf6d6e0 at redhat dot com> <CAMXFM3tCzQ12gbiQ8qDHYVCEif2t9BUahbAt18NpyO0ss+pR=A at mail dot gmail dot com> <0fb8e559-e812-7e23-8080-67314fa486e1 at redhat dot com> <CAMe9rOozSvuXxiQt+10PP8F1Pfr_qF2qMPWU1gtQ8drAqvDEkw at mail dot gmail dot com>
On Fri, Jul 1, 2016 at 5:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Jul 1, 2016 at 5:40 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 07/01/2016 02:28 PM, Andrew Senkevich wrote:
>>
>>>> I have no objections to the patch as such (but also see my other comment
>>>> about aligning the XGETBV values with what the dynamic linker supports).
>>>
>>>
>>> Have we decided how to fix it in 2.23 release (which contains this bug)?
>>
>>
>> Not to my knowledge.
>>
>> Please also consider
>> <https://sourceware.org/ml/libc-alpha/2016-06/msg01108.html>.
>>
>> I would like to see a conceptual fix, not just papering over the current
>> problem.
>>
>
> FWIW, glibc 2.23 requires binutils 2.24 for s390.
>
We can do something like this for 2.23.
--
H.J.
---
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 218ff2b..abf38e4 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -211,14 +211,30 @@ init_cpu_features (struct cpu_features *cpu_features)
/* Determine if AVX512F is usable. */
if (HAS_CPU_FEATURE (AVX512F))
{
+#ifdef HAVE_AVX512_ASM_SUPPORT
cpu_features->feature[index_AVX512F_Usable]
|= bit_AVX512F_Usable;
/* Determine if AVX512DQ is usable. */
if (HAS_CPU_FEATURE (AVX512DQ))
cpu_features->feature[index_AVX512DQ_Usable]
|= bit_AVX512DQ_Usable;
+#else
+# if index_AVX2_Usable != index_AVX_Usable
+# error index_AVX2_Usable != index_AVX_Usable
+# endif
+ /* Turn off AVX support since dynamic linker can only
+ save and restore YMM registers, which clobbers the
+ upper 256 bits ofr ZMM registers. */
+ cpu_features->feature[index_AVX_Usable]
+ &= ~(bit_AVX_Usable
+ | bit_AVX2_Usable
+ | bit_AVX_Fast_Unaligned_Load);
+#endif
}
}
+#ifndef HAVE_AVX512_ASM_SUPPORT
+ if (HAS_ARCH_FEATURE (AVX_Usable))
+#endif
/* Determine if FMA is usable. */
if (HAS_CPU_FEATURE (FMA))
cpu_features->feature[index_FMA_Usable] |= bit_FMA_Usable;