From 098b9dd46814f7e624e42a8844c169f3edc67052 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 18 Aug 2017 06:18:55 -0700 Subject: x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966] Since the AVX2 version of mathvec functions uses FMA, it can only be used when FMA is usable. [BZ #21966] * sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h (IFUNC_SELECTOR): Don't use the AVX2 version if FMA isn't usable. --- ChangeLog | 7 +++++++ sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9ffc40cb50..8da8e34fa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-08-18 H.J. Lu + + [BZ #21966] + * sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h + (IFUNC_SELECTOR): Don't use the AVX2 version if FMA isn't + usable. + 2017-08-17 DJ Delorie * bug17079.c: Update to new test harness. 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); -- cgit 1.4.1