10 ms·
I was also surprised by how suboptimal avr-gcc's generated code is. On the other hand, the AVR experience is reminiscent of early DOS, terrible C compilers and
by chadaustin 4y ago
I was also surprised by how suboptimal avr-gcc's generated code is. On the other hand, the AVR experience is reminiscent of early DOS, terrible C compilers and all, so it remains nostalgic!
Two examples: https://gcc.godbolt.org/z/M4oasdK4a https://gcc.godbolt.org/z/M4oasdK4a
* Population count: I haven't found a way to convince AVR-GCC to use LSR's shift into carry with ADC.
* Strength reduction: AVR doesn't have a barrel shifter, so it's a huge win to incrementally shift during the loop. AVR-GCC doesn't see this.