This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] RTL expansion of exponentiation by integer constant
- From: Roger Sayle <roger at eyesopen dot com>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Jun 2003 13:49:47 -0600 (MDT)
- Subject: Re: [PATCH] RTL expansion of exponentiation by integer constant
On Mon, 23 Jun 2003, Toon Moene wrote:
> Roger Sayle wrote:
> > As always this expansion is guarded by flag_unsafe_math_optimizations
> > as on machines without additional bits there may be rounding issues. On
> > x86, which has extended precision, a very similar algorithm is used in
> > the implementation of glibc's pow function. Similarly, the fortran
> > front-end also has similar code to implement X**N. Hopefully, g77
> > may be able to switch to this code eventually.
>
> Well, yes, but g77 does this *unconditionally* because it is allowed by
> the Standard. I could still call your implementation iff -ffast-math,
> of course ...
By design, the tests for both flag_unsafe_math_optimizations and
flag_errno_math are made outside of expand_powi, so that the language
front-ends that allow/want this functionality can call it directly.
I'm also a big fan of g77's code to expand powi of a variable
integer exponent inline using a loop, which I may also homage
(plagiarize) for the rest of GCC at some point in the future :>
Roger
--