From patchwork Mon Mar 16 12:32:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 45836 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 84B2C21547 for ; Mon, 16 Mar 2015 12:33:32 +0000 (UTC) Received: by lams18 with SMTP id s18sf26488774lam.2 for ; Mon, 16 Mar 2015 05:33:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding:x-original-sender :x-original-authentication-results; bh=TWPImUZ2pPX4C2Tv2ZXCvuu040oSp3/vEtZtNwr9+lE=; b=UVF7v5FCrWEiDW7OmJf/F+Q13pUoa8SiaOVZ+5uvAebCJGU+2HYMjzJDsZRlldjBS/ H9HMrwdnhZhr0h0huFGUOJWm7TuKG2a1GxST2+GJOEFkOZlD6bMi7gmgDiZRwuLJ7aMf vYp1mA8k/0NpgFxO0NN4GUwDVdmxhj41mRcYM6RhSD03OWFWMGDf7zrrtV5f01wRO7Ri nFMF0p7Hc+VCKTnMrWPguQfMH8N3lLGtDEAx58opsn1cXS3YTZVFEpW+Ekx1IXPmOuMp ET/7+htU5lgtxg7N3afkTMHfxXsuZUYsWhfEXBL8OWGidKdL+Df3aLOWUv7kwBmOtLH+ RZkw== X-Gm-Message-State: ALoCoQnRLoAaj7xpKp3w5wYFidFIn5NQorNxHYIIShQsN75cP6/YoYmpDcqQLavKTaPTzHggmxEQ X-Received: by 10.112.120.136 with SMTP id lc8mr6138903lbb.24.1426509211515; Mon, 16 Mar 2015 05:33:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.135 with SMTP id t7ls636044lag.45.gmail; Mon, 16 Mar 2015 05:33:31 -0700 (PDT) X-Received: by 10.152.43.229 with SMTP id z5mr47810949lal.48.1426509211238; Mon, 16 Mar 2015 05:33:31 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com. [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id l8si8015289lag.68.2015.03.16.05.33.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 05:33:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by labjg1 with SMTP id jg1so38315259lab.2 for ; Mon, 16 Mar 2015 05:33:31 -0700 (PDT) X-Received: by 10.112.130.195 with SMTP id og3mr54141004lbb.112.1426509210976; Mon, 16 Mar 2015 05:33:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2550731lbj; Mon, 16 Mar 2015 05:33:29 -0700 (PDT) X-Received: by 10.66.141.11 with SMTP id rk11mr53470886pab.29.1426509208955; Mon, 16 Mar 2015 05:33:28 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id xd14si22272115pac.211.2015.03.16.05.33.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 05:33:28 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-393579-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 92399 invoked by alias); 16 Mar 2015 12:33:14 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 92140 invoked by uid 89); 16 Mar 2015 12:33:14 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from mail-pd0-f180.google.com (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 16 Mar 2015 12:33:10 +0000 Received: by pdnc3 with SMTP id c3so57288323pdn.0 for ; Mon, 16 Mar 2015 05:33:08 -0700 (PDT) X-Received: by 10.66.137.98 with SMTP id qh2mr135775314pab.76.1426509188244; Mon, 16 Mar 2015 05:33:08 -0700 (PDT) Received: from [10.1.1.4] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by mx.google.com with ESMTPSA id s17sm17161170pdn.87.2015.03.16.05.33.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 05:33:07 -0700 (PDT) Message-ID: <5506CD7A.7030109@linaro.org> Date: Mon, 16 Mar 2015 23:32:58 +1100 From: Kugan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Kyrill Tkachov , "gcc-patches@gcc.gnu.org" CC: Marcus Shawcroft , Richard Earnshaw , Jim Wilson Subject: Re: [AArch64][PR65375] Fix RTX cost for vector SET References: <55066BCC.4010900@linaro.org> <5506AA24.3050108@arm.com> In-Reply-To: <5506AA24.3050108@arm.com> X-IsSubscribed: yes X-Original-Sender: kugan.vivekanandarajah@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 >> lower-subreg.c:compute_costs() only cares about the cost of a (set (reg) >> (const_int )) move but I think the intention, at least for now, is to >> return extra_cost->vect.alu for all the vector operations. > > Almost, what we want at the moment is COSTS_N_INSNS (1) + > extra_cost->vect.alu Thanks Kyrill for the review. >> Regression tested on aarch64-linux-gnu with no new regression. Is this >> OK for trunk? > > Are you sure it's a (set (reg) (const_int)) that's being costed here? I > thought for moves into vecto registers it would be a (set (reg) > (const_vector)) which we don't handle in our rtx costs currently. I > think the correct approach would be to extend the aarch64_rtx_costs > switch statement to handle the CONST_VECT case. I believe you can use > aarch64_simd_valid_immediate to check whether x is a valid immediate for > a simd instruction and give it a cost of extra_cost->vect.alu. The logic > should be similar to the CONST_INT case. Sorry about the (set (reg) (const_int)) above. But the actual RTL that is being split at 220r.subreg2 is (insn 11 10 12 2 (set (subreg:V4SF (reg/v:OI 77 [ __o ]) 0) (subreg:V4SF (reg/v:OI 73 [ __o ]) 0)) /home/kugan/work/builds/gcc-fsf-gcc/tools/lib/gcc/aarch64-none-linux-gnu/5.0.0/include/arm_neon.h:22625 800 {*aarch64_simd_movv4sf} (nil)) And also, if we return RTX cost above COSTS_N_INSNS (1), it will be split and it dosent recover from there. Therefore we need something like the below to prevent that happening. / UNITS_PER_WORD; Thanks, Kugan diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index cba3c1a..d5c80f1 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5544,10 +5544,14 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED, /* Fall through. */ case REG: + if (VECTOR_MODE_P (GET_MODE (op0)) && REG_P (op1)) + { + *cost = COSTS_N_INSNS (1); + } /* const0_rtx is in general free, but we will use an instruction to set a register to 0. */ - if (REG_P (op1) || op1 == const0_rtx) - { + 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)