From patchwork Thu Oct 29 14:14:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 55777 Delivered-To: patch@linaro.org Received: by 10.202.175.130 with SMTP id y124csp447201oie; Thu, 29 Oct 2015 07:15:24 -0700 (PDT) X-Received: by 10.66.232.5 with SMTP id tk5mr2208842pac.106.1446128124545; Thu, 29 Oct 2015 07:15:24 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id xm6si2773724pab.219.2015.10.29.07.15.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Oct 2015 07:15:24 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-411950-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-return-411950-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-411950-patch=linaro.org@gcc.gnu.org; dkim=pass header.i=@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=hZF5ENifPIAipvSTf n4PtyHS8vn4tKLYN+4BzOe5/fZodwBjuo0kVzCAQRvbs9sGgd/dtZHtIU/iq3SBq RRNNRBIjYh0cAT8GT9Jrii1IdvfP3idIzR9Xs2Q2XJJn9tEE08uzwnJdEdw+IC0j 69uiLFWDh05YveHYtbcmF+X+s4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=lK9OJ2BmIx+FOiTVbSD6WRC PSIw=; b=q9ptBCWT3gu15P3S3okBt/2E0fVgICBcWUqn1/M1w1b8bWiR0zNw/T+ 671GsFIt/lkqgWsqcXj395wWQwvE42uqW2mWiuZMdWqeMeL7N6VF7ucGvtXO/r9W JGL5yaSu7NTqUfj/jiWZhqAJ09jBP50y6U+LQ9OSZO9a8NntB/w8= Received: (qmail 961 invoked by alias); 29 Oct 2015 14:15:07 -0000 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 Received: (qmail 948 invoked by uid 89); 29 Oct 2015 14:15:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Oct 2015 14:15:06 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-16-tVIureb-TLS9W243MlmLyg-1; Thu, 29 Oct 2015 14:14:57 +0000 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 29 Oct 2015 14:14:54 +0000 Message-ID: <563229DD.8080900@arm.com> Date: Thu, 29 Oct 2015 14:14:53 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Marcus Shawcroft CC: GCC Patches , Marcus Shawcroft , Ramana Radhakrishnan , Richard Earnshaw , James Greenhalgh Subject: Re: [PATCH][ARM/AArch64] PR 68088: Fix RTL checking ICE due to subregs inside accumulator forwarding check References: <56309E44.8070100@arm.com> <5632241D.2040704@arm.com> In-Reply-To: X-MC-Unique: tVIureb-TLS9W243MlmLyg-1 X-IsSubscribed: yes On 29/10/15 14:00, Marcus Shawcroft wrote: > On 29 October 2015 at 13:50, Kyrill Tkachov wrote: > >>>> Ok for trunk? >>> rtl.h exposes reg_or_subregno() already doesn't that do what we need here? >> >> reg_or_subregno assumes that what it's passed is REG or a SUBREG. >> It will ICE on any other rtx. Here I want to strip the subreg if it is >> a subreg, but leave it as it is otherwise. > OK, I follow. > >>> The test case is not aarch64 specific therefore I think convention is >>> that it should go into a generic directory. >> >> Ok, I'll put it in gcc.dg/ > > OK with the test case moved. Thanks /Marcus > Thanks, but I'd like to do a slight respin. The testcase is moved to gcc.dg but I also avoid creating the new helper function and just do the SUBREG extraction once at the very end. This makes the patch smaller. Since you're ok with the approach and this revision is logically equivalent, I just need an ok from an arm perspective. Thanks, Kyrill 2015-10-29 Kyrylo Tkachov PR target/68088 * config/arm/aarch-common.c (aarch_accumulator_forwarding): Strip subregs from accumulator and make sure it's a register. 2015-10-29 Kyrylo Tkachov PR target/68088 * gcc.dg/pr68088_1.c: New test. commit aa4df340968b330544edbbb8ea706f2d56011381 Author: Kyrylo Tkachov Date: Tue Oct 27 11:42:19 2015 +0000 [ARM/AArch64] PR 68088: Fix RTL checking ICE due to subregs inside accumulator forwarding check diff --git a/gcc/config/arm/aarch-common.c b/gcc/config/arm/aarch-common.c index a940a02..e6668d5 100644 --- a/gcc/config/arm/aarch-common.c +++ b/gcc/config/arm/aarch-common.c @@ -460,6 +460,12 @@ aarch_accumulator_forwarding (rtx_insn *producer, rtx_insn *consumer) return 0; } + if (GET_CODE (accumulator) == SUBREG) + accumulator = SUBREG_REG (accumulator); + + if (!REG_P (accumulator)) + return 0; + return (REGNO (dest) == REGNO (accumulator)); } diff --git a/gcc/testsuite/gcc.dg/pr68088_1.c b/gcc/testsuite/gcc.dg/pr68088_1.c new file mode 100644 index 0000000..49c6aa1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr68088_1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void bar (unsigned long); + +void +foo (unsigned long aul, unsigned m, unsigned i) +{ + while (1) + { + aul += i; + i = aul % m; + bar (aul); + } +}