[PATCH]: PR29335 use MPFR for more math builtins

Roger Sayle roger@eyesopen.com
Wed Oct 25 17:32:00 GMT 2006


On Wed, 25 Oct 2006, Kaveh R. GHAZI wrote:
> 2006-10-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
>
> 	PR middle-end/29335
> 	* builtins.c (fold_builtin_cbrt, fold_builtin_logarithm):
> 	Calculate compile-time constants using MPFR.
> 	(fold_builtin_1): Likewise handle BUILT_IN_ERF, BUILT_IN_ERFC,
> 	BUILT_IN_EXPM1 and BUILT_IN_LOG1P.
>
> testsuite:
> 	* gcc.dg/torture/builtin-math-2.c (TESTIT): Use new helper macro.
> 	Add checks for log, log2, log10 and log1p.
>
> 	* gcc.dg/torture/builtin-math-3.c: Add checks for -0.0 everywhere
> 	we already test 0.0.  Add checks for expm1, log, log2, log10,
> 	log1p, cbrt, erf and erfc.

This is OK for mainline.


But a minor style nit:

> -  tree arg = TREE_VALUE (arglist);
> +  tree arg = TREE_VALUE (arglist), res;

My personal preference would be to write this as either

	tree arg = TREE_VALUE (arglist);
        tree res;

or

	tree res, arg = TREE_VALUE (arglist);

The rational is that the definition of variables can get obscured by
large (potentially multi-line) initializers.  I try to stick with the
rule of thumb that if a C variable has an initialization, it should
appear in it's own declaration.  However, given it's a style choice,
I can appreciate other folks preferring the second form, placing things
on one line, but with an initializer last.  Does anyone have a strong
opinion on this?



Thanks again for adding support for these functions.  I know some
fortran folks at Los Alamos that'll be happy to see improved support
for "erf" and "erfc".

Roger
--



More information about the Gcc-patches mailing list