public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
@ 2017-08-17 23:01 H.J. Lu
  2017-08-18 13:03 ` Senkevich, Andrew
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2017-08-17 23:01 UTC (permalink / raw)
  To: GNU C Library; +Cc: Andrew Senkevich

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-18 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 23:01 [PATCH] x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966] H.J. Lu
2017-08-18 13:03 ` Senkevich, Andrew
2017-08-18 13:21   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).