delorie.com/archives/browse.cgi | search |
Xref: | news2.mv.net comp.os.msdos.djgpp:3635 |
From: | malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: mov %eax, %eax in generated asm source |
Date: | Thu, 09 May 1996 10:19:41 GMT |
Organization: | Grafik Software |
Lines: | 28 |
Message-ID: | <4mskgp$ce4@news.manawatu.gen.nz> |
References: | <4mnhbv$qs2 AT doc DOT zippo DOT com> |
Reply-To: | malcolm AT manawatu DOT gen DOT nz |
NNTP-Posting-Host: | malcolm.manawatu.gen.nz |
Mime-Version: | 1.0 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Mark Wayland wrote: >Hi all, >Can I ask what may potentially be a stupid question ? Well, I will anyway ... >Can anyone tell me the purpose of the code that is generated by >gcc -S fred.c >whereby it generates >mov %eax, %eax >???? It seems like a time-waster to me ?? It is :). GCC will often create seemingly stupid arrangements of asembler instructions when not optimising as it doesn't take much account of previous instructions it has output. This probably came about from the need to shift a variable into eax, which just happened to be in eax. The solution is to compile with optimizations (eg -O2) and you'll these will disappear. Malcolm
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |