"Dave Blanchard" <d...@killthe.net> wrote: > Hi Stefan, thanks for sharing this information. > I was wondering if the code generators in earlier GCC > versions were any better?
Just open one of the URLs I included, select another GCC version and see the resulting code. > Is this a problem in GCC 12+ only? NO! GCC's code generator REALLY sucks, especially when "double word" operations are involved. GCC 6.* generates the following "gem": .L5: # eax is already 0 here! xor eax, eax movzx eax, al pop ebx pop esi ret GCC 7.* is even worse, it clobbers FOUR registers. GCC 8.* and 9.* uses/clobbers just one additional register. GCC 10.* generates the same code as GCC 13.1 with "only" 13 superfluous instructions (from a total of 26). GCC 11.* shows the same behaviour with 19 superfluous instructions as 12.* Also note the difference to yesterdays demo.c: "thanks" to the added | (argument != 0) GCC does NOT generate SSE2 instructions any more. I don't know yet whether this change is a quirk or WTF, Stefan > Dave > > > On Sat, 27 May 2023 18:23:12 +0200 > "Stefan Kanthak" <stefan.kant...@nexgo.de> wrote: > >> [...] >> It's a REAL shame how bad GCC's code generator is! >> >> Stefan