public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/95126] [9/10/11/12 Regression] Missed opportunity to turn static variables into immediates
Date: Mon, 13 Dec 2021 04:56:36 +0000	[thread overview]
Message-ID: <bug-95126-4-9rV72XwIMX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95126-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95126

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
           Severity|normal                      |enhancement
            Summary|Missed opportunity to turn  |[9/10/11/12 Regression]
                   |static variables into       |Missed opportunity to turn
                   |immediates                  |static variables into
                   |                            |immediates
   Target Milestone|---                         |9.5
      Known to work|                            |5.1.0
      Known to fail|                            |5.2.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, in GCC 5.1.0 (and before) we used to produce:
        mov     rdi, QWORD PTR s.1839[rip]
        jmp     func

In GCC 5.2.0 and above GCC produces:

        movzx   edi, WORD PTR s.1839[rip+2]
        movzx   edx, WORD PTR s.1839[rip]
        sal     rdi, 16
        mov     rax, rdi
        movzx   edi, WORD PTR s.1839[rip+4]
        or      rax, rdx
        sal     rdi, 32
        or      rdi, rax
        jmp     func

In both cases, the expander sees:
  <bb 2>:
  func (s); [tail call]
  return;

But the expander goes bad.
So this has to be a patch which was backported to the GCC 5 branch which caused
to produce even worse code.

  parent reply	other threads:[~2021-12-13  4:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 10:16 [Bug c/95126] New: " pskocik at gmail dot com
2020-05-14 11:47 ` [Bug c/95126] " rguenth at gcc dot gnu.org
2021-12-13  4:56 ` pinskia at gcc dot gnu.org [this message]
2021-12-13  5:02 ` [Bug middle-end/95126] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-21 13:34 ` rguenth at gcc dot gnu.org
2022-02-08  5:38 ` amodra at gmail dot com
2022-02-26 22:07 ` roger at nextmovesoftware dot com
2022-05-27  9:42 ` [Bug middle-end/95126] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-04 11:23 ` cvs-commit at gcc dot gnu.org
2022-06-10 13:55 ` roger at nextmovesoftware dot com

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=bug-95126-4-9rV72XwIMX@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).