http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54602
Oleg Endo <olegendo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-10-09 Ever Confirmed|0 |1 --- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-09 22:52:19 UTC --- The problem is the "*movsi_pop" insn. It prevents delay-slot stuffing of pop insns on everything < SH3. This was probably added to avoid pop insns in interrupt handler functions, which return with 'rte' instead of 'rts', see PR 53689. Adding "&& current_function_interrupt" to the condition of the "*movsi_pop" insn fixes the problem, while maintaining correct code for interrupt handler functions. There is also the following in sh.md: (define_delay (eq_attr "type" "return") [(and (eq_attr "in_delay_slot" "yes") (ior (and (eq_attr "interrupt_function" "no") (eq_attr "type" "!pload,prset")) (and (eq_attr "interrupt_function" "yes") (ior (not (match_test "TARGET_SH3")) (eq_attr "hit_stack" "no") (eq_attr "banked" "no"))))) (nil) (nil)]) which should actually prevent normal movsi pop insn from slipping into the delay slot. I've tapped the "hit_stack" test and it is not invoked for interrupt functions for some reason ....