avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: loop deleted using optimization


From: Ben Jackson
Subject: [avr-gcc-list] Re: loop deleted using optimization
Date: Tue, 6 Mar 2007 18:49:17 -0800
User-agent: Mutt/1.5.6i

> Why does avr-gcc delete my empty "for" loops if I compile with 
> optimization on?
> I am able to preserve the loop if I add a NOP in the loop but that will 
> eat up one clock cycle.  Is there a way to preserve the empty loops 
> without adding any NOP clock cycles?

It would probably work to add an empty asm, as long as you used the
__volatile attribute to scare gcc away from reordering code in the
loop.  So, for () { __asm __volatile ("") ; }

(I note I wasn't able to get gcc 3.3 to optimize away the loop on i386)

-- 
Ben Jackson AD7GD
<address@hidden>
http://www.ben.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]