This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Evaluate pow(x,n) at compile-time (take 2)
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 05 May 2003 11:52:14 -0700
- Subject: Re: [PATCH] Evaluate pow(x,n) at compile-time (take 2)
- References: <jmfzoqfhj8.fsf@desire.geoffk.org><Pine.LNX.4.44.0305040752300.6810-100000@www.eyesopen.com>
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>