From patchwork Wed Nov 13 13:13:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 1194250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513239-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="e/wz7dve"; dkim-atps=neutral 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 47ClSJ2rD5z9sPZ for ; Thu, 14 Nov 2019 00:14: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 :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=IJupNhI0TQqRYyNcN 0hGc7ghWYHYbYC9OPopClkhjhWDLIVEvyfbH10MpO6oc481S15SK/1F9E7MyCuPx +pKveakBByWBGaszl//94quPNof+Nfqpg3BdNYJHcx91gdXlQxkHzEmArgnEkIgA Kb3Oj4oGyVY5ChYP7tH0yYusAM= 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 :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=nHRVmV5KEskUO5NkhkYvzh/ 3Ud0=; b=e/wz7dveYagKokojHEom7+z53Hn45S/3YuOkcGpRV9Ti6u+CpFZydFn l+HPhgpgtr+KwwP58We4/wsI1cjU5IfW/1TbPyF+SSf/EMkvc0kgckh51MehpIDw YXX+tSvlt4qh8vlFZ9EIuewOREqh05XDTS5PS6WqzeddyRe9RfZQ= Received: (qmail 129704 invoked by alias); 13 Nov 2019 13:13:59 -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 129694 invoked by uid 89); 13 Nov 2019 13:13:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*r:sk:mailout, H*RU:sk:mailout, HX-Spam-Relays-External:sk:mailout X-HELO: mailout01.t-online.de Received: from mailout01.t-online.de (HELO mailout01.t-online.de) (194.25.134.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Nov 2019 13:13:57 +0000 Received: from fwd35.aul.t-online.de (fwd35.aul.t-online.de [172.20.27.145]) by mailout01.t-online.de (Postfix) with SMTP id 010CB42366B3 for ; Wed, 13 Nov 2019 14:13:55 +0100 (CET) Received: from sweetums.local (T5dEo4ZYrhLR3EIT4t9H0vs7DYuCEZ1iLMaYipYc7UUD0O-IiD84vYNW3rCdczLQCI@[84.128.94.135]) by fwd35.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1iUsT3-1hfjGa0; Wed, 13 Nov 2019 14:13:53 +0100 Subject: [PATCH 3/4] Set costs for jumps in combine From: Bernd Schmidt To: GCC Patches References: Openpgp: preference=signencrypt Message-ID: Date: Wed, 13 Nov 2019 14:13:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes The combiner is somewhat strange about how it uses costs. If any of the insns involved in a comparison have a cost of 0, it does not verify that the substitution is cheaper. Also, it does not compute costs for jump insns, so they are always set to zero. As a consequence, any possible substitution is performed if a combination into a jump is possible, which turns out isn't really desirable on m68k with cbranch patterns. This patch simply removes a test for NONJUMP_INSN_P. Bootstrapped and tested on the gcc135 machine (powerpc64le-unknown-linux-gnu). Bernd * combine.c (combine_instructions): Record costs for jumps. diff --git a/gcc/combine.c b/gcc/combine.c index 857ea30dafd..9446d2769ab 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1234,8 +1234,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs) insn); /* Record the current insn_cost of this instruction. */ - if (NONJUMP_INSN_P (insn)) - INSN_COST (insn) = insn_cost (insn, optimize_this_for_speed_p); + INSN_COST (insn) = insn_cost (insn, optimize_this_for_speed_p); if (dump_file) { fprintf (dump_file, "insn_cost %d for ", INSN_COST (insn));