Hi.
I'm looking at asm generated for the following loop (8051, a CYCFX2LP
actually) with sdcc 3.1.0#7066:
__sbit __at 0x98+1 TI;
void main() {
while (!TI);
TI = 0;
}
I get this:
00101$:
jbc _TI,00115$
sjmp 00101$
00115$:
Wouldn't it be more efficient, for such bit polling loop, to use instead:
00101$:
jnb _TI,00101$
clr _TI
The first version polls _TI every 7 cycles.
The second version polls _TI every 4 cycles.
If _TI is set on loop entry, the first version exits after 4 cycles while the
second exits after 6 cycles. I believe it's sane to assume this is an unlikely
event, so it shouldn't matter too much.
Regards,
--
Vincent Pelletier
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user