https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114510
Bug ID: 114510 Summary: [14 Regression] missed proping of multiply by 2 into address of load/stores 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 Target Milestone: --- Target: aarch64 Take: ``` int f(short *a, short *c, __SIZE_TYPE__ b) { return a[b] + c[b]; } int f1(short *a, short *c, int b) { return a[b] + c[b]; } ``` These used to produce in GCC 13: ``` f: ldrsh w3, [x0, x2, lsl 1] ldrsh w0, [x1, x2, lsl 1] add w0, w3, w0 ret f1: ldrsh w3, [x0, w2, sxtw 1] ldrsh w0, [x1, w2, sxtw 1] add w0, w3, w0 ret ``` But now f produces as of r14-9692-g839bc42772ba7a (but it looks like the change happened much earlier): ``` f: lsl x2, x2, 1 ldrsh w3, [x0, x2] ldrsh w0, [x1, x2] add w0, w3, w0 ```