* FP_FAST_FMA* definitions for ARM
@ 2010-10-19 20:14 Joseph S. Myers
0 siblings, 0 replies; only message in thread
From: Joseph S. Myers @ 2010-10-19 20:14 UTC (permalink / raw)
To: libc-ports
Architectures that have fused multiply-add instructions should define
FP_FAST_FMA etc. in their bits/mathdef.h headers similarly to the generic
header - either unconditionally, if such instructions will always be used,
or conditionally on the relevant GCC 4.6 macros, if the instructions are
only present for some architecture variants.
I've applied this patch to add conditional definitions for ARM. Fused
instructions are available in VFPv4 (Cortex-A5 and Cortex-A15) (older NEON
versions had only non-fused multiply-add); GCC doesn't yet support
generating them from the fma built-in functions but I expect it will in
due course.
The MIPS multiply-add instructions are non-fused. I haven't looked at
what other ports architectures have in this regard.
diff --git a/ChangeLog.arm b/ChangeLog.arm
index 02affa8..69a28c6 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,8 @@
+2010-10-19 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/arm/bits/mathdef.h (FP_FAST_FMA, FP_FAST_FMAF,
+ FP_FAST_FMAL): Define if associated GCC macros are defined.
+
2010-10-11 Joseph Myers <joseph@codesourcery.com>
* sysdeps/arm/eabi/feupdateenv.c (feupdateenv): Add
diff --git a/sysdeps/arm/bits/mathdef.h b/sysdeps/arm/bits/mathdef.h
index daca110..97f5d4d 100644
--- a/sysdeps/arm/bits/mathdef.h
+++ b/sysdeps/arm/bits/mathdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2004, 2006, 2007
+/* Copyright (C) 1999, 2000, 2004, 2006, 2007, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -34,6 +34,20 @@ typedef double double_t; /* `double' expressions are evaluated as
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
+/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
+ builtins are supported. */
+# if __FP_FAST_FMA
+# define FP_FAST_FMA 1
+# endif
+
+# if __FP_FAST_FMAF
+# define FP_FAST_FMAF 1
+# endif
+
+# if __FP_FAST_FMAL
+# define FP_FAST_FMAL 1
+# endif
+
#endif /* ISO C99 */
#ifndef __NO_LONG_DOUBLE_MATH
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-19 20:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19 20:14 FP_FAST_FMA* definitions for ARM Joseph S. Myers
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).