This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unrolling


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]