"may or may not", that is the question
Tom St Denis
tstdenis@ellipticsemi.com
Wed Sep 3 11:22:00 GMT 2008
David Bruant wrote:
> Hi !
>
> In the gcc manual, p.276 (p.288 of the pdf version), we can read for
> -funroll-loops : "This option makes code larger, and may or may not make
> it run faster". My first idea is that if you unroll the loops that have
> a determined number of iteration, you don't have to jump a lot of time,
> you can replace a variable by several constants and consequently
> optimize more. Another thing is that variables that control loops are
> often on registers and the fact that they disappear provides another
> register for another variable what can only improve the speed, I think.
> Finally, I would like to know some reason that could make the code
> slower by unrolling loops.
>
> And, maybe, that we (I) could write to the people that write the manual
> to add what will be said here to improve the manula, because I find the
> "may or may not" quite weak for a manual.
>
It may be slower because you may evict things from the instruction cache
as a result of unrolling the code.
Tom
More information about the Gcc-help
mailing list