Why does gcc produce an unnecessary `nop' instruction?

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

 



Here is my code:
-----------------------------------------------
void loadicon(void)
{
	static unsigned char icon_buf[] = {
		#include "icon1.dat"
		#include "icon2.dat"
	};
	SetBufAddr(icon_buf);
}
-----------------------------------------------
And I compile it with sde-gcc ( Version 6.06 ) with options -O2 -mips32r2


The assembly code produced by gcc is:
-----------------------------------------------
800650b0 <loadicon>:
800650b0:	3c048006 	lui	a0,0x8006
800650b4:	0801964b 	j	8006592c <SetBufAddr>
800650b8:	24846128 	addiu	a0,a0,24872
800650bc:	00000000 	nop
-----------------------------------------------
The `nop' instruction seems useless at all here.


And I try another compiler mips-elf-gcc, and get
-----------------------------------------------
800650c0 <loadicon>:
800650c0:	3c048006 	lui	a0,0x8006
800650c4:	0801963b 	j	800658ec <SetBufAddr>
800650c8:	248460e8 	addiu	a0,a0,24808
-----------------------------------------------
There is no any more `nop'.

The gcc core of sde-gcc is 3.4.4, newer than that of mips-elf-gcc which is 3.4.0.

Based on what reasons the new gcc code produces an `nop' ?


[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