optimization request: (-a)*(-b) => a*b

Sylvain Pion Sylvain.Pion@sophia.inria.fr
Thu Mar 4 02:33:00 GMT 1999


Hi,

I think the optimization that transforms (-a)*(-b) into a*b is always valid
(for integers as well as IEEE 754 floats/doubles).  Egcs doesn't perform it,
so I would like to know if someone with more knowledge in egcs than I could
implement it.  I don't know at all if it's hard, but I volunteer to test
patches.

I beleive a way to do it is to systematically change the expresion X*(-a) into
(-X)*a, which, when X=(-b), will be optimized into b*a (egcs already optimizes
-(-b) into b).

The same thing is probably also ok for division, though less interesting.

-- 
Sylvain


More information about the Gcc mailing list