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 EB76A3858CDA for ; Wed, 11 Jan 2023 08:02:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB76A3858CDA 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 30B5V7hH010590 for ; Wed, 11 Jan 2023 08:02:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=qzTlYPuJxOUUDsJddTGXpbE/QSXb+EKPT0fiZeLLJ5A=; b=OuaVMXYirvPkIwu7f7XVZvgpYf1JsuBcktxbfaCD0Ou37XCdg4tQ+InRxwbN7fFKYik3 GFqGPTW3g23S0l4j6pxUyN1FjoDvFkZ/lsSPSLKgHvSrIlyDz3z5p2kr4HLIRh8eqr2e 7qwU8PSrYxZ4AfA845Dk0338vEU3yPxbQeGYdVR4ajC6HAnCYKYt8cfnzt7QDUDMtcf9 UBH5ba8O1c6BVTD8WnpEgn3TMfwrpTsE2m2BPIlnGDIli5fqxGcQhwDmKfq+sIthLma2 Stlno8SDBxmVTRgR0BC1c4N1tAgdeM8YjlYpjg3Mrrlb4FVvbs3YA9b2YaX/K2/Ztfm8 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n1kqmejuf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 11 Jan 2023 08:02:15 +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 30B7Lwj7029973 for ; Wed, 11 Jan 2023 08:02:15 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 3n1kqmejt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Jan 2023 08:02:15 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30B1bCpE004521; Wed, 11 Jan 2023 08:02:13 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3n1kkyre8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Jan 2023 08:02:12 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30B82AHd40305128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Jan 2023 08:02:10 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76D5F20040; Wed, 11 Jan 2023 08:02:10 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3965720049; Wed, 11 Jan 2023 08:02:10 +0000 (GMT) Received: from [9.171.20.174] (unknown [9.171.20.174]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 11 Jan 2023 08:02:10 +0000 (GMT) Message-ID: <38307fef-8b42-87ae-9900-d5ec1c1992fe@linux.ibm.com> Date: Wed, 11 Jan 2023 09:02:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] ifcvt.cc: Prevent excessive if-conversion for conditional moves Content-Language: en-US To: "Takayuki 'January June' Suwa" , GCC Patches References: <076a3744-f608-6f31-7244-2bf7ab06cdb1.ref@yahoo.co.jp> <076a3744-f608-6f31-7244-2bf7ab06cdb1@yahoo.co.jp> From: Robin Dapp In-Reply-To: <076a3744-f608-6f31-7244-2bf7ab06cdb1@yahoo.co.jp> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Gi8ceSYcUP4DSM37x-r_EcYy4tlaePtx X-Proofpoint-GUID: -e2z0iEmnrBvPfPM9LcqeC_jKOlubG1D X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-11_03,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=458 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 bulkscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301110061 X-Spam-Status: No, score=-4.3 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, > On optimizing for speed, default_noce_conversion_profitable_p() allows > plenty of headroom, so this patch has little impact. > > Also, if the target-specific cost estimate is accurate or allows for > margins, the impact should be similarly small. I believe this part of ifcvt does/did not use the costing on purpose. It will generally convert more sequences than other paths that compare before and after costs since we just count the number of converted insns comparing them against the "branch costs". Similar to rtx costs they are kind of relative to a single insn but AFAIK it's not used consistently everywhere. All the major platforms have low branch costs nowadays (0 or 1?) thus we won't emit too many conditional moves here. In general I agree that we should compare costs everywhere and not just count (the costing should include the branch costs as well) but this would be a major overhaul. For your case (assuming xtensa), could you not tune xtensa_branch_cost? It is currently 3 allowing up to 4 conditional moves to be generated. optimize_function_for_speed_p is already being passed to the hook so you could make use of that and decrease branch costs when optimizing for size only. Regards Robin