From patchwork Mon Jul 9 21:59:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 169970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 84C452C007C for ; Tue, 10 Jul 2012 08:00:53 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342476054; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=XvzDQUyFmusKsvR5XbMnwY0e1O8=; b=yPqxft1QYbWUbK3 07PmNMH0yU/yElB5Zypiaeh8RrQoUnATeM+YceDpXhLpadoSE8r4BWP36csp6Ag4 1qJyn7jDF269/YClLJjUNQC8Aw8v8YeFkqg/Kgr55AyM34wKobAQ7Y0PP9XBVrOJ DCFsWJoesCrlrgGWpQWKGGp4LtSY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Subject:From:To:Date:In-Reply-To:References:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VI2ILe8tZb+F+ychzx+D6F4b0GiWCbDcJ2vCCt7ZMSWid8UdDvP8B69a1/JVQU sALgONEpx/dvtu4MAFZe10HxqpIjL5nxWSRwkssr3HNy9u53LWpo8gGGbmTguW4P qMyZt+b9oe7FLqExKYLqXg5F1jygpinoYogQfonPElzIw=; Received: (qmail 24327 invoked by alias); 9 Jul 2012 22:00:42 -0000 Received: (qmail 24261 invoked by uid 22791); 9 Jul 2012 22:00:35 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout06.t-online.de (HELO mailout06.t-online.de) (194.25.134.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jul 2012 22:00:14 +0000 Received: from fwd24.aul.t-online.de (fwd24.aul.t-online.de ) by mailout06.t-online.de with smtp id 1SoM04-0003kd-9w; Tue, 10 Jul 2012 00:00:12 +0200 Received: from [192.168.0.100] (X7fG7qZB8hVxPKECDFLoOPnccjxyHCVKzLum7qVK72vzFk0OQlXVCzoj9QpOGCHwK8@[93.218.163.145]) by fwd24.t-online.de with esmtp id 1SoLzy-03G6wi0; Tue, 10 Jul 2012 00:00:06 +0200 Message-ID: <1341871198.2292.27.camel@yam-132-YW-E178-FTW> Subject: [SH] Fix for PR 53886 From: Oleg Endo To: gcc-patches Date: Mon, 09 Jul 2012 23:59:58 +0200 In-Reply-To: <1341860969.2292.17.camel@yam-132-YW-E178-FTW> References: <1341860969.2292.17.camel@yam-132-YW-E178-FTW> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This time with the right patch attached. Sorry. On Mon, 2012-07-09 at 21:09 +0200, Oleg Endo wrote: > Hello, > > The attached patch is a fix for PR 53886, as suggested in the PR. > I've also replaced another unchecked usage of 'PATTERN (NEXT_INSN > (PREV_INSN (insn)))' in 'find_barrier', just in case. > > Tested on rev 189361 with > make -k check RUNTESTFLAGS="--target_board=sh-sim > \{-m2/-ml,-m2/-mb,-m2a/-mb,-m2a-single/-mb,-m4/-ml,-m4/-mb, > -m4-single/-ml,-m4-single/-mb,-m4a-single/-ml,-m4a-single/-mb}" > > and no new failures. > > Cheers, > Oleg > > ChangeLog: > > PR target/53886 > * config/sh/sh.c (sequence_insn_p): New function. > (find_barrier, sh_insn_length_adjustment): Use it. Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 189362) +++ gcc/config/sh/sh.c (working copy) @@ -303,6 +303,7 @@ static int max_mov_insn_displacement (enum machine_mode, bool); static int mov_insn_alignment_mask (enum machine_mode, bool); static HOST_WIDE_INT disp_addr_displacement (rtx); +static bool sequence_insn_p (rtx); static void sh_init_sync_libfuncs (void) ATTRIBUTE_UNUSED; @@ -4794,7 +4795,7 @@ delay slot scheduler. */ if (JUMP_P (from) && !JUMP_TABLE_DATA_P (from) && get_attr_type (from) == TYPE_CBRANCH - && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (from)))) != SEQUENCE) + && ! sequence_insn_p (from)) inc += 2; if (found_si) @@ -9661,6 +9662,26 @@ #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == ';') #endif +static bool +sequence_insn_p (rtx insn) +{ + rtx prev, next, pat; + + prev = PREV_INSN (insn); + if (prev == NULL) + return false; + + next = NEXT_INSN (prev); + if (next == NULL) + return false; + + pat = PATTERN (next); + if (pat == NULL) + return false; + + return GET_CODE (pat) == SEQUENCE; +} + int sh_insn_length_adjustment (rtx insn) { @@ -9671,7 +9692,7 @@ && GET_CODE (PATTERN (insn)) != CLOBBER) || CALL_P (insn) || (JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn))) - && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE + && ! sequence_insn_p (insn) && get_attr_needs_delay_slot (insn) == NEEDS_DELAY_SLOT_YES) return 2; @@ -9680,7 +9701,7 @@ if (sh_cpu_attr == CPU_SH2E && JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn) && get_attr_type (insn) == TYPE_CBRANCH - && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE) + && ! sequence_insn_p (insn)) return 2; /* sh-dsp parallel processing insn take four bytes instead of two. */