www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/17/03:00:18

Message-ID: <3600B3C4.9CCDAEF3@mailexcite.com>
Date: Thu, 17 Sep 1998 03:01:25 -0400
From: Doug Gale <dgale AT mailexcite DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: djgpp and optimizations
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980916121635 DOT 5874O-100000 AT is>
NNTP-Posting-Host: oshawappp11.idirect.com
Organization: "Usenet User"
Lines: 33
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Eli Zaretskii wrote:

> On Tue, 15 Sep 1998, Arthur wrote:
>
> > What does -fstrength-reduce do, exactly, and why do some people report such
> > a huge speed increase when using it?
>
> -fstrength-reduce replaces expensive instruction by less expensive
> ones.  For example, multiplication is replaced with additions or bit
> shifts, etc.
>
> The problem is that this usually needs extra registers, and x86 has a
> few of them to spare.  If a function doesn't use too many registers,
> then -fstrength-reduce can be a big win; but if they are all used,
> -fstrength-reduce in a loop can mean a significant slowdown, since GCC
> will have to constantly reload some of the regsiters.

Oh, -fstrength-reduce does that too? I read somewhere that -fstrength-reduce it
is more of a loop optimization that does stuff like converting

for (i = 0; i < 100; i++)

into

for (temp = 100, i = 0; --temp; i++)

saving a cycle or two at the end of each iteration, and a few bytes of code per
loop.



- Raw text -


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