GCC internals chapter 16.14

Panu-Kristian Poiksalo panu.poiksalo@vlsi.fi
Wed Aug 19 20:53:00 GMT 2009


Dear GCC people,
Greetings!

Sorry to bother you with an idiotic question, but I might have
misunderstood something rather profoundly.

See GCC internals chapter 16.14 "Canonicalization of Instructions".
In item #4 of the list of canonicalizations, it is stated:
"(plus (mult (neg A) B) C) is canonicalized as (minus A (mult B C))."

Now, that looks a bit strange. Does that mean that
((-a) * b) + c)  is-equal-to  (a - (b * c))

because it doesn't seem that way if I substitute a=3, b=5, c=7 I get
((-3) * 5) + 7) = (-15 + 7) = -8  and
(3 - (5 * 7)) = (3 - (35)) = -32.

Am I getting something wrong? To be sure, I checked this with my soviet
made Elorg 801 LED calculator I bought from a flee-market at the price of
one euro.

Cheers,
Panu






More information about the Gcc-help mailing list