This is the mail archive of the gcc@gcc.gnu.org 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]

Re: What is acceptable for -ffast-math? (Was: associative law in combine)


dewar@gnat.com wrote:
> 
> Another issue here is that the optimizations in question are unlikely to
> be that significant in practice. In real programs where performance is an
> issue, there will be relatively few opportunities for this kind of
> optimization, and assuming that the program was reasonably competently
> written, those few cases are likely to be just those that should not
> be molested.
> 
> Consdier again the assoicative case. The expression
> 
> a*b + a*c
> 

...

> 2. The somewhat competent programmer, who knows nothing about fpt details,
> but who wants their program to run fast. Such a programmer is likely to
> rewrite this manually as
> 
>   a +(b*c)

I would hope that a competent programmer would not transform the
expression into this. I would hope he would transform it into

    a*(b+c)

instead, unless my algebra has become hopelessly munged since
high school.

> anyway, because that's obviously "faster".


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