Message ID | 5d0b68da-7198-5cda-df42-3cb3a168ce89@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB4A1385801E for <patchwork@sourceware.org>; Wed, 29 Sep 2021 08:32:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB4A1385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632904379; bh=kQxJNgtlKCF2YhgxwSEeEdyad9FuI2ZZHoLlzNWzdR4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=YPPav6BetvRPVlJgoZTr60u+RjOD2cxScfrREjrZaMFzQfBzWwtZms9G5uY/7Qbbo oWUogWTJKzWnah1e30kH4kCOc0soZwo/97ZmEy090ui4/Nab+a30wdYNGcdiWEqTt9 POos7jOB8ATfOAO5fIOaW31PG4Pn+iaysCWkX/uQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 2941F3858D35 for <gcc-patches@gcc.gnu.org>; Wed, 29 Sep 2021 08:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2941F3858D35 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18T7gUfN022736; Wed, 29 Sep 2021 04:32:28 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bckyv92pv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Sep 2021 04:32:28 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18T8Vwfo002691; Wed, 29 Sep 2021 08:32:26 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3b9uda5h8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Sep 2021 08:32:26 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18T8WMT741943402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Sep 2021 08:32:22 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E15CA4067; Wed, 29 Sep 2021 08:32:22 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E1E6A4065; Wed, 29 Sep 2021 08:32:21 +0000 (GMT) Received: from [9.200.100.251] (unknown [9.200.100.251]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Sep 2021 08:32:21 +0000 (GMT) To: gcc-patches <gcc-patches@gcc.gnu.org> Subject: [PATCH, rs6000] punish reload of lfiwzx when loading an int variable [PR102169, PR102146] Message-ID: <5d0b68da-7198-5cda-df42-3cb3a168ce89@linux.ibm.com> Date: Wed, 29 Sep 2021 16:32:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 8SVRPuYCpGjUVvDB5biWGTIYeMQfffVO X-Proofpoint-GUID: 8SVRPuYCpGjUVvDB5biWGTIYeMQfffVO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-29_02,2021-09-28_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109290050 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: HAO CHEN GUI via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: HAO CHEN GUI <guihaoc@linux.ibm.com> Cc: Bill Schmidt <wschmidt@linux.ibm.com>, Segher Boessenkool <segher@kernel.crashing.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[rs6000] punish reload of lfiwzx when loading an int variable [PR102169, PR102146]
|
|
Commit Message
HAO CHEN GUI
Sept. 29, 2021, 8:32 a.m. UTC
Hi, The patch punishes reload of alternative pair of "d, Z" for movsi_internal1. The reload occurs if 'Z' doesn't match and generates an additional insn. So the memory reload should be punished. Bootstrapped and tested on powerpc64le-linux with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot. ChangeLog 2021-09-29 Haochen Gui <guihaoc@linux.ibm.com> gcc/ * gcc/config/rs6000/rs6000.md (movsi_internal1): disparages slightly the alternative 'Z' of "lfiwzx" when reload is needed. patch.diff
Comments
Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580479.html Thanks On 29/9/2021 下午 4:32, HAO CHEN GUI wrote: > Hi, > > The patch punishes reload of alternative pair of "d, Z" for movsi_internal1. The reload occurs if 'Z' doesn't match and generates an additional insn. So the memory reload should be punished. > > Bootstrapped and tested on powerpc64le-linux with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot. > > > ChangeLog > > 2021-09-29 Haochen Gui <guihaoc@linux.ibm.com> > > gcc/ > * gcc/config/rs6000/rs6000.md (movsi_internal1): disparages > slightly the alternative 'Z' of "lfiwzx" when reload is needed. > > patch.diff > > diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md > index 6bec2bddbde..c961f2df4a7 100644 > --- a/gcc/config/rs6000/rs6000.md > +++ b/gcc/config/rs6000/rs6000.md > @@ -7341,7 +7341,7 @@ (define_insn "*movsi_internal1" > r, *h, *h") > (match_operand:SI 1 "input_operand" > "r, U, > - m, Z, Z, > + m, ^Z, Z, > r, d, v, > I, L, eI, n, > wa, O, wM, wB, >
On Wed, Sep 29, 2021 at 04:32:19PM +0800, HAO CHEN GUI wrote: > The patch punishes reload of alternative pair of "d, Z" for > movsi_internal1. The reload occurs if 'Z' doesn't match and generates an > additional insn. So the memory reload should be punished. As David says, why only for loads? But also, why not for lxsiwzx (and stxsiwx) as well? But, what for all other uses of lfiwzx? And lfiwax? We need to find out why the register allocator considers it a good idea to use FP regs here, and fix *that*? The extra insn you talk about is because this insn only allows indexed addressing ([reg+reg] or [reg] addressing). That is true for very many insns. Reload (well, LRA in the modern world) should know about such extra costs. Does it not? > gcc/ > * gcc/config/rs6000/rs6000.md (movsi_internal1): disparages > slightly the alternative 'Z' of "lfiwzx" when reload is > needed. "Disparage", no "s". Changelog entries are written in the imperative. Segher
On 14/10/2021 上午 8:12, Segher Boessenkool wrote: > On Wed, Sep 29, 2021 at 04:32:19PM +0800, HAO CHEN GUI wrote: >> The patch punishes reload of alternative pair of "d, Z" for >> movsi_internal1. The reload occurs if 'Z' doesn't match and generates an >> additional insn. So the memory reload should be punished. > As David says, why only for loads? But also, why not for lxsiwzx (and > stxsiwx) as well? > > But, what for all other uses of lfiwzx? And lfiwax? > > We need to find out why the register allocator considers it a good idea > to use FP regs here, and fix *that*? Let me explain why it uses FP regs. In ira pass, the cost of general, float and altivec registers are all zero. So it prefers 'GEN_OR_VSX_REGS' class and is finally assigned register vs32. Not sure if the altivec registers are preferable for 'GEN_OR_VSX_REGS'. r120: preferred GEN_OR_VSX_REGS, alternative NO_REGS, allocno GEN_OR_VSX_REGS a0(r120,l0) costs: BASE_REGS:0,0 GENERAL_REGS:0,0 FLOAT_REGS:0,0 ALTIVEC_REGS:0,0 VSX_REGS:4000,4000 GEN_OR_FLOAT_REGS:6000,6000 GEN_OR_VSX_REGS:6000,6000 LINK_REGS:12000,12000 CTR_REGS:12000,12000 LINK_OR_CTR_REGS:12000,12000 SPEC_OR_GEN_REGS:12000,12000 ALL_REGS:36000,36000 MEM:8000,8000 Allocno a0r120 of GEN_OR_VSX_REGS(93) has 93 avail. regs 0 3-12 14-95, node: 0 3-12 14-95 (confl regs = 1-2 13 96-110) Forming thread from colorable bucket: Pushing a0(r120,l0)(cost 0) Popping a0(r120,l0) -- assign reg 32 Disposition: 0:r120 l0 32 In reload pass, the third alternative pair is "r,m" and the forth pair is "d,Z". As the 'r' doesn't match the class of reg vs32, it needs a output reload and got a "reject++" as well as a "losers". For pair "d,Z", the second operands 'Z' doesn't match. It needs a input reload and got a "losers". But the memory reload is not punished if there is no addition modifies with the alternative. So it only got a "addr_losers". Overall cost of "r,m" is great than "d,Z". So it picked up FP register and 'lfiwzx' instruction. 0 Non input pseudo reload: reject++ alt=2,overall=7,losers=1,rld_nregs=1 alt=3,overall=6,losers=1,rld_nregs=0 Gui Haochen > > The extra insn you talk about is because this insn only allows indexed > addressing ([reg+reg] or [reg] addressing). That is true for very many > insns. Reload (well, LRA in the modern world) should know about such > extra costs. Does it not? > >> gcc/ >> * gcc/config/rs6000/rs6000.md (movsi_internal1): disparages >> slightly the alternative 'Z' of "lfiwzx" when reload is >> needed. > "Disparage", no "s". Changelog entries are written in the imperative. > > > Segher
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 6bec2bddbde..c961f2df4a7 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -7341,7 +7341,7 @@ (define_insn "*movsi_internal1" r, *h, *h") (match_operand:SI 1 "input_operand" "r, U, - m, Z, Z, + m, ^Z, Z, r, d, v, I, L, eI, n, wa, O, wM, wB,