From patchwork Fri Nov 14 19:19:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 410987 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 B05E81400AB for ; Sat, 15 Nov 2014 06:21:06 +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=Lu27JI3B4uVnQt+XNUc XEGl6mJ7dzFz516wjhZ2OHHxDEvIPTYfv8VaV349We1eBmASHIqhpdDJSZbqXVEa KESsatICQ58eRbJMrne0eycCy3Yc7k53XlcUE4RsNobx0rxOWLYlybqZpqs8e5UU kPPAwiHfutJp6ZvR50KsOUGA= 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=3lBdBrFgzkGomHL8Cazk4bSJ3 BU=; b=NF5FTsWrEmav3Ts/A+4cQUO3nS7kcA1Lc1KoroFZq6+nR/+hrpetNZloo Pl1KUENRHqosfW0Tgq2Mi3yzeMZVfZuABe44t05xCMUw9PkKnEV4OoYcOYwR39PO lq7XYJbcKexCtxz6iHuf/AU/povEJeB1Je80cBiaUqxJ4aDtZM= Received: (qmail 31913 invoked by alias); 14 Nov 2014 19:20:42 -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 31725 invoked by uid 89); 14 Nov 2014 19:20:41 -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:20:39 +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 sAEJKbck011824; Fri, 14 Nov 2014 11:20:37 -0800 Received: (from segher@localhost) by gcc1-power7.osuosl.org (8.14.6/8.14.6/Submit) id sAEJKZil011105; Fri, 14 Nov 2014 11:20:35 -0800 From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PATCH 1/5] combine: more verbose costs output Date: Fri, 14 Nov 2014 11:19:37 -0800 Message-Id: <72beaa68b81b66eb559e2d3fa6635fbbadb786a5.1415984897.git.segher@kernel.crashing.org> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Output the cost calculation always, not only when the costs disallow a combination. Checking if your port has sane costs is much easier this way. Also there is no point in printing full lines at once; debug dumps are never translated, so we can print piece by piece. 2014-11-14 Segher Boessenkool gcc/ * combine.c (combine_validate_cost): Always print the insn costs to the dump file. --- gcc/combine.c | 63 ++++++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/gcc/combine.c b/gcc/combine.c index e240cfb..f7797e7 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -914,48 +914,35 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, rtx_insn *i2, rtx_insn *i3, /* Disallow this combination if both new_cost and old_cost are greater than zero, and new_cost is greater than old cost. */ - if (old_cost > 0 && new_cost > old_cost) - { - if (dump_file) - { - if (i0) - { - fprintf (dump_file, - "rejecting combination of insns %d, %d, %d and %d\n", - INSN_UID (i0), INSN_UID (i1), INSN_UID (i2), - INSN_UID (i3)); - fprintf (dump_file, "original costs %d + %d + %d + %d = %d\n", - i0_cost, i1_cost, i2_cost, i3_cost, old_cost); - } - else if (i1) - { - fprintf (dump_file, - "rejecting combination of insns %d, %d and %d\n", - INSN_UID (i1), INSN_UID (i2), INSN_UID (i3)); - fprintf (dump_file, "original costs %d + %d + %d = %d\n", - i1_cost, i2_cost, i3_cost, old_cost); - } - else - { - fprintf (dump_file, - "rejecting combination of insns %d and %d\n", - INSN_UID (i2), INSN_UID (i3)); - fprintf (dump_file, "original costs %d + %d = %d\n", - i2_cost, i3_cost, old_cost); - } + int reject = old_cost > 0 && new_cost > old_cost; - if (newi2pat) - { - fprintf (dump_file, "replacement costs %d + %d = %d\n", - new_i2_cost, new_i3_cost, new_cost); - } - else - fprintf (dump_file, "replacement cost %d\n", new_cost); - } + if (dump_file) + { + fprintf (dump_file, "%s combination of insns ", + reject ? "rejecting" : "allowing"); + if (i0) + fprintf (dump_file, "%d, ", INSN_UID (i0)); + if (i1) + fprintf (dump_file, "%d, ", INSN_UID (i1)); + fprintf (dump_file, "%d and %d\n", INSN_UID (i2), INSN_UID (i3)); - return false; + fprintf (dump_file, "original costs "); + if (i0) + fprintf (dump_file, "%d + ", i0_cost); + if (i1) + fprintf (dump_file, "%d + ", i1_cost); + fprintf (dump_file, "%d + %d = %d\n", i2_cost, i3_cost, old_cost); + + if (newi2pat) + fprintf (dump_file, "replacement costs %d + %d = %d\n", + new_i2_cost, new_i3_cost, new_cost); + else + fprintf (dump_file, "replacement cost %d\n", new_cost); } + if (reject) + return false; + /* Update the uid_insn_cost array with the replacement costs. */ INSN_COST (i2) = new_i2_cost; INSN_COST (i3) = new_i3_cost;