Re: Unexpected instruction sequence on MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aaron W. LaFramboise wrote:
On a GCC 4.1.1 cross targeted to mips-mips-elf, this C input file:

int sum(int a, int b) {
  return a + b + 42;
}

produces this output with -O3:

addiu   v0,a0,42
jr      ra
addu    v0,a1,v0

Why does the compiler place "jr" before "addu"?

The compiler reorders the instructions to take advantage of the branch delay slot. Take a look at the output with -fno-delayed-branch.

Regards,

Ryan Mansfield

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux