This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add C99 FP_FAST_FMA{,F,L} macros to math.h
On Sat, Oct 16, 2010 at 01:46:59PM -0400, Ulrich Drepper wrote:
> On Fri, Oct 15, 2010 at 16:36, Michael Meissner
> <meissner@linux.vnet.ibm.com> wrote:
> > + #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
>
> The indentation is wrong. Nested preprocessor directives need spaces
> after the #.
Ok. I believe this patch conforms to the glibc coding standard:
2010-10-19 Michael Meissner <meissner@linux.vnet.ibm.com>
* bits/mathdef.h (FP_FAST_FMA): If the GCC 4.6 port has fast fma
builtins, define the macros in the C99 standard.
(FP_FAST_FMAF): Ditto.
(FP_FAST_FMAL): Ditto.
* sysdeps/powerpc/bits/mathdef.h (FP_FAST_FMA): Define, ppc as
multiply/add.
(FP_FAST_FMAF): Ditto.
*** bits/mathdef.h.~1~ 2010-10-15 14:14:39.000000000 -0400
--- bits/mathdef.h 2010-10-19 11:42:28.000000000 -0400
*************** typedef double double_t; /* `double' exp
*** 34,39 ****
--- 34,53 ----
# 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
*** sysdeps/powerpc/bits/mathdef.h.~1~ 2010-10-15 14:14:49.000000000 -0400
--- sysdeps/powerpc/bits/mathdef.h 2010-10-19 11:43:22.000000000 -0400
*************** typedef double double_t;
*** 61,64 ****
--- 61,68 ----
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
+ /* The powerpc has a combined multiply/add instruction. */
+ # define FP_FAST_FMA 1
+ # define FP_FAST_FMAF 1
+
#endif /* ISO C99 */
--
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com