This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Perform constant folding of math builtins
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: roger at eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 27 Aug 2002 10:45:10 -0400 (EDT)
- Subject: Re: [PATCH] Perform constant folding of math builtins
- References: <200208261945.PAA09170@caip.rutgers.edu>
> From: Roger Sayle <roger at eyesopen dot com>
>
> On Mon, 26 Aug 2002, Kaveh R. Ghazi wrote:
> > > Nice set of transformations, though.
> > Thanks, want to implement any of them? :-)
>
> I'm more than happy to code up all of them! :> However, I'll probably
> implement the more primitive case:
>
> x/pow(y,p) = x*pow(y,-p)
>
> which when combined with pow(x,p)*pow(x,q) = pow(x,p+q), would provide
> the pow(x,p)/pow(x,q) = pow(x,p-q) case that you list explicitly.
Yes I noticed that you did the same for exp. Good thinking.
> > Being is stage3 is no reason to stop improving GCC.
> > See: http://gcc.gnu.org/ml/gcc/2002-08/msg01575.html
>
> I already have a number of patches on hold until after stage 3, so
> shelving these patches with the rest is no great hardship. I'm sure
> there are plenty of PRs that I can look into between now and then.
> Roger
Certainly fix PRs if you can.
--Kaveh
PS: I thought of another pow case to fold :-)
pow (0.0, x) = (x == 0.0) ? 1.0 : 0.0
or perhaps -> ((double)(x == 0.0))
(I'm not sure which is better or if there's any difference.)
--
Kaveh R. Ghazi Director of Systems Architecture
ghazi@caip.rutgers.edu Qwest Solutions