[x86_64,BZ,#20139] Don't allow configure with not supporting AVX512 assembler w/o --disable-avx512.
Commit Message
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.
@@ -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;