There are several instruction patterns related to stack pointer operations. These are not quite right:
1) popqi and poph1 patterns use post_inc codes - when in fact there are pre_inc - this could fail if gcc ever used them outside prolog/epilog 2) Stack moves such as push/pop should be placed before mov patterns, to provide best matching. 3)Stack adjustment (SP=SP+c) is matching with *addhi pattern, which causes reloads of output and input. We really want it to match "*addhi3_sp_R_pc2" when offset is small so *addhi3_sp_R_pc2 needs to be placed before *addhi 4)"*addhi3_sp_R_pc2" does not provide full range of optimal adjustment. For example, SP=SP+8 takes 4 instructions using rcall but around 8 using addition through register. This functionality needs extending accordingly as SP=SP+8 is very common. -- Summary: Stack patterns for AVR not optimal Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hutchinsonandy at aim dot com GCC target triplet: avr-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34888