GCC plays "Shell Game", but looses track of the shell covering the nought
Stefan Kanthak
stefan.kanthak@nexgo.de
Sat May 27 17:00:32 GMT 2023
"Dave Blanchard" <dave@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.kanthak@nexgo.de> wrote:
>
>> [...]
>> It's a REAL shame how bad GCC's code generator is!
>>
>> Stefan
More information about the Gcc
mailing list