From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id C9C703858401 for ; Tue, 22 Nov 2022 06:02:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9C703858401 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 (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AM4jNVu031819; Tue, 22 Nov 2022 06:02:27 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=02UwiQ7MmoEsaIkY4VaIEIWSOGbIP647YFiSPfMCCaY=; b=bmYGbV/GkhE6ZSlFlbmyfIsiuvuI9jn4m0lJXctaFR6xc5vB5aWybmU+VDlN1ct12ClG CoC4iAu9+2mtYEQSTG8QCErqPDH0LWVNmcHSbjVdiQzOm8jgQ1hMwrIyMjUDjPVLTlNk IzAtZkQ2F81LWP2rO0pBknSW8NemjzIm2dGHsrHZQLPvgPlSjCh736V2tydIRkOyr6VY FM2pe2M6ZHvx8b/WeoK/EDMI4kZkipLvPSHj0iGEJ3U+c/bsiGDC3B2UZKgFnTO2psFu ZezOOQ15iD7XiFTwobhYvQsW2QaMUeRxfda1FCdmotOGY1vSlma7ymMPPEDeAakkRAKK fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m0qp39ek3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Nov 2022 06:02:27 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AM5gt66013658; Tue, 22 Nov 2022 06:02:26 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m0qp39ej9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Nov 2022 06:02:26 +0000 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 2AM5ofv9032709; Tue, 22 Nov 2022 06:02:25 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 3kxps8un7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Nov 2022 06:02:24 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AM62LYK5767702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 06:02:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C139F42047; Tue, 22 Nov 2022 06:02:21 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B47444204B; Tue, 22 Nov 2022 06:02:19 +0000 (GMT) Received: from [9.200.45.208] (unknown [9.200.45.208]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Nov 2022 06:02:19 +0000 (GMT) Message-ID: Date: Tue, 22 Nov 2022 14:02:17 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000 Content-Language: en-US To: HAO CHEN GUI Cc: David Edelsohn , gcc-patches , Peter Bergner , Segher Boessenkool References: <438c6628-0b9c-e5d0-e198-2fd6edd16a93@linux.ibm.com> <20221118121822.GY25951@gate.crashing.org> <4056dfc0-57e3-0d13-633c-297572c5c647@linux.ibm.com> <172f8c34-fc63-8434-0528-4261b5c6a8ba@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5OFOILt1MNaWJgtAHA1NNjeul99P6LFJ X-Proofpoint-GUID: bUo3I411DnZSTn-jxkL7zqM4E8v7CVbJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-22_02,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211220040 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 Haochen, on 2022/11/22 13:12, HAO CHEN GUI wrote: > Hi Kewen, > > 在 2022/11/22 11:11, Kewen.Lin 写道: >> Maybe we can adjust prepare_cmp_insn to fail if the constructed cbranchcc4 >> pattern doesn't satisfy the predicate of operand 0 rather than to assert. >> It's something like: >> >> if (!insn_operand_matches (icode, 0, test)) >> goto fail; >> >> or only assign and return if insn_operand_matches (icode, 0, test). >> >> The code makes the assumption that all this kind of cbranchcc4 patterns >> should match what target defines for cbranchcc4 optab, but unfortunately >> it's not sure for our port and I don't see how it should be. > > Thanks for your comments. > > I just drafted a patch to let it go to "fail" when predicate of operand 0 is > not satisfied. It works and passed bootstrap on ppc64le. But my concern is > prepare_cmp_insn is a generic function and is used to create a cmp rtx. It > is not only called by emit_conditional* (finally called by ifcvt) but other > functions (even new functions). If we change the logical in prepare_cmp_insn, > we may lost some potential optimization. After all, the branch_2insn is a valid > insn. I have one assumption that without your proposed have_cbranchcc4 change for rs6000, for this generic prepare_cmp_insn, it would never be called with CCmode on rs6000, since we would get ICE with icode CODE_FOR_nothing otherwise. It means we don't lose anything than before. Besides, excepting for those conditional call sites, I doubt CCmode would be used for calling it. Could you have a check? > > I think the essential of the problem is we want to exclude those comparisons > (from cbranchcc4 used in ifcvt) which need two CC bits. So, we can change the > logical of ifcvt - add an additional check with predicate of operand 0 when > checking the have_cbranchcc4 flag in ifcvt. I think that would work. The only concern is that some use (future) of prepare_cmp_insn like how it's used in ifcvt would need the same pre checking, otherwise the ICE happens again. BR, Kewen