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 target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related and subreg)
Date: Fri, 15 Oct 2021 02:42:38 +0000	[thread overview]
Message-ID: <bug-102758-4-x7WmvPeyur@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102758-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
           Keywords|needs-bisection             |
            Summary|[12 Regression] Failure to  |[12 Regression] Failure to
                   |use registers optimally     |use registers optimally
                   |with return values (2       |with return values (2
                   |operands related)           |operands related and
                   |                            |subreg)

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference in the IR happens from forwprop.
before RA we have this for the old compiler:
(insn 9 8 14 2 (set (reg:V8HI 89)
        (plus:V8HI (reg:V8HI 90)
            (subreg:V8HI (reg:V2DI 91) 0))) "/app/example.cpp":8:29 3418
{*addv8hi3}
     (expr_list:REG_DEAD (reg:V2DI 91)
        (expr_list:REG_DEAD (reg:V8HI 90)
            (nil))))
(insn 14 9 15 2 (set (reg/i:V2DI 20 xmm0)
        (subreg:V2DI (reg:V8HI 89) 0)) "/app/example.cpp":9:1 1439
{movv2di_internal}
     (expr_list:REG_DEAD (reg:V8HI 89)
        (nil)))

With the new compile we have:
(insn 10 9 14 2 (set (subreg:V8HI (reg:V2DI 84 [ <retval> ]) 0)
        (plus:V8HI (reg:V8HI 90)
            (subreg:V8HI (reg:V2DI 91) 0))) "/app/example.cpp":8:41 5787
{*addv8hi3}
     (expr_list:REG_DEAD (reg:V8HI 90)
        (expr_list:REG_DEAD (reg:V2DI 91)
            (nil))))
(insn 14 10 15 2 (set (reg/i:V2DI 20 xmm0)
        (reg:V2DI 84 [ <retval> ])) "/app/example.cpp":9:1 1634
{movv2di_internal}
     (expr_list:REG_DEAD (reg:V2DI 84 [ <retval> ])
        (nil)))

This now confuses the register allocator.

So this is only an issue with return because of the hard register being
involved. So this is a minor issue and not much of a problem unless you are
doing microbenchmarking.

  parent reply	other threads:[~2021-10-15  2:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  2:24 [Bug target/102758] New: [x86] Failure to use registers optimally when swapping between (identically represented) vector types gabravier at gmail dot com
2021-10-15  2:30 ` [Bug target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related) pinskia at gcc dot gnu.org
2021-10-15  2:42 ` pinskia at gcc dot gnu.org [this message]
2021-10-15  6:28 ` [Bug target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related and subreg) rguenth at gcc dot gnu.org
2021-12-03 16:37 ` rsandifo at gcc dot gnu.org
2022-05-06  8:31 ` [Bug target/102758] [12/13 " jakub at gcc dot gnu.org
2022-10-19  9:40 ` rguenth at gcc dot gnu.org
2023-05-08 12:22 ` [Bug target/102758] [12/13/14 " rguenth at gcc dot gnu.org

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-102758-4-x7WmvPeyur@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).