]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Aug 2017 13:18:55 +0000 (06:18 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Aug 2017 13:19:07 +0000 (06:19 -0700)
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
sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h

index 9ffc40cb503fcf6e56b5e00112a6739f92228127..8da8e34fa9fcaad21f691b5b044767becc6b0652 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [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  <dj@redhat.com>
 
        * bug17079.c: Update to new test harness.
index a43d4c54faeda4263e0ab1dea8955e7db77a9211..ccda2748c5c23f3b5f0736931df5fe479ea0204c 100644 (file)
@@ -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);