From patchwork Mon Jul 9 19:09:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 169924 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 383CF2C01B4 for ; Tue, 10 Jul 2012 05:10:05 +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=1342465806; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Date:Content-Type:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=oPtz8VMMYLOEhZNndgO4 NVP17yA=; b=f0dH0QWDDc2ezoMaRpnq5fAA4UI1htCplX9PZU+GUUDDZ0sl/suy HVK/f750JvkUYBQHPX6Kvo1w9SvJQKCtVh18q81hZCx9vtCA/1vbVleyiVIIgdkK B7cArUkSe6/N74bcdNCRO/lTZl+b1IbcdLQYctzUEwDMngGcT0im/po= 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:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iqTcwVk20jNDt4ivCPamTCniKKOsz0EaO6bYQuNMTXDLDBDoJ1dE1fLJz0tDkz ID0CguoAoLoEpU0QWVWqJn4hMetNmUwMKyuYbngd7DpV0hb9VnvZwdcT5WoGbWt8 BvNln4qxrVjXsI4Xv4B0qo8KT7werG6Veqk5LgQbjbAuo=; Received: (qmail 9603 invoked by alias); 9 Jul 2012 19:10:02 -0000 Received: (qmail 9566 invoked by uid 22791); 9 Jul 2012 19:10:00 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout10.t-online.de (HELO mailout10.t-online.de) (194.25.134.21) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jul 2012 19:09:47 +0000 Received: from fwd22.aul.t-online.de (fwd22.aul.t-online.de ) by mailout10.t-online.de with smtp id 1SoJL6-0006kL-NO; Mon, 09 Jul 2012 21:09:44 +0200 Received: from [192.168.0.100] (bjFRk2ZeZhAotIXIAKUFtZK0Z0vn1+FDhvn8yw0G4ay8QzILVoMYJLfpVLRpGQAZ78@[93.218.163.145]) by fwd22.t-online.de with esmtp id 1SoJKy-0zs0G00; Mon, 9 Jul 2012 21:09:36 +0200 Message-ID: <1341860969.2292.17.camel@yam-132-YW-E178-FTW> Subject: [SH] Fix for PR 53886 From: Oleg Endo To: gcc-patches Date: Mon, 09 Jul 2012 21:09:29 +0200 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 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. */