delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/25/17:51:17

Xref: news2.mv.net comp.os.msdos.djgpp:6411
From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Auto-Optimze
Date: Thu, 25 Jul 1996 18:23:03 GMT
Lines: 30
Message-ID: <838318881.9940.0@abwillms.demon.co.uk>
References: <Pine DOT LNX DOT 3 DOT 93 DOT 960722142557 DOT 22379A-100000 AT binx DOT mbhs DOT edu>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nissim Chudnoff <nchudnof AT mbhs DOT edu> wrote:

>Will DJGPP substitute a bit shift for a multiply by power of 2?
>I heard that if you are doing say:
>var = wow * 64

>Some compilers will place a bit shift in the output code to speed it up.

Yup. It also uses a trick with LEA that I thought was neat.

EG:

lea eax,[eax+eax*4]

is faster than:

mul eax,5


(Or, should I say, "lea %eax(%eax,4),%eax" is faster than "mul $5,
%eax")


ABW
--
I have become... Comfortably numb...

Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>

- Raw text -


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