From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24638 invoked by alias); 9 Oct 2012 22:52:36 -0000 Received: (qmail 24577 invoked by uid 48); 9 Oct 2012 22:52:20 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54602] [SH] Register pop insn not put in rts delay slot Date: Tue, 09 Oct 2012 22:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg00893.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54602 Oleg Endo changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-10-09 Ever Confirmed|0 |1 --- Comment #1 from Oleg Endo 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 ....