rs6000: Trivial code generation stupidity

degger@fhm.edu degger@fhm.edu
Mon Dec 17 10:30:00 GMT 2001


Hija,

I just noticed that the current cvs gcc generates stupid
code for dead simple cases.

Consider:

int
foo (int a, int b)
{
  return b+1;
}

This will compile into:
foo:
        addi 4,4,1
        mr 3,4
        blr

What I would have expected is:
foo:
        addi 3,4,1
        blr

The same happens for floatingpoint code. If there's more then 1
parameter then I will always get a register move which is
really unnecessary. gcc 2.95.3 gets it right. Any ideas?

--
Servus,
       Daniel



More information about the Gcc mailing list