From patchwork Fri Oct 27 13:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 117353 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp775817qgn; Fri, 27 Oct 2017 06:30:52 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qb66N4u5V/1XF2BTZ9n93hmEBDdn63nthxTm0SU/s/xdeq5xSjCYXL3FpsCeoRaANOYEW0 X-Received: by 10.101.74.199 with SMTP id c7mr289080pgu.169.1509111052907; Fri, 27 Oct 2017 06:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509111052; cv=none; d=google.com; s=arc-20160816; b=SYPR1f4i7oFtT5RzyTbXsDKeHHK1vcoSM7fkQ5u6XqXvl3Q6/LFBEeU180ggmBlqFQ /7VTUx384hpuxsexIN9WJ45avi62fqJODCvjpiTnbTK9Scle7Era3uBrowEGEyBU7jSL nuugc7zkZIKbb33Axq33sLs7A23eFVaXsWmOdC9LWuK9LfoxbJLfisbH5pOdNeDUJtNv KOgmmzisTvU0AQlOAP0tMczPC9XCevOpx+hNIEq+8QqMzGAZQ5TOMl8r3TFgQQX7D+kN MGJxdbx1MEDEB6PozNj0TRaj+P6zJEz1a8eC+8NoFz2Dpzea/PbKqxG3vca8aKWS15eu XUtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=yECtvh136sPPWafDNl4OjV6JhczP502F+ZmY52+J6Ro=; b=YojPU38alHicwSUW3WfWSh6VHlk5YaT4sLeY0OW3295Sg57KJvivwh3q9ORWZoLDI8 b6f0N9DI+ZUK9njcS5YMjMtEui+6WuTVLQeGtxokdkuPCs2g87FbTFVmJOYAwEOiA2sX DE27Drh3rOWnN0Eg1lD6Y6XgBc9w9C1AfTA1vbMRr76X4+ncXmpZvdVIGTvcXn+egfEc sBZ6Uw6u4BPKs6GSHE8bKB5SkcNg2pec4gyB4wfZSLklUzzLYpk30z8y+vdr81AzAgKf OiysLh3qB3+LgZTrJYNiPgCBYIpqQ8dQmt9ZMY5VcSNV+OMk1Wj7TNzRsr+MH7zmbHXu hHdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Cnmf1zcJ; spf=pass (google.com: domain of gcc-patches-return-465349-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-465349-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q77si5393841pfg.418.2017.10.27.06.30.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 06:30:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-465349-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Cnmf1zcJ; spf=pass (google.com: domain of gcc-patches-return-465349-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-465349-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=vKFRm5HFtfL7UOgb l13A/7ARteIwqr0AI+M4jsjILqePA4VgZeBW9h4nwU8EK9CoMbOdcZHAAtcviGPj D6q1YG/zOk7PiA6wEwLF2kF712phIXZSppPzl+7oGdrmllSGIg//2D7lZM4shqiX hNA2EooV1I7G+mX2E0/KYk+1PEI= 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:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=6Jl3l8Zn9PdyV38pT1/wuv BjRuw=; b=Cnmf1zcJgRbftZ9wHo+v+TSCvEwyBPq50oRAtziFwaZjFS+n9XCnjx q6xJAMmgflL+Y4pBmlBMt2gtpjKEjd4GoOuJuWZY6UOibxLozzuIv0OaC/u5szGM p4nSTG54w91HJ18CuPjLCxLkB0Omo7qPW9NgPWtyxAHL4Uf87BZqs= Received: (qmail 66625 invoked by alias); 27 Oct 2017 13:30:39 -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 66153 invoked by uid 89); 27 Oct 2017 13:30:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f177.google.com Received: from mail-wr0-f177.google.com (HELO mail-wr0-f177.google.com) (209.85.128.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Oct 2017 13:30:23 +0000 Received: by mail-wr0-f177.google.com with SMTP id w105so6198038wrc.0 for ; Fri, 27 Oct 2017 06:30:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version; bh=yECtvh136sPPWafDNl4OjV6JhczP502F+ZmY52+J6Ro=; b=bhZUL3szre+VR3NL+GeuVtN7du1M22GFbCN3ai8cO3lKAU9LOlUy7uj3YU3B4JqTJ+ qJN088AImQd4lwfPySac5PZHQ9adOzbaJkeryr0ARJgeGaIPdMHuh4MzGjgXtXNmq+ME XyId39q61DoSNvKQ9JDBsoi8+8B8l83TUWeJe5leZnkDo2MX11DXRenjDGqEkC1Y9EZj 9I+LjGZVWZneSho90uphAuZXqE0zrP+3eXMoDRnq7BLJo/3eapx6F6aMjs/JpxoAmD/k OkbTUT1kK/cg4KSB+8hZTaWSo6CiQj9yH5iUcjbCNfCrFyd33yG7VsdjuKe5+zZZ0SIs cTKA== X-Gm-Message-State: AMCzsaVMPLdAppnNpy3XbHoDOHl8T3m48hCxeFzpQq5ACppHNP1xzOVn +QgRZrMDXe3DAmT8FcRFx7W9sCrmFT4= X-Received: by 10.223.197.141 with SMTP id m13mr473157wrg.203.1509111021538; Fri, 27 Oct 2017 06:30:21 -0700 (PDT) Received: from localhost (188.29.164.51.threembb.co.uk. [188.29.164.51]) by smtp.gmail.com with ESMTPSA id p128sm1454273wmb.1.2017.10.27.06.30.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Oct 2017 06:30:20 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.earnshaw@arm.com, james.greenhalgh@arm.com, marcus.shawcroft@arm.com, richard.sandiford@linaro.org Cc: richard.earnshaw@arm.com, james.greenhalgh@arm.com, marcus.shawcroft@arm.com Subject: [10/nn] [AArch64] Minor rtx costs tweak References: <873764d8y3.fsf@linaro.org> Date: Fri, 27 Oct 2017 14:30:18 +0100 In-Reply-To: <873764d8y3.fsf@linaro.org> (Richard Sandiford's message of "Fri, 27 Oct 2017 14:19:48 +0100") Message-ID: <87she4afbp.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 aarch64_rtx_costs uses the number of registers in a mode as the basis of SET costs. This patch makes it get the number of registers from aarch64_hard_regno_nregs rather than repeating the calcalation inline. Handling SVE modes in aarch64_hard_regno_nregs is then enough to get the correct SET cost as well. 2017-10-27 Richard Sandiford Alan Hayward David Sherwood gcc/ * config/aarch64/aarch64.c (aarch64_rtx_costs): Use aarch64_hard_regno_nregs to get the number of registers in a mode. Reviewed-By: James Greenhalgh Index: gcc/config/aarch64/aarch64.c =================================================================== --- gcc/config/aarch64/aarch64.c 2017-10-27 14:12:11.045026014 +0100 +++ gcc/config/aarch64/aarch64.c 2017-10-27 14:12:14.533257115 +0100 @@ -7200,18 +7200,16 @@ aarch64_rtx_costs (rtx x, machine_mode m /* The cost is one per vector-register copied. */ if (VECTOR_MODE_P (GET_MODE (op0)) && REG_P (op1)) { - int n_minus_1 = (GET_MODE_SIZE (GET_MODE (op0)) - 1) - / GET_MODE_SIZE (V4SImode); - *cost = COSTS_N_INSNS (n_minus_1 + 1); + int nregs = aarch64_hard_regno_nregs (V0_REGNUM, GET_MODE (op0)); + *cost = COSTS_N_INSNS (nregs); } /* const0_rtx is in general free, but we will use an instruction to set a register to 0. */ else if (REG_P (op1) || op1 == const0_rtx) { /* The cost is 1 per register copied. */ - int n_minus_1 = (GET_MODE_SIZE (GET_MODE (op0)) - 1) - / UNITS_PER_WORD; - *cost = COSTS_N_INSNS (n_minus_1 + 1); + int nregs = aarch64_hard_regno_nregs (R0_REGNUM, GET_MODE (op0)); + *cost = COSTS_N_INSNS (nregs); } else /* Cost is just the cost of the RHS of the set. */