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 rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before
Date: Sat, 15 Oct 2022 01:08:10 +0000	[thread overview]
Message-ID: <bug-107270-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 107270
           Summary: [10/11/12/13 Regression] return for structure is not
                    as good as before
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*-*

Take:
```

struct b
{
  int t;
  int tt;
};

union a
{
  long long t;
  struct b b;
};

struct b f(int i, int t)
{
  return (struct b){i, t};
}

long long f1(int i, int t)
{
  struct b b = {i, t};
  union a a;
  a.b = b;
  return a.t;
}
```
In GCC 8.x, GCC -O2 would produce:
```
f:
        .cfi_startproc
        bfi     x0, x1, 32, 32
        ret
f1:
        .cfi_startproc
        bfi     x0, x1, 32, 32
        ret
```
But in GCC 9 and above GCC produces:
```
f:
        .cfi_startproc
        uxtw    x0, w0
        orr     x0, x0, x1, lsl 32
        ret
f1:
        .cfi_startproc
        uxtw    x0, w0
        orr     x0, x0, x1, lsl 32
        ret
```

             reply	other threads:[~2022-10-15  1:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-15  1:08 pinskia at gcc dot gnu.org [this message]
2022-10-15  1:08 ` [Bug rtl-optimization/107270] " pinskia at gcc dot gnu.org
2023-04-08 14:41 ` [Bug target/107270] " law at gcc dot gnu.org
2023-07-07 10:44 ` [Bug target/107270] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-02-22 15:56 ` rearnsha at gcc dot gnu.org
2024-02-23  1:21 ` pinskia at gcc dot gnu.org
2024-02-23  4:24 ` pinskia 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-107270-4@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).