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