From patchwork Fri Nov 14 19:19:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 410990 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 15FA614003E for ; Sat, 15 Nov 2014 06:21:52 +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:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=NDsTWsOPZZxRTfFlUYI vTRw0nS1KdOZgvPstW5acy9Y0bP6T9bEXCYMahuyylLf+GeTWWdPSU3GV5QyrN4i V+ECGMYJxuA2lWyMadW2UlqfVGUGlujNNKVv3fwWI9hDT+SkaTT7dEPSJNHWFsdb 88Vza1VOcBTm/bKuyHcnHU+8= 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:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; s=default; bh=TQEX/H/tY5JW6+558jTQXN8KB rc=; b=uTV6rFbY6zfjCZrGz8CgakyQVRaxs7mSIZR7tg0vr5tta9veOaeDIVwv/ Vxrvi2DFPyH7yXEXPWqHpZt5euPUa+0IqKKQF1dOF0TT8lbEecsrV6EZyr/Z9FvT 3zlburV/A9wCfeTX9rnKdd3vEqXoe4QrTiEwHb18TAwO9MwMcg= Received: (qmail 5372 invoked by alias); 14 Nov 2014 19:21: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 5309 invoked by uid 89); 14 Nov 2014 19:21:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 14 Nov 2014 19:21:40 +0000 Received: from gcc1-power7.osuosl.org (localhost [127.0.0.1]) by gcc1-power7.osuosl.org (8.14.6/8.14.6) with ESMTP id sAEJLcQZ026810; Fri, 14 Nov 2014 11:21:38 -0800 Received: (from segher@localhost) by gcc1-power7.osuosl.org (8.14.6/8.14.6/Submit) id sAEJLc89026801; Fri, 14 Nov 2014 11:21:38 -0800 From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PATCH 4/5] combine: distribute_log_links for PARALLELs of SETs Date: Fri, 14 Nov 2014 11:19:40 -0800 Message-Id: <07a14f524da96447dadd570ebf7ee568627aa611.1415984897.git.segher@kernel.crashing.org> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Now that LOG_LINKS are per regno, we can distribute them on PARALLELs just fine. Do so. This makes PARALLELs not lose their LOG_LINKS early when e.g. a trivial reg-reg move is combined, so that they can be used in more useful combinations as well. 2014-11-14 Segher Boessenkool gcc/ * combine.c (distribute_links): Handle multiple SETs. --- gcc/combine.c | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/gcc/combine.c b/gcc/combine.c index cf184db..8c7f052 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -13832,24 +13832,46 @@ distribute_links (struct insn_link *links) next_link = link->next; - /* If the insn that this link points to is a NOTE or isn't a single - set, ignore it. In the latter case, it isn't clear what we - can do other than ignore the link, since we can't tell which - register it was for. Such links wouldn't be used by combine - anyway. - - It is not possible for the destination of the target of the link to - have been changed by combine. The only potential of this is if we - replace I3, I2, and I1 by I3 and I2. But in that case the - destination of I2 also remains unchanged. */ - - if (NOTE_P (link->insn) - || (set = single_set (link->insn)) == 0) + /* If the insn that this link points to is a NOTE, ignore it. */ + if (NOTE_P (link->insn)) + continue; + + set = 0; + rtx pat = PATTERN (link->insn); + if (GET_CODE (pat) == SET) + set = pat; + else if (GET_CODE (pat) == PARALLEL) + { + int i; + for (i = 0; i < XVECLEN (pat, 0); i++) + { + set = XVECEXP (pat, 0, i); + if (GET_CODE (set) != SET) + continue; + + reg = SET_DEST (set); + while (GET_CODE (reg) == ZERO_EXTRACT + || GET_CODE (reg) == STRICT_LOW_PART + || GET_CODE (reg) == SUBREG) + reg = XEXP (reg, 0); + + if (!REG_P (reg)) + continue; + + if (REGNO (reg) == link->regno) + break; + } + if (i == XVECLEN (pat, 0)) + continue; + } + else continue; reg = SET_DEST (set); - while (GET_CODE (reg) == SUBREG || GET_CODE (reg) == ZERO_EXTRACT - || GET_CODE (reg) == STRICT_LOW_PART) + + while (GET_CODE (reg) == ZERO_EXTRACT + || GET_CODE (reg) == STRICT_LOW_PART + || GET_CODE (reg) == SUBREG) reg = XEXP (reg, 0); /* A LOG_LINK is defined as being placed on the first insn that uses