This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: PR29335 add code for exp, exp2, exp10/pow10
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Oct 2006 00:00:11 -0400 (EDT)
- Subject: Re: [PATCH]: PR29335 add code for exp, exp2, exp10/pow10
- References: <Pine.LNX.4.44.0610232007240.31794-100000@www.eyesopen.com>
On Mon, 23 Oct 2006, Roger Sayle wrote:
>
> Hi Kaveh,
>
> On Mon, 23 Oct 2006, Kaveh R. GHAZI wrote:
> > 2006-10-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
> >
> > * builtins.c (fold_builtin_exponent): Evaluate constant arguments
> > at compile-time using MPFR. Change parameter VALUE to FUNC,
> > update all callers.
> > (do_mpfr_arg1): Rename `exact' to `inexact'. Carefully check
> > for overflow and underflow at all times and avoid folding in
> > those cases.
> >
> > testsuite:
> > * gcc.dg/builtin-notdone-1.c: New test.
>
> This is OK for mainline, provided that you change the name of the new
> testcase. I'd much prefer that builtin-foo-X.c referred to the names
> of built-in functions for "foo". Hence, builtin-exp-1.c or even
> builtin-expN-1.c would be better, but "notdone", "unoptimized" or
> "unfolded" don't really convey any useful information about the test.
Hi Roger,
Thanks for the review.
I'm not sure I agree with the rationale for the name change. Perhaps
"unoptimized" is better, but all three choices convey exactly what the
test is looking for. I'm not checking anything special about exponents,
I'm checking that the optimization is "not done" under special
circumstances such as overflow and underflow at each transfer between
representation types or when passed Nan or Inf.
It's just a coincidence that exp2(x) allows me to easily create scenarios
where I clearly (to the reader of the testcase) exceed the exponent bits
in one internal representation, but not another. That's because exp2's
base is the same as the radix of our float's exponents. (See the comments
in the test as to which values tweek which internal representation).
My next patch plans to include a builtin-notdone-2.c that checks the "arc"
and/or hyperbolic functions are not folded when passed an argument outside
the acceptable range, typically -1 ... 1. I check for four distinct
functions in the one file. I can't call that one e.g. builtin-asinh-1.c
cause it checks other functions too. And please don't ask me to split it
into four testcases, or you'll have to split builtin-math-1.c. :-)
Would you please reconsider this request and allow me to keep this naming
scheme or something similar?
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu