PATCH - [tree-ssa] regrouping of expression tree for single multiply add.
Bradley Lucier
lucier@math.purdue.edu
Fri Mar 26 08:43:00 GMT 2004
In
http://gcc.gnu.org/ml/gcc/2004-03/msg01426.html
Ian suggests
> My vote, at least right now, would be to add -fassociative-math to
> mean that gcc is permitted to reassociate math expressions at will,
> regardless of the presence of parentheses. And -ffast-math should
> imply -fassociative-math. That is, with -ffast-math, (a+b)+c may be
> evaluated as a+(b+c).
I would like to second that suggestion, not because -fassociative-math
is a particularly bad option for many algorithms, but that it's a
particularly *benign* option for many programs. For example, the usual
error analysis for numerical linear algebra programs does not depend on
the order that the additions are performed in; and Colin Percival's
beautiful analysis of the FFT using floating point arithmetic is not
invalidated by re-association (while it depends critically on the
accuracy of the sin/cos computations used).
So, now, I'd like to be able to use this flag in places where I cannot
otherwise use -funsafe-math-optimizations. And in the future, will
there not be pragmas that one can use to designate that certain blocks
of code will be compiled with certain floating-point properties? If
so, this is a great property to put around a block of code where
re-association doesn't matter.
Brad
More information about the Gcc
mailing list