This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Constant folding pow(x,y) for constant y.
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 Mar 2003 00:28:21 -0800
- Subject: Re: [PATCH] Constant folding pow(x,y) for constant y.
- References: <Pine.LNX.4.44.0303301629540.5745-100000@www.eyesopen.com>
On Sun, Mar 30, 2003 at 04:38:41PM -0700, Roger Sayle wrote:
> * emit-rtl.c (dconstm2, dconsthalf): New real constants.
> (init_emit_once): Initialize dconstm2 and dconsthalf here.
> * real.h (dconstm2, dconsthalf): Add prototypes here.
> * real.c (real_sqrt): Use dconsthalf rather than local copy.
> * builtins.c (fold_builtin): When optimizing sqrt(exp(x)) as
> exp(x/2.0) remember to fold the division if possible.
> Fold sin(0.0) as 0.0, cos(0.0) as 1.0, pow(x,1.0) as x,
> pow(x,-1.0) as 1.0/x, pow(x,2.0) as x*x, pow(x,-2.0) as
> 1.0/(x*x) and pow(x,0.5) as sqrt(x).
>
> * gcc.dg/builtins-3.c: Add new tests for sin and cos.
> * gcc.dg/builtins-7.c: New test case.
> * gcc.dg/builtins-8.c: New test case.
Ok.
r~