This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling
- To: rth at cygnus dot com
- Subject: Re: Loop unrolling
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Sat, 13 Jun 1998 02:48:26 +0100 (BST)
- Cc: oliva at dcc dot unicamp dot br, rth at cygnus dot com, mrs at wrs dot com, amylaar at cygnus dot co dot uk, egcs-patches at cygnus dot com, egcs at cygnus dot com, pfeifer at dbai dot tuwien dot ac dot at
> for (i = 0; i < 10; ++i) __asm __volatile ("" : );
>
> cannot be removed. no need for special syntax.
It cannot be removed, but it can be unrolled. And since the loop
count isn't used, no instructions are needed.
If you write instead:
for (i = 0; i < 10; ++i) __asm __volatile ("" : : "r" (i));
gcc still has to do one register load per iteration.