[PATCH] RFC for patch to add C99 fma/fmaf/fmal builtins

Joseph S. Myers joseph@codesourcery.com
Tue Oct 5 23:29:00 GMT 2010


On Tue, 5 Oct 2010, Michael Meissner wrote:

> +@findex fma
> +@item (fma:@var{m} @var{x} @var{y} @var{z})
> +Represents the @code{fma}, @code{fmaf}, and @code{fmal} builtin
> +functions that do a combined multiply of @var{x} and @var{y} and then

"built-in"

> +adding to@var{z} without doing an intermediate rounding step.

Missing space after "to".

> +
> +  /* Note, whether the port has builtin FMA support.  */
> +#ifdef HAVE_fmasf4
> +  if (HAVE_fmasf4 && FLOAT_TYPE_SIZE == 32)
> +    builtin_define_with_int_value ("__FP_FAST_FMAS", 1);
> +#endif
> +
> +#ifdef HAVE_fmadf4
> +  if (HAVE_fmadf4 && DOUBLE_TYPE_SIZE == 64)
> +    builtin_define_with_int_value ("__FP_FAST_FMA", 1);
> +#endif
> +
> +#ifdef HAVE_fmatf4
> +  if (HAVE_fmatf4 && LONG_DOUBLE_TYPE_SIZE == 128)
> +    builtin_define_with_int_value ("__FP_FAST_FMAL", 1);
> +#endif
> +
> +#ifdef HAVE_fmaxf4
> +  if (HAVE_fmaxf4 && LONG_DOUBLE_TYPE_SIZE > 64 && LONG_DOUBLE_TYPE_SIZE < 128)
> +    builtin_define_with_int_value ("__FP_FAST_FMAL", 1);
> +#endif

This sort of preprocessor conditional making assumptions about the 
correspondence between types and modes and type sizes is not appropriate.  
Instead, check the optabs for TYPE_MODE (float_type_node) etc. - but I'd 
advise not adding these macros at all without agreement from at least one 
library implementor to use them.  If they are added then they need 
documenting in cpp.texi.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list