From patchwork Fri Nov 13 16:02:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 544356 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 068D4141435 for ; Sat, 14 Nov 2015 03:03:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=NcchD9wn; dkim-atps=neutral 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 :content-transfer-encoding; q=dns; s=default; b=p4H/AUDShLTZAi2E M78fQ+DDaG2evREgi3QPWbxZNxZNGWwhr+5nrT9k3eGPPB+vTzJ1Nc5bIu8yPbka cVnbmS/wrjqFpbK20SUeumQb/TzVnnwMxqFzkHanmbiFrBLulu3ls3NcrrGspJP5 pp0DcIRyvJn6saVlVOURj4YGWlA= 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 :content-transfer-encoding; s=default; bh=3kh1SfDgdsARACW6KoDkc3 +2M3Y=; b=NcchD9wn6AgpAY7+9GOgcVNrc8+fFf3iKGEwBEm2XhGxniNsO+MdKt NNmDbSaYjul7NhzxUvj/oj4461MN43YDGnZEHOcZ11ZiBdcC9G9LpCY0gziF+X7+ 0f4zkHWDOa8fzV3Joz9BDh39uDPSZi9cE6XD5XcFnoa0531yidkSw= Received: (qmail 25323 invoked by alias); 13 Nov 2015 16:02:40 -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 25254 invoked by uid 89); 13 Nov 2015 16:02:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Nov 2015 16:02:38 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-35-oNMB1wMORoS6a9FrsEN8Kw-1; Fri, 13 Nov 2015 16:02:32 +0000 Received: from E107166VM ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Nov 2015 16:02:32 +0000 From: "Wilco Dijkstra" To: Subject: [PATCH 3/4][AArch64] Add CCMP to rtx costs Date: Fri, 13 Nov 2015 16:02:31 -0000 Message-ID: <000201d11e2c$b39f2240$1add66c0$@arm.com> MIME-Version: 1.0 X-MC-Unique: oNMB1wMORoS6a9FrsEN8Kw-1 This patch adds support for rtx costing of CCMP. The cost is the same as int/FP compare, however comparisons with zero get a slightly larger cost. This means we prefer emitting compares with zero so they can be merged with ALU operations. OK for commit? ChangeLog: 2015-11-13 Wilco Dijkstra * gcc/config/aarch64/aarch64.c (aarch64_if_then_else_costs): Add support for CCMP costing. --- gcc/config/aarch64/aarch64.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index a224982..b789841 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5638,6 +5638,26 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed) } else if (GET_MODE_CLASS (GET_MODE (inner)) == MODE_CC) { + /* CCMP. */ + if ((GET_CODE (op1) == COMPARE) && CONST_INT_P (op2)) + { + /* Increase cost of CCMP reg, 0, imm, CC to prefer CMP reg, 0. */ + if (XEXP (op1, 1) == const0_rtx) + *cost += 1; + if (speed) + { + machine_mode mode = GET_MODE (XEXP (op1, 0)); + const struct cpu_cost_table *extra_cost + = aarch64_tune_params.insn_extra_cost; + + if (GET_MODE_CLASS (mode) == MODE_INT) + *cost += extra_cost->alu.arith; + else + *cost += extra_cost->fp[mode == DFmode].compare; + } + return true; + } + /* It's a conditional operation based on the status flags, so it must be some flavor of CSEL. */