public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before
@ 2022-10-15  1:08 pinskia at gcc dot gnu.org
  2022-10-15  1:08 ` [Bug rtl-optimization/107270] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-15  1:08 UTC (permalink / raw)
  To: gcc-bugs

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
```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/107270] [10/11/12/13 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
@ 2022-10-15  1:08 ` pinskia at gcc dot gnu.org
  2023-04-08 14:41 ` [Bug target/107270] " law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-15  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5
      Known to work|                            |8.5.0
      Known to fail|                            |9.1.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107270] [10/11/12/13 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
  2022-10-15  1:08 ` [Bug rtl-optimization/107270] " pinskia at gcc dot gnu.org
@ 2023-04-08 14:41 ` law at gcc dot gnu.org
  2023-07-07 10:44 ` [Bug target/107270] [11/12/13/14 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2023-04-08 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107270] [11/12/13/14 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
  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 ` rguenth at gcc dot gnu.org
  2024-02-22 15:56 ` rearnsha at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107270] [11/12/13/14 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2024-02-22 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-22
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Successfully matched this instruction:
(set (reg/i:DI 0 x0)
    (ior:DI (and:DI (reg/v:DI 92 [ b ])
            (const_int 4294967295 [0xffffffff]))
        (ashift:DI (subreg:DI (reg:SI 100) 0)
            (const_int 32 [0x20]))))
rejecting combination of insns 10 and 15
original costs 4 + 4 = 8
replacement cost 12

But this is just BFI, so it's a costing issue.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107270] [11/12/13/14 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-23  1:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Working on a patch which adds aarch64_bfi_rtx_p to catch all of these manual
BFI patterns.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/107270] [11/12/13/14 Regression] return for structure is not as good as before
  2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-02-23  1:21 ` pinskia at gcc dot gnu.org
@ 2024-02-23  4:24 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-23  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|pinskia at gcc dot gnu.org         |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Earnshaw from comment #2)
> But this is just BFI, so it's a costing issue.

Fixing that still leaves us with:
Trying 8 -> 15:
    8: zero_extract(r100:DI,0x20,0)=r107:SI#0
      REG_DEAD r107:SI
   15: x0:DI=r100:DI&0xffffffff|r108:SI#0<<0x20
      REG_DEAD r108:SI
      REG_DEAD r100:DI
Failed to match this instruction:
(set (reg/i:DI 0 x0)
    (ior:DI (ashift:DI (subreg:DI (reg:SI 108) 0)
            (const_int 32 [0x20]))
        (zero_extend:DI (reg:SI 107))))

Which is a BFI but there is no pattern to match that.
I will submit my rtx_cost patch still but for now I am not going to add another
pattern

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-23  4:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-15  1:08 [Bug rtl-optimization/107270] New: [10/11/12/13 Regression] return for structure is not as good as before pinskia at gcc dot gnu.org
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

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).