https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116398
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > (insn 6 3 12 2 (set (reg:DI 105 [ dataD.4432 ]) > (sign_extend:DI (reg/v:SI 102 [ dataD.4432 ]))) > "/app/example.cpp":3:12 105 {*extendsidi2_aarch64} > (expr_list:REG_DEAD (reg/v:SI 102 [ dataD.4432 ]) > (nil))) > (insn 12 6 13 2 (set (reg:DI 110 [ _3+8 ]) > (ashiftrt:DI (reg:DI 105 [ dataD.4432 ]) > (const_int 11 [0xb]))) "/app/example.cpp":3:29 755 > {*aarch64_ashr_sisd_or_int_di3} > (nil)) > (insn 13 12 23 2 (set (reg:DI 109 [ _3 ]) > (ashift:DI (reg:DI 105 [ dataD.4432 ]) > (const_int 53 [0x35]))) "/app/example.cpp":3:29 751 > {*aarch64_ashl_sisd_or_int_di3} > (expr_list:REG_DEAD (reg:DI 105 [ dataD.4432 ]) > (nil))) > ... > > Could be just simplified to (ignore the ordering difference): > > (insn 23 13 24 2 (set (reg:DI 109 [ _3+8 ]) > (ashift:DI (subreg:DI (reg:SI 105) 0) > (const_int 53 [0x35]))) "/app/example.cpp":4:1 751 > {*aarch64_ashl_sisd_or_int_di3} > (nil)) > (insn 24 23 19 2 (set (reg:DI 110 [ _3 ]) > (sign_extract:DI (subreg:DI (reg:SI 105) 0) > (const_int 21 [0x15]) > (const_int 11 [0xb]))) "/app/example.cpp":4:1 801 {*extvdi} > (expr_list:REG_DEAD (reg:SI 113) > (nil))) > > Which is what combine did in GCC 14. > > Is this because only combine knows creats sign_extract? But then again why didn't fwprop prop r105=sign_extend(r102) into insn 13? that would have fixed it too. Even if insn 6 and insn 13 could not combine, they could be executed in parrallel.