https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113613
Bug ID: 113613
Summary: [14 Regression] Missing ldp/stp optimization sometimes
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
CC: acoplan at gcc dot gnu.org
Target Milestone: ---
Target: aarch64-*-*
Take:
```
typedef float __attribute__((vector_size(8))) v2sf;
v2sf a[4];
v2sf b[4];
void f()
{
b[0] += a[0];
b[1] += a[1];
}
```
With -O3 on the trunk we get:
```
f:
adrp x1, .LANCHOR0
add x0, x1, :lo12:.LANCHOR0
ldr d31, [x1, #:lo12:.LANCHOR0]
ldr d30, [x0, 32]
fadd v30.2s, v31.2s, v30.2s
ldr d31, [x0, 8]
str d30, [x1, #:lo12:.LANCHOR0]
ldr d30, [x0, 40]
fadd v30.2s, v31.2s, v30.2s
str d30, [x0, 8]
ret
```
But in GCC 13 we got:
```
f:
adrp x1, .LANCHOR0
add x0, x1, :lo12:.LANCHOR0
ldp d1, d0, [x0]
ldp d3, d2, [x0, 32]
fadd v1.2s, v1.2s, v3.2s
fadd v0.2s, v0.2s, v2.2s
stp d1, d0, [x0]
ret
```