This line...
if (thisWindowsSinceLastFlash <=1 ) {
...complies to this code...
11e8: 81 e0 ldi r24, 0x01 ; 1
11ea: 8d 15 cp r24, r13
11ec: 38 f4 brcc .+14 ; 0x11fc
Why didn't the compiler use the cpi
like this...
1204: 01 30 cpi r16, 0x01 ; 1
1206: 39 f4 brcc .+14
and save the cycles and space and register used by the cp
?
Both cp
and cpi
seam to update the same flags and leave everything in the same state...
What am I missing?
Note that the cp
ended up being much more expensive that just the extra cycle because it forced a push
/pop
sequence on r24
, which costs an additional 4 cycles (6 cycles in total).
I am using the AVR8/GNU C Compiler : 5.4.0
that is included with Atmel Studio 7.0
-O...
flag for the CLI, no idea how that would be configured in Atmel Studio) \$\endgroup\$