Re:AVR-GCC Compiler Makes Questionable Code
by chadaustin on Saturday December 17, 2022 @03:41PM
(#34032016)
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
* 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.