public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Why does gcc produce an unnecessary `nop' instruction?
@ 2008-01-25 19:41 PRC
  2008-01-25 22:55 ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: PRC @ 2008-01-25 19:41 UTC (permalink / raw)
  To: gcc-help

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' ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-27  0:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-25 19:41 Why does gcc produce an unnecessary `nop' instruction? PRC
2008-01-25 22:55 ` Ian Lance Taylor
2008-01-25 22:55   ` PRC
2008-01-26  2:33     ` John Love-Jensen
2008-01-26  4:48     ` Ian Lance Taylor
2008-01-28  3:12   ` Darryl Miles
2008-01-28 12:12     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).