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] Evaluate pow(x,n) at compile-time (take 2)


Roger Sayle <roger@www.eyesopen.com> writes:

> The following patch is a revision of my previous patch to evaluate
> pow(x,n), for integer constant values of n, at compile time.
> http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00627.html
...
> Ok for mainline?

This is OK.

> 2003-05-04  Roger Sayle  <roger@eyesopen.com>
> 
> 	* real.c (real_powi): New function to calculate the value of
> 	a real raised to an integer power, i.e. pow(x,n) for int n.
> 	(real_sqrt): Convert to using the faster do_add, do_multiply
> 	and do_divide API for consistency with the rest of real.c.
> 	* real.h (real_powi): Prototype here.
> 	* builtins.c (fold_builtin):  Avoid local variable mode when
> 	evaluating sqrt at compile time.  Attempt to evaluate pow at
> 	compile-time, by checking for an integral exponent.
> 
> 	* gcc.dg/builtins-14.c: New test case.
-- 
- Geoffrey Keating <geoffk@geoffk.org>


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