This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Yet more constant folding of pow.
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 5 Apr 2003 15:04:56 -0700 (MST)
- Subject: Re: [PATCH] Yet more constant folding of pow.
On Sat, 5 Apr 2003, Kaveh R. Ghazi wrote:
> > /* { dg-do link } */
> > /* { dg-options "-O2 -ffast-math" } */
>
> Another thing regarding the testcase, should this be a "run" test?
>
> And don't you need -lm to link in the math funcs? I thought some of
> these transforms still leave us with one call to pow or exp. Or does
> the != elide both sides if they're the same (const) expression?
They're actually link-time tests. The "!=" can actually be proven
by the compiler to always be true or false at compile-time (with
some help from CSE), hence we never refer to pow, sqrt, exp or
link_error in the generated assembly language.
A run-time test, using "abort" rather than "link_error" wouldn't
actually test that the compiler had performed the transformation,
just that the math library was accurate enough to return the right
values. Of course, this would actually require a math library.
Who'd have though you could do mathematical theorem proving in GCC :>
[Apart from the literature on "proofs-as-types" and "proofs-as-programs"]
Roger
--