https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117726
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Georg-Johann Lay <g...@gcc.gnu.org>: https://gcc.gnu.org/g:d833114c5f8816dcddfd84a9c64e87c0eed46fe2 commit r15-5800-gd833114c5f8816dcddfd84a9c64e87c0eed46fe2 Author: Georg-Johann Lay <a...@gjlay.de> Date: Fri Nov 29 18:08:20 2024 +0100 AVR: target/117726 - Better optimize shifts. This patch splits 2-byte and 3-byte shifts after reload into a 3-operand byte shift and a residual 2-operand shift. The "2op" shift insn alternatives are not needed and removed because all shift insn already have a "r,0,n" alternative that does the job. PR target/117726 gcc/ * config/avr/avr-passes.cc (avr_shift_is_3op, avr_emit_shift): Also handle 2-byte and 3-byte shifts. (avr_split_shift4, avr_split_shift3, avr_split_shift2): New local helper functions. (avr_split_shift): Use them. * config/avr/avr-passes.def (avr_pass_split_after_peephole2): Adjust comments. * config/avr/avr.cc (avr_out_ashlpsi3, avr_out_ashrpsi3) (avr_out_lshrpsi3): Support offset 15. (ashrhi3_out): Support offset 7 as 3-op. (ashrsi3_out): Support offset 15. (avr_rtx_costs_1): Adjust shift costs. * config/avr/avr.md (2op): Remove attribute value and all such insn alternatives. (ashlhi3, *ashlhi3, *ashlhi3_const): Add 3-op alternatives like C2l. (ashrhi3, *ashrhi3, *ashrhi3_const): Add 3-op alternatives like C2a. (lshrhi3, *lshrhi3, *lshrhi3_const): Add 3-op alternatives like C2r. (*ashlpsi3_split, *ashlpsi3): Add 3-op alternatives C15 and C3l. (*ashrpsi3_split, *ashrpsi3): Add 3-op alternatives C15 and C3r. (*lshrpsi3_split, *lshrpsi3): Add 3-op alternatives C15 and C3r. (ashlsi3, *ashlsi3, *ashlsi3_const): Remove "2op" alternative. (ashrsi3, *ashrsi3, *ashrsi3_const): Same. (lshrsi3, *lshrsi3, *lshrsi3_const): Same. (constr_split_suffix): Code attr morphed from constr_split_shift4. * config/avr/constraints.md (C2a, C2r, C2l) (C3a, C3r, C3l): New constraints. * doc/invoke.texi (AVR Options) <-msplit-bit-shift>: Adjust doc.