Xref: news2.mv.net comp.os.msdos.djgpp:6458 From: deano AT rattie DOT demon DOT co DOT uk (Deano Calver) Newsgroups: comp.os.msdos.djgpp Subject: Re: Auto-Optimze Date: Fri, 26 Jul 1996 17:28:47 GMT Lines: 19 Message-ID: <838402151.26346.0@rattie.demon.co.uk> References: NNTP-Posting-Host: rattie.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. The GNU compiler will optimize any multiply by a constant (Thats what the docs say And I have examined some code where it did). Its actually cleverer than just shift it will use adds as well i.e var = wow * 3 will generate (in asm) var = (wow << 1)+wow It supposed to use binary shifts and subs/adds for some divides as well. Deano