Closed chino closed 9 years ago
The gcc compiler bundled with the Arduino IDE ignores the unroll-loops options. For example:
attribute((optimize("unroll-loops"))) generates "warning: 'optimize' attribute directive ignored"
So as far as I know there is no way to convince it to unroll a specific loop.
Hm. The optimization steps don't do it implicitly either?
Does it really matter to just use a normal loop? I guess that adds another jump instruction?
Would be cool to actually have a pre-build step that uses a script to generate the unrolled c code.
It's interesting to think about. Would a jump
really matter with the avr architecture? Like does it really eat up a cycle..
I guess no matter what though if it can't unroll by it self then the test condition would eat up cycles.
Right, all instructions take cycles and a loop needs a check on the counter and then a branch to loop or exit. That check overhead eats cycles which reduces the sample rate.
I'm very curious about this.
I understand the concept of "unrolled loops" but why couldn't the compiler have done it for you?
For example here:
https://github.com/gillham/logic_analyzer/blob/master/logic_analyzer_inline_2mhz.ino#L93