From patchwork Fri Feb 14 07:18:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 320295 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 339E42C00B3 for ; Fri, 14 Feb 2014 18:18:50 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=DM/pVDAmW0qyOnmU/ 4erSJPffIHTdFvTbt9yZmTvkXaNY9YcpPVhY6YjUgv2z5ddwiJp0CJ3dFspGOmdy ksNlz2KBE/1kFuLm0OcTyMt84ldWreaHQw1nT5bt6vIPd1FOafKFFaetUSotcNFL LpeWlaGGm1sT8FwEa85LjDQlEs= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=V54B+YNKxl/Oj9+ZkrE7tUu stVE=; b=jYN8C2CTiOooJmKroriDT+JglhMOnRdNfrLdtLSYjtZzOO4Lagq+8tW Ltmfm2YXkHtJjajyBI0xidjDJf7EY1xBzDVJ0nzL50bzPsTrUHtYwS9hA7W6xr0r 2b38FjSK60ltNzM0/xUkh5zK1f5zbd1Y1mV7a9uB1304QL7h7cSY= Received: (qmail 18155 invoked by alias); 14 Feb 2014 07:18:43 -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 18145 invoked by uid 89); 14 Feb 2014 07:18:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 14 Feb 2014 07:18:41 +0000 Received: by mail-pa0-f44.google.com with SMTP id kq14so11916985pab.31 for ; Thu, 13 Feb 2014 23:18:39 -0800 (PST) X-Received: by 10.68.130.234 with SMTP id oh10mr7161579pbb.136.1392362319239; Thu, 13 Feb 2014 23:18:39 -0800 (PST) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id qs1sm13886361pbb.18.2014.02.13.23.18.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Feb 2014 23:18:37 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id E9346EA00D7; Fri, 14 Feb 2014 17:48:30 +1030 (CST) Date: Fri, 14 Feb 2014 17:48:30 +1030 From: Alan Modra To: Ulrich Weigand Cc: David Edelsohn , GCC Patches , Michael Meissner Subject: Re: [RS6000] power8 internal compiler errors Message-ID: <20140214071830.GR3386@bubble.grove.modra.org> Mail-Followup-To: Ulrich Weigand , David Edelsohn , GCC Patches , Michael Meissner References: <201402121747.s1CHlb7J013413@d06av02.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201402121747.s1CHlb7J013413@d06av02.portsmouth.uk.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On Wed, Feb 12, 2014 at 06:47:37PM +0100, Ulrich Weigand wrote: > Note that find_replacement itself already recurses into both sides > of a PLUS. Thanks, I missed seeing that. I'd analysed the bug and knew what needed doing from past forays into reload, so went looking for ways to get at the reloads, ie. "replacements" at that stage of reload. Lo and behold, there's a function tailor made to do just that! So I plugged in find_replacements() wherever it seemed necessary. > So it might be > easier and cheaper overall to just do a find_replacement within > the PRE_MODIFY clause ... That's a good idea, since PRE_MODIFY doesn't occur that often. Here is the revised patch with your recommendations. Bootstrapped and regression tested powerpc64-linux. PR target/58675 PR target/57935 * config/rs6000/rs6000.c (rs6000_secondary_reload_inner): Use find_replacement on parts of insn rtl that might be reloaded. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 207649) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -16170,7 +16156,7 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); rclass = REGNO_REG_CLASS (regno); - addr = XEXP (mem, 0); + addr = find_replacement (&XEXP (mem, 0)); switch (rclass) { @@ -16181,19 +16167,18 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r if (GET_CODE (addr) == AND) { and_op2 = XEXP (addr, 1); - addr = XEXP (addr, 0); + addr = find_replacement (&XEXP (addr, 0)); } if (GET_CODE (addr) == PRE_MODIFY) { - scratch_or_premodify = XEXP (addr, 0); + scratch_or_premodify = find_replacement (&XEXP (addr, 0)); if (!REG_P (scratch_or_premodify)) rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - if (GET_CODE (XEXP (addr, 1)) != PLUS) + addr = find_replacement (&XEXP (addr, 1)); + if (GET_CODE (addr) != PLUS) rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - - addr = XEXP (addr, 1); } if (GET_CODE (addr) == PLUS @@ -16201,6 +16186,8 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r || !rs6000_legitimate_offset_address_p (PTImode, addr, false, true))) { + /* find_replacement already recurses into both operands of + PLUS so we don't need to call it here. */ addr_op1 = XEXP (addr, 0); addr_op2 = XEXP (addr, 1); if (!legitimate_indirect_address_p (addr_op1, false)) @@ -16276,7 +16263,7 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r || !VECTOR_MEM_ALTIVEC_P (mode))) { and_op2 = XEXP (addr, 1); - addr = XEXP (addr, 0); + addr = find_replacement (&XEXP (addr, 0)); } /* If we aren't using a VSX load, save the PRE_MODIFY register and use it @@ -16288,14 +16275,13 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r || and_op2 != NULL_RTX || !legitimate_indexed_address_p (XEXP (addr, 1), false))) { - scratch_or_premodify = XEXP (addr, 0); + scratch_or_premodify = find_replacement (&XEXP (addr, 0)); if (!legitimate_indirect_address_p (scratch_or_premodify, false)) rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - if (GET_CODE (XEXP (addr, 1)) != PLUS) + addr = find_replacement (&XEXP (addr, 1)); + if (GET_CODE (addr) != PLUS) rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - - addr = XEXP (addr, 1); } if (legitimate_indirect_address_p (addr, false) /* reg */