This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.
In article <vyzww1au43m.fsf@issan.cs.uni-dortmund.de>, Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> wrote: >Jeffrey A Law <law@upchuck.cygnus.com> writes: >|> >|> One could certainly ask whether or not it is safe for the compiler >|> to make the transformation from -1.0 * x to -(x). One could also >|> question whether or not the PA port should expose an fneg instruction >|> using fsub. >|> >|> I'll let the IEEE experts chime in before I try to fix this :-) > >See the current C9X draft, section F.8.2 (Expression transformations): > > -x <-> 0 - x The expressions -x and 0 - x are > not equivalent if x is +0, > because -(+0) yields -0, but 0 - > (+0) yields +0 (unless rounding > is downward). > >Thus this transformation is not safe. The (-x) -> (0 - x) transformation is not safe, but apparently that's a HP-PA port bug. The (-1 * x) -> (-x) transformation (which is what gcc does) looks safe to me, even in the presense of "+0" or any other special case. So I would say that gcc does the right thing, and that the problem is the HP md file (which in turn may be due to HP hardware sillyness, ie no reasonable way to do (-x) in the first place). Linus