www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/27/13:00:35

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: <Pine DOT LNX DOT 3 DOT 93 DOT 960722142557 DOT 22379A-100000 AT binx DOT mbhs DOT edu>
NNTP-Posting-Host: rattie.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.

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

- Raw text -


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