This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Constant folding pow(x,y) for constant y.


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]