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: NNTP-Posting-Host: abwillms.demon.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Nissim Chudnoff 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 http://www.hardcafe.co.uk/Alaric/