https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118648
Bug ID: 118648 Summary: (sign_extend:di (ashiftrt:si reg CST)) is not turning into (sign_extract:di (subreg (reg) CST' CST') Product: gcc Version: 15.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: ``` void g(long *a, int t) { a[1] = t >> 11; } ``` Currently this produces: ``` g: asr w1, w1, 11 sxtw x1, w1 str x1, [x0, 8] ret ``` But GCC should be able to produce (like LLVM does): ``` g: sbfx x1, x1, #11, #21 str x1, [x0, #8] ret ``` Noticed on accident while looking into PR 116398.