(a+b)+c should be replaced by a+(b+c)

Joost VandeVondele jv244@hermes.cam.ac.uk
Thu Mar 25 15:32:00 GMT 2004


>
> > No, I'm only happy there are compilers that make my code 100 times faster
> > without doing a lot of work myself, keeping my code easy to maintain and
> > read.
>
> Well it is fine to have this kind of transformation available as an
> option, though in general it is better to rely on BLAS written by
> competent numerical programmers, than on transformations of unknown
> impact.
>
Obviously, this was an example (and I referred to calling blas
explicitly), to suggest that there exists a wide range of computational
kernels that benefit from (a+b)+c->a+(b+c) being performed by the
compiler. (I realized that there are much better example of this, but
anyway).

I like the name transformation as much as I dislike unsafe-math. FYI the
following warning comes from IBM (at -O3 when optimizing, oops
transforming, expressions in a way that might lead to non-bitwise
identical results), and I think it is not badly worded :

"mytest.f90", 1500-036 (I) The NOSTRICT option (default at OPT(3)) has the
potential to alter the semantics of a program.  Please refer to
documentation on the STRICT/NOSTRICT option for more information.

Joost



More information about the Gcc mailing list