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: Optimization Question


>> "Stephen" == Stephen L Moshier <moshier@mediaone.net> writes:

 >> a=b*(c+d) I
 >> 
 >> versus a=b*c+b*d II
 >> 
 >> The current snapshot doesn't recognize the equivalence and simply
 >> generates two fmuls and and a faddp for case II (only one fmuls for I).
 >> Is this something that could be build into the optimization?

 Stephen> gcc does not currently have this capability.

 Stephen> Please, no!  Floating point arithmetic does not obey the associative
 Stephen> law.  This transformation should never be allowed, in any
 Stephen> programming language.

 Stephen> Further, the transformation cannot be regarded as an "optimization"
 Stephen> because it can change the value of an expression.  We have worked
 Stephen> hard, I thought, to prevent any optimizations from changing the
 Stephen> value of an expression.

Is this an acceptable -ffast-math transformation?  How far off can this
transformation get and how bad will it tend to be in typical (dangerous word,
I know) usage?

-- 
Jerry Quinn                             Tel: (514) 761-8737
jquinn@nortelnetworks.com               Fax: (514) 761-8505
Speech Recognition Research


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