Mail Archives: djgpp/1997/02/28/18:37:40
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 -