public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Stefan Kanthak" <stefan.kanthak@nexgo.de>
To: "Dave Blanchard" <dave@killthe.net>
Cc: <gcc@gnu.org>
Subject: Re: GCC plays "Shell Game", but looses track of the shell covering the nought
Date: Sat, 27 May 2023 19:00:32 +0200	[thread overview]
Message-ID: <D0F02754A36B4F2C9401F2E20FA830E3@H270> (raw)
In-Reply-To: <20230527113728.26edde9fb121c8c310413fbb@killthe.net>

"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

      parent reply	other threads:[~2023-05-27 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27 16:23 Stefan Kanthak
     [not found] ` <20230527113728.26edde9fb121c8c310413fbb@killthe.net>
2023-05-27 17:00   ` Stefan Kanthak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D0F02754A36B4F2C9401F2E20FA830E3@H270 \
    --to=stefan.kanthak@nexgo.de \
    --cc=dave@killthe.net \
    --cc=gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).