From patchwork Mon Jan 27 15:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1229895 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-518306-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=k1wO9T7c; 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 485tZg28njz9sRR for ; Tue, 28 Jan 2020 02:14:33 +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:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=gprWyGMv0EZ6mKW0Al/vJ+RedyZjSeHZiemH6MhRoAT/QD1Dlcw/b r5SOnTDHkSggGAC007IUpU09ljihopi5vjTEmrl85mchFE/oYf/f1VIrSIY/LjjM KwAszKmolKvIwnI0hs65I+jJR8uTEhB1oKeLWbi7A2G691UwLzapS0= 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:subject:date:message-id:mime-version:content-type; s= default; bh=+4Afq9UEc0fKkVQ1HL3wUMGfyuc=; b=k1wO9T7cTYbi9MxDhshm CMXwtbtlJdtRF/gnSX2DS485thd9l8GDlr1uDmN/uuogr7Q2Us3E27Ev8GSjx05m IH9x+7KsA9eGyn3DA1oB+2qMjb+nVASsuK/b9TxsnyxPD95P5Gz/qChMAb/yWIX1 TgcWCZNMeya/Juvr7oWkia4= Received: (qmail 58543 invoked by alias); 27 Jan 2020 15:14:25 -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 56297 invoked by uid 89); 27 Jan 2020 15:14:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Jan 2020 15:14:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5385831B for ; Mon, 27 Jan 2020 07:14:22 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F10893F67D for ; Mon, 27 Jan 2020 07:14:21 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [COMMITTED] aarch64: Fix failure in cmpimm_branch_1.c Date: Mon, 27 Jan 2020 15:14:20 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes gcc.target/aarch64/cmpimm_branch_1.c started failing after Bernd's fix to make combine take the costs of jumps into account (g:391500af1932e696a007). This is because the rtx costs of *compare_condjump were higher than the costs of the instructions it combines. Tested on aarch64-linux-gnu & pushed. Richard 2020-01-27 Richard Sandiford gcc/ * config/aarch64/aarch64.c (aarch64_if_then_else_costs): Match jump conditions for *compare_condjump. --- gcc/config/aarch64/aarch64.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 3437fff6811..11197bd033e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -11020,6 +11020,8 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed) rtx inner; rtx comparator; enum rtx_code cmpcode; + const struct cpu_cost_table *extra_cost + = aarch64_tune_params.insn_extra_cost; if (COMPARISON_P (op0)) { @@ -11054,8 +11056,17 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed) /* CBZ/CBNZ. */ *cost += rtx_cost (inner, VOIDmode, cmpcode, 0, speed); - return true; - } + return true; + } + if (register_operand (inner, VOIDmode) + && aarch64_imm24 (comparator, VOIDmode)) + { + /* SUB and SUBS. */ + *cost += COSTS_N_INSNS (2); + if (speed) + *cost += extra_cost->alu.arith * 2; + return true; + } } else if (cmpcode == LT || cmpcode == GE) {