This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add C99 FP_FAST_FMA{,F,L} macros to math.h


I just checked in the support to the GCC 4.6 development compiler for ports to
generate the appropriate code for C99's fma, fmaf, and fmal builtins, and has
the powerpc compiler generate the fmadds/fmadd instructions.  This code defines
the optional FP_FAST_FMA, FP_FAST_FMAF, and FP_FAST_FMAL macros that the C99
standard specifies.

2010-10-15  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-15 14:18:18.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-15 16:04:45.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]