This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: New update to optabs.c for optimizing C op R expressions.


Paul Koning wrote:

> Excerpt of message (sent 29 June 2002) by Toon Moene:

[ simplifying C * R by removing the multiplications by zero ... ]

> > Note that -ffast-math is overkill here - what we would need is a
> > -ffinite-math switch, that indicated that only finite floating point
> > math is supported.  g77 then could set this flag by default (due to the
> > definition of the Fortran Language).
> 
> I'm puzzled that any switch is needed, since your statement about only
> two multiplications being needed is mathematically valid, independent
> of any "fast math" or other approximation assumptions.
> 
> Or is the issue that you're really looking at C*{R,0.0} with the
> second operand promoted to copmlex, and you have to test the imaginary
> part for being zero?  Same point, though: if it tests as exactly zero,
> then even if you emit the extra multiplies, they will only produce
> zero results anyway.  Right?

Under the Fortran assumptions (that don't know anything about non-finite
math - NaN's, +_Inf's, and their features) you are right.  However, it
wouldn't surprise me if C99 actually required correct non-finite math
here in case the part of C that's multiplied by the 0.0 from the
promotion of R to complex is a +-Inf or a NaN.

Note that I'm changing part of the shared middle-end - it has to be
correct for all front-end languages supported.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


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