This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH - [tree-ssa] regrouping of expression tree for single multiply add.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]