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 2A6843858400 for ; Mon, 11 Jul 2022 02:13:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A6843858400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26B1VnHD016421; Mon, 11 Jul 2022 02:13:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h84dg5e66-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jul 2022 02:13:51 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26B2DpHl026679; Mon, 11 Jul 2022 02:13:51 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h84dg5e5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jul 2022 02:13:50 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26B260Q7020089; Mon, 11 Jul 2022 02:13:48 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 3h70xht1fs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jul 2022 02:13:48 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26B2Di0r20906456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Jul 2022 02:13:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE8A7A404D; Mon, 11 Jul 2022 02:13:44 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AF43A4040; Mon, 11 Jul 2022 02:13:43 +0000 (GMT) Received: from [9.200.41.69] (unknown [9.200.41.69]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 11 Jul 2022 02:13:42 +0000 (GMT) Message-ID: <8405f869-def3-3470-257a-46dac8b99bb9@linux.ibm.com> Date: Mon, 11 Jul 2022 10:13:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] Modify combine pattern by a pseudo AND with its nonzero bits [PR93453] Content-Language: en-US To: Segher Boessenkool Cc: gcc-patches , David , "Kewen.Lin" , Peter Bergner References: <368de06c-f6d6-e759-0f91-5df170687346@linux.ibm.com> <20220707173140.GY25951@gate.crashing.org> From: HAO CHEN GUI In-Reply-To: <20220707173140.GY25951@gate.crashing.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _6KA_1DaMMIeQAjX2QJIydW0OhilSSA2 X-Proofpoint-ORIG-GUID: jjFTugrCbWrao8ejQfTOgJVWliqApEbe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-10_18,2022-07-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 priorityscore=1501 spamscore=0 mlxscore=0 mlxlogscore=990 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207110007 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2022 02:13:54 -0000 Hi, Segher On 8/7/2022 上午 1:31, Segher Boessenkool wrote: >> --- a/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c >> +++ b/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c >> @@ -2,14 +2,14 @@ >> /* { dg-options "-O2" } */ >> >> /* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 14121 { target ilp32 } } } */ >> -/* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 20217 { target lp64 } } } */ >> +/* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 21279 { target lp64 } } } */ > You are saying there should be 21279 instructions generated by this test > case. What makes you say that? Yes, we regressed some time ago, we > generate too many insns in many cases, but that is *bad*. > The trunk generates 21305. My patch generates 26 "rlwimi" instead of "rlwimn+ior". So it saves 26 insns and reduce the total number of insns from 21305 to 21279 and increase the number of "rlwimi" from 1666 to 1692. I did a biset for the problem. After commit "commit 8d2d39587: combine: Do not combine moves from hard registers", the case fails. The root cause is it can't combine from the hard registers and has to use subreg which causes its high part to be undefined. Thus, there is an additional "AND" generated. Before the commit Trying 2 -> 7: 2: r125:DI=%3:DI REG_DEAD %3:DI 7: r128:SI=r125:DI#0 0>>0x1f REG_DEAD r125:DI Successfully matched this instruction: (set (reg:SI 128 [ x ]) (lshiftrt:SI (reg:SI 3 3 [ x ]) (const_int 31 [0x1f]))) allowing combination of insns 2 and 7 After the commit Trying 20 -> 7: 20: r125:DI=r132:DI REG_DEAD r132:DI 7: r128:SI=r125:DI#0 0>>0x1f REG_DEAD r125:DI Failed to match this instruction: (set (subreg:DI (reg:SI 128 [ x ]) 0) (zero_extract:DI (reg:DI 132) (const_int 32 [0x20]) (const_int 1 [0x1]))) Successfully matched this instruction: (set (subreg:DI (reg:SI 128 [ x ]) 0) (and:DI (lshiftrt:DI (reg:DI 132) (const_int 31 [0x1f])) (const_int 4294967295 [0xffffffff]))) allowing combination of insns 20 and 7 The problem should be fixed in another case? Please advice. Thanks Gui Haochen