From: "sl" Newsgroups: comp.os.msdos.djgpp Subject: Re: GCC optimization Date: Thu, 30 Dec 1999 20:09:46 -0500 (EST) Organization: Posted via Supernews, http://www.supernews.com Lines: 37 Message-ID: References: <4VLa4.70142$X47 DOT 388252 AT quark DOT idirect DOT com> X-Complaints-To: newsabuse AT supernews DOT com X-Newsreader: PMINews 2.00.1205 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 30 Dec 1999 16:39:28 GMT, Andrew Jones wrote: >> Does GCC optimize "something*1024" into "something << 10"? > >Let's see. > > >TEST.C >~~~~ >int glob; > >int main(void) > { > return(glob * 1024); > } > > >gcc -c -S test.c > > >GLOB.S >~~~~~ >[...] >movl _glob,%eax >movl %eax,%edx >movl %edx,%ecx >sall $10,%ecx >movl %ecx,%eax >[...] > >In a word: YES. Hehehe.. Thanks! Gili