This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: Andrew Senkevich <andrew dot senkevich at intel dot com>
- Date: Thu, 17 Aug 2017 16:00:44 -0700
- Subject: [PATCH] x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Since the AVX2 version of mathvec functions uses FMA, it can only be
used when FMA is usable.
Any comments?
Andrew, please take a look and check if it should be fixed on branches.
Thanks.
H.J.
[BZ #21966]
* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
(IFUNC_SELECTOR): Don't use the AVX2 version if FMA isn't
usable.
---
sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h b/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
index a43d4c54fa..ccda2748c5 100644
--- a/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
+++ b/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
@@ -31,7 +31,8 @@ IFUNC_SELECTOR (void)
{
const struct cpu_features* cpu_features = __get_cpu_features ();
- if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable))
+ if (CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable)
+ && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable))
return OPTIMIZE (avx2);
return OPTIMIZE (sse_wrapper);
--
2.13.5