www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/30/13:26:50

From: "Andrew Jones" <xluminous AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <fyoofqnexgrpubet DOT fniy770 DOT pminews AT nntp DOT generation DOT net>
Subject: Re: GCC optimization
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <4VLa4.70142$X47.388252@quark.idirect.com>
Date: Thu, 30 Dec 1999 16:39:28 GMT
NNTP-Posting-Host: 216.154.29.227
X-Complaints-To: abuse AT idirect DOT com
X-Trace: quark.idirect.com 946571968 216.154.29.227 (Thu, 30 Dec 1999 11:39:28 EST)
NNTP-Posting-Date: Thu, 30 Dec 1999 11:39:28 EST
Organization: Internet Direct - http://www.mydirect.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> 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.

Andrew Jones.




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019