www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/28/18:37:40

From: Brian Osman <osmanb AT rpi DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Loop unrolling: Don't bother
Date: Fri, 28 Feb 1997 11:08:15 -0500
Organization: Rensselaer Polytechnic Institute, Troy NY, USA
Lines: 22
Message-ID: <331702EF.8EA@rpi.edu>
References: <5f5knj$cho AT freenet-news DOT carleton DOT ca> <5f61hc$nkg AT flex DOT uunet DOT pipex DOT com>
Reply-To: osmanb AT rpi DOT edu
NNTP-Posting-Host: darkwing.stu.rpi.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

nikki wrote:
> 
> hardly a great surprise seeing as the loop above would quite probably fit in
> the cache when well optimised, but unrolled would thrash it horribly.
> unrolling loops won't save an enormous amount of time, after all a jump
> instruction will only take you 3 or 4 cycles at most.
> 
> nik
> 
> --
> Graham Tootell
> nikki AT gameboutique DOT com

Bear in mind that in many of the newer processes (ie PPro) which
use predictive branching, branches are one of the single worst
instructions. A mispredicted branch means that all of the pipeline,
and the cache has to be invalidated and flushed. Not pretty.
There are some cases where loop unrolling won't help much, but
it's still a valid and useful optimization technique. I don't
suppose -O3 is causing any unrolling? :)

Brian

- Raw text -


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