From patchwork Thu Feb 5 10:29:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 436742 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 197BA14017F for ; Thu, 5 Feb 2015 21:29:38 +1100 (AEDT) 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=Fm6xcUZUNxBa0kLgN NAg2xvUD7Snx12jLTpCmYqmRRQS9KdpSE33/3knwBgp0wWITSNqf6njiUQt9z2wB yRq13pMhvqEn9F5oOKFAd4LQ2pSq21wsDl2vmFvSYsTmYTg4IIoAegeqbr6Oxw9X GA5mN7n0Ik2SmlQSz9cbuGQOIk= 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=u31pI/US0Hg4A9b9TUw/BqW LInA=; b=tvNccv4RzwIyK4HFoNpJuZBo68bsRfjBVSMIFc3JYow3zpQt0X9b/j0 yD9Br6u6vN9d6BG4QbLFUap89pMXK6nh6ilQF8yzMdtKX2cY2xBiep+WYnGlbQm4 bpPypyZZinC4rxSXBE0HCAieoCGTANGAXehCPGj7BAoUnUtgOATc= Received: (qmail 30154 invoked by alias); 5 Feb 2015 10:29:10 -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 30139 invoked by uid 89); 5 Feb 2015 10:29:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f175.google.com Received: from mail-pd0-f175.google.com (HELO mail-pd0-f175.google.com) (209.85.192.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 05 Feb 2015 10:29:08 +0000 Received: by pdbft15 with SMTP id ft15so6992516pdb.11 for ; Thu, 05 Feb 2015 02:29:07 -0800 (PST) X-Received: by 10.66.254.68 with SMTP id ag4mr4519798pad.39.1423132146905; Thu, 05 Feb 2015 02:29:06 -0800 (PST) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by mx.google.com with ESMTPSA id ej7sm4676865pac.21.2015.02.05.02.29.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 02:29:06 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 9C24CEA0185; Thu, 5 Feb 2015 20:59:01 +1030 (ACDT) Date: Thu, 5 Feb 2015 20:59:01 +1030 From: Alan Modra To: Jakub Jelinek Cc: David Edelsohn , GCC Patches Subject: Re: Fix PR64876, regressions in powerpc64 Go testsuite Message-ID: <20150205102901.GU14796@bubble.grove.modra.org> Mail-Followup-To: Jakub Jelinek , David Edelsohn , GCC Patches References: <20150203135735.GJ14796@bubble.grove.modra.org> <20150204001605.GL14796@bubble.grove.modra.org> <20150205033954.GR14796@bubble.grove.modra.org> <20150205071225.GD1746@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150205071225.GD1746@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Thu, Feb 05, 2015 at 08:12:25AM +0100, Jakub Jelinek wrote: > On Thu, Feb 05, 2015 at 02:09:54PM +1030, Alan Modra wrote: > > Jakub, was your suggestion to use get_last_insn_anywhere() based on > > not wanting to expose details that should be internal to > > emit-rtl.[ch]? > > Yes. But if it doesn't work for what you want, either add a new accessor or > use it directly. Thanks, I'll use it directly now and have a patch in the works to tidy m32c.c and rs6000.c. David, here is the revised patch. Bootstrapped etc. powerpc64-linux, and fixes a few more Go testsuite failures compared to the last one.. PR target/64876 * config/rs6000/rs6000.c (chain_already_loaded): New function. (rs6000_call_aix): Use it. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 220433) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -32919,7 +32919,29 @@ rs6000_legitimate_constant_p (machine_mode mode, r } +/* Return TRUE iff the sequence ending in LAST sets the static chain. */ +static bool +chain_already_loaded (rtx_insn *last) +{ + for (; last != NULL; last = PREV_INSN (last)) + { + if (NONJUMP_INSN_P (last)) + { + rtx patt = PATTERN (last); + + if (GET_CODE (patt) == SET) + { + rtx lhs = XEXP (patt, 0); + + if (REG_P (lhs) && REGNO (lhs) == STATIC_CHAIN_REGNUM) + return true; + } + } + } + return false; +} + /* Expand code to perform a call under the AIX or ELFv2 ABI. */ void @@ -33002,7 +33024,9 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx fla originally direct, the 3rd word has not been written since no trampoline has been built, so we ought not to load it, lest we override a static chain value. */ - if (!direct_call_p && TARGET_POINTERS_TO_NESTED_FUNCTIONS) + if (!direct_call_p + && TARGET_POINTERS_TO_NESTED_FUNCTIONS + && !chain_already_loaded (crtl->emit.sequence_stack->last)) { rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode));