From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 0296E3858438 for ; Fri, 17 Mar 2023 02:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0296E3858438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32H1VVCn028611; Fri, 17 Mar 2023 02:49:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=ZwBF0NkRpnVScVvRDffcE86nEv8wNjZY/4CWCOs26tk=; b=SS21iUxx3Ml7InG/VuAaYRbemZ21yJ8He7rera4EzaPRT57dOPpdlRoqE2z4Tc869J12 h2FJXrKoQjGb0o9Qg3BQveXmJvHwziW+BurqTGk7KFQYIOiPfmViXpyyy9c902lk+OKM zmq3Prtk2kgShY1Y0dJe3Tp/j/BAOmfF+bq+PB3HNZb3wrLlE9mB5jU0zu8C1BHaKo8g CAgcioylmVuvozMLmq1pLL6L/kmlQsbhTydWMCYMinaCxyqeFw7R7IrSpGErW78ng6ON VRn+0L4MpISITnHa2xgIeoVdSaolLFGMH50LIX5P0t4hasgBVN+IKu90DpZldpxhdCN+ Mg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3pcem0sg5t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Mar 2023 02:49:05 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32H2lerw010865; Fri, 17 Mar 2023 02:49:05 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3pcem0sg4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Mar 2023 02:49:04 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32GHUiaE016160; Fri, 17 Mar 2023 02:49:02 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3pbs5499nf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Mar 2023 02:49:02 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32H2mw4q29360658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Mar 2023 02:48:58 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0EA120043; Fri, 17 Mar 2023 02:48:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5973C20040; Fri, 17 Mar 2023 02:48:56 +0000 (GMT) Received: from [9.43.179.95] (unknown [9.43.179.95]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 17 Mar 2023 02:48:56 +0000 (GMT) Message-ID: <152aec23-6246-e89f-ca21-73299c1538d4@linux.ibm.com> Date: Fri, 17 Mar 2023 10:48:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH-1, rs6000] Put constant into pseudo at expand when it needs two insns [PR86106] Content-Language: en-US To: Richard Biener Cc: gcc-patches , Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , "Vladimir N. Makarov" References: <22e83da3-a81f-dd61-c04b-a39b459a965f@linux.ibm.com> <4e1f2c62-5f43-a8a1-2c20-8b318520db8e@linux.ibm.com> From: HAO CHEN GUI In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 11dccZoVJDSDrtJRh_3clWV0qjAhua61 X-Proofpoint-GUID: 86MkKQGtcZ5F__Qxkh7IcFDrzrtOZi9Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_16,2023-03-16_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=763 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303170013 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Richard, 在 2023/3/16 18:36, Richard Biener 写道: > On Thu, Mar 16, 2023 at 10:04 AM HAO CHEN GUI wrote: >> >> Hi Richard, >> >> 在 2023/3/16 15:57, Richard Biener 写道: >>> So this is one way around the lack of CSE/PRE of constant operands. I'd >>> argue that a better spot for this _might_ be LRA (split the constant out if >>> there's a free register available), postreload-[g]cse (CSE the constants) and >>> then maybe cprop_hardreg to combine back single-use constants? >>> >>> I'm not sure if careful constraints massaging like adding magic letters to >>> alternatives with constants to pessimize them for LRA, making them >>> more expensive than spilling the constant to a register but avoid >>> secondary reloads with spilling a register to the stack to make room >>> for the constant, is possible - but in theory a special constraint modifier >>> for this purpose could be invented. >> >> Thanks so much for your advice. >> >> cse/gcse doesn't take cost of constant set (the def insn of the constant) into >> consideration. So it won't replace the register with a constant as it costs 1 >> insn with the register and costs 2 insn with the constant. > > I think it does (and should) cost the constant set (IIRC we had some > improvements > there, or at least proposed, during this stage1). But sure - this is why your > "trick" works. > It's doable if post-reload gsc costs the constant set. I will draft a patch to test it. >> Finally, the single- >> use constants can't be back to 2 insn. > > And that's because of the issue you point out above? No. my original concern is the constant can't be back. If post-reload gsc doen't cost the constant set, the insn with a register always cost less than two insns with immediates. Commonly the constant set itself costs 2 insn also. > >> Not sure if I understand it correctly. >> Looking forward to your advice. > > My main point is that CSEing constants has impacts on register pressure > and thus should probably be done after or within register allocation. RTL > expansion itself is probably a bad time to pro-actively split out constants > even more if, as you say, nothing puts them back. > I agree. Thank a lot. > Richard. > >> Thanks >> Gui Haochen Gui Haochen