From patchwork Wed Feb 16 19:11:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 51165 Return-Path: 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 9D8173857C72 for ; Wed, 16 Feb 2022 19:11:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D8173857C72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1645038717; bh=DAqUjtjJY/V85ybZB6ZVmRTehSMgNS6nH+G2bpLCSxI=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=m+8BTjGeCXSDLmC6B33mjD7AnEBtKoL+hCjWZWc4iHaQSilKtGRgrU2Q0KMHy7k5l vwn7/nSdrqyWeRZl9ZdHfK9tU7UX3SuIzMOw92mgOt6zVkTZWVKFe1pRJO/tOd128d iCSakpbskFMDHh6bKnjBZnu4d8bY3Zfp40WRqebQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 12EAA3858C20; Wed, 16 Feb 2022 19:11:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 12EAA3858C20 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21GJA6ZL022684; Wed, 16 Feb 2022 19:11:25 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e950wkanf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 19:11:25 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21GJ8AUJ018020; Wed, 16 Feb 2022 19:11:22 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 3e64ha1xdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 19:11:22 +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 21GJBIfv38994180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Feb 2022 19:11:18 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6969CA40AF; Wed, 16 Feb 2022 19:11:18 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31C33A4085; Wed, 16 Feb 2022 19:11:18 +0000 (GMT) Received: from [9.171.92.80] (unknown [9.171.92.80]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 16 Feb 2022 19:11:18 +0000 (GMT) Message-ID: <46e5eb44-df0c-1f23-375a-32dfc5021123@linux.ibm.com> Date: Wed, 16 Feb 2022 20:11:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US Subject: [PATCH] rs6000: Workaround for new ifcvt behavior [PR104335] To: GCC Patches , segher@kernel.crashing.org X-TM-AS-GCONF: 00 X-Proofpoint-GUID: OA1dspvKdOWvieXQA11YKoOc-Mvso8Q4 X-Proofpoint-ORIG-GUID: OA1dspvKdOWvieXQA11YKoOc-Mvso8Q4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-16_08,2022-02-16_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1011 malwarescore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160104 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Robin Dapp via Gcc-patches From: Robin Dapp Reply-To: Robin Dapp Cc: wschmidt@gcc.gnu.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, since r12-6747-gaa8cfe785953a0 ifcvt not only passes real comparisons but also "cc comparisons" (i.e. the representation of the result of a comparison) to the backend. rs6000_emit_int_cmove () is not prepared to handle this. Therefore, this patch makes it return false in such a case in order to avoid an ICE. I bootstrapped (with --enable-languages=all on P10, --enable-languages="c, c++, fortran, go, lto, objc, obj-c++" otherwise) and regtested on Power7, Power8, Power9 and Power10. Testsuite is unchanged on P7 and P9. On P8 I hit some different FAILs vs master but they look unrelated and seem to be caused by "spawn failed" i.e. out of memory or so. On P10 I compared the testsuite of the last commit before the breaking one (r12-6746-ge9ebb86799fd77, but commenting out a line that would still result in a "-Wformat-diag" bootstrap error then) vs. the patched master: No regressions. Is it OK? Regards Robin --- PR target/104335 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Return false if the expected comparison's first operand is of mode MODE_CC. From b9f053bf2222266bd1518e0eac36509ebde57266 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Thu, 10 Feb 2022 09:01:51 -0600 Subject: [PATCH] rs6000: Workaround for new ifcvt behavior [PR104335]. Since r12-6747-gaa8cfe785953a0 ifcvt passes a "cc comparison" i.e. the representation of the result of a comparison to the backend. rs6000_emit_int_cmove () is not prepared to handle this. Therefore, this patch makes it return false in such a case. PR target/104335 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Return false if the expected comparison's first operand is of mode MODE_CC. --- gcc/config/rs6000/rs6000.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index eaba9a2d698..ebc5b0cefdc 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -16175,6 +16175,12 @@ rs6000_emit_int_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) if (mode != SImode && (!TARGET_POWERPC64 || mode != DImode)) return false; + /* PR104335: We now need to expect CC-mode "comparisons" + coming from ifcvt. The following code expects proper + comparisons so better abort here. */ + if (XEXP (op, 0) && GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_CC) + return false; + /* We still have to do the compare, because isel doesn't do a compare, it just looks at the CRx bits set by a previous compare instruction. */ -- 2.31.1