From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 809C0384F019 for ; Fri, 25 Jun 2021 16:09:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 809C0384F019 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15PG3JPn183484; Fri, 25 Jun 2021 12:09:25 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39dhfctdvt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 12:09:25 -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 15PG8vmB001259; Fri, 25 Jun 2021 16:09:23 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 399878b4cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 16:09:23 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15PG9K5j16974268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Jun 2021 16:09:20 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 614FBAE067; Fri, 25 Jun 2021 16:09:20 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17A65AE06A; Fri, 25 Jun 2021 16:09:20 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.46.33]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 25 Jun 2021 16:09:20 +0000 (GMT) From: Robin Dapp To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 0/7] ifcvt: Convert multiple Date: Fri, 25 Jun 2021 18:08:58 +0200 Message-Id: <20210625160905.23786-1-rdapp@linux.ibm.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ybFTaojs8MDW6wHEtNNLMWiGqjTWWWyP X-Proofpoint-ORIG-GUID: ybFTaojs8MDW6wHEtNNLMWiGqjTWWWyP X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-25_06:2021-06-25, 2021-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 mlxlogscore=990 malwarescore=0 phishscore=0 clxscore=1011 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106250094 X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Fri, 25 Jun 2021 16:09:31 -0000 Hi, finally I got around to reworking this patch set for if conversion so it is rather a v3 already. Since so much time has passed, I'm not replying to the old thread. There are several problems with noce_convert_multiple and most are due to the instructions costs not being properly counted: - We create too many temporaries that, by default, are counted as instruction even though they will be removed by later passes. - We emit a new compare for every cmov. - Original costs are unfairly low. These are tackled in this patch set. As mentioned in the last discussion, what still remains is to properly unify some parts of ifcvt. We have several "sub-passes" that can handle similar situations but the restrictions of each of them are not clearly documented. Costing also differs in that we sometimes just count emitted cmovs and sometimes we indeed use pattern_cost or insn_cost. Ideally, we will also unify passing value comparisons as well as CC comparisons to backends in the future. This will allow a backend to choose whether to emit a comparison, re-use a comparison or even get rid of a comparison by emitting a min/max. Nonetheless, this patch set improves the situation on s390 and, in general, allows more accurate costing. Regards Robin Robin Dapp (7): ifcvt: Check if cmovs are needed. ifcvt: Allow constants for noce_convert_multiple. ifcvt: Improve costs handling for noce_convert_multiple. ifcvt/optabs: Allow using a CC comparison for emit_conditional_move. ifcvt: Try re-using CC for conditional moves. testsuite/s390: Add tests for noce_convert_multiple. s390: Increase costs for load on condition and change movqicc expander. gcc/config/s390/s390.c | 2 +- gcc/config/s390/s390.md | 4 +- gcc/ifcvt.c | 273 +++++++++++++++--- gcc/optabs.c | 163 +++++++---- gcc/optabs.h | 1 + gcc/testsuite/gcc.dg/ifcvt-4.c | 2 +- .../gcc.target/s390/ifcvt-two-insns-bool.c | 39 +++ .../gcc.target/s390/ifcvt-two-insns-int.c | 39 +++ .../gcc.target/s390/ifcvt-two-insns-long.c | 39 +++ 9 files changed, 464 insertions(+), 98 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c -- 2.31.1