3 ms·
> Most people believe that modern compilers generate better-optimized assembly code than humans, but look at this example from AVR-GCC 5.4.0 with -O2 optimizati
by codewiz 4y ago
> Most people believe that modern compilers generate better-optimized assembly code than humans, but look at this example from AVR-GCC 5.4.0 with -O2 optimization level
Modern compilers? GCC 5.1.0 was released in 2015, and 5.4.0 is a bugfix release. Why would someone blog about its poor code generation without bothering to try the latest release?
Besides, the AVR is an exceptional architecture: an 8-bit RISC with sizeof(int) == sizeof(short) == 2. Neither GCC nor C were designed for 8-bit processors.
- Beltalowda 4y agoPeople were saying "modern compilers generate better-optimized assembly code than humans" in 2015 too, and well before that. It's not that long ago. 5.4.0 is the version that ships with Debian and Ubuntu, so I guess that's why this particular version was used.
- maxnoe 4y agoWhat do you mean with: "5.4 is the Version that ships with Ubuntu"? 5.4 was the default compiler on Ubuntu 16.04, which is end of life. Ubuntu 18.04: 7.4 Ubuntu 20.04: 9.3 Ubuntu 22.04: 11.2
- Beltalowda 4y agogcc-avr is a different package from the regular gcc: https://packages.debian.org/sid/gcc-avr https://packages.debian.org/sid/gcc-avr https://packages.ubuntu.com/search?suite=kinetic&searchon=names&keywords=gcc-avr https://packages.ubuntu.com/search?suite=kinetic&searchon=na... I don't know why it's an older version, you'll have to ask the Debian people. Maybe there's a reason, but most likely ist's justthat gcc tends to be a difficult piece of software to package and not enough people care/have time to keep the avr version to to date.