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 96B5B383800B for ; Tue, 27 Jul 2021 20:49:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 96B5B383800B Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16RKeCN2121368; Tue, 27 Jul 2021 16:49:49 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3a2qptjs25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 16:49:49 -0400 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 16RKkcYQ000310; Tue, 27 Jul 2021 20:49:47 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3a235kgn9r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 20:49:47 +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 16RKnj6P29884752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jul 2021 20:49:45 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F19D1AE045; Tue, 27 Jul 2021 20:49:44 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA545AE058; Tue, 27 Jul 2021 20:49:44 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.29.162]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 27 Jul 2021 20:49:44 +0000 (GMT) Subject: Re: [PATCH 4/7] ifcvt/optabs: Allow using a CC comparison for emit_conditional_move. To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: <20210625160905.23786-1-rdapp@linux.ibm.com> <20210625160905.23786-5-rdapp@linux.ibm.com> <06f8a450-4da1-b7e3-4b5b-e7085cfa822a@linux.ibm.com> From: Robin Dapp Message-ID: <284552e9-d93f-dc80-b355-e1e6788d14dd@linux.ibm.com> Date: Tue, 27 Jul 2021 22:49:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: p--ZxyTfW-Z56udtNZThxcDuPTMpdnfP X-Proofpoint-GUID: p--ZxyTfW-Z56udtNZThxcDuPTMpdnfP X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-27_13:2021-07-27, 2021-07-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 bulkscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107270119 X-Spam-Status: No, score=-4.7 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 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-List-Received-Date: Tue, 27 Jul 2021 20:49:52 -0000 > Hmm, OK. Doesn't expanding both versions up-front create the same kind of > problem that the patch is fixing, in that we expand (and therefore cost) > both the reversed and unreversed comparison? Also… > [..] > > …for min/max, I would have expected this swap to create the canonical > operand order for the min and max too. What causes it to be rejected? > We should not be expanding two comparisons but only emit (and cost) the reversed comparison if expanding the non-reversed one failed. Regarding the reversal, I checked again - the commit introducing the op2/op3 swap is g:deed3da9af697ecf073aea855ecce2d22d85ef71, the corresponding test case is gcc.target/i386/pr70465-2.c. It inlines one long double ternary operation into another, probably causing not for multiple sets, mind you. The situation doesn't occur with double. >> + >> + rtx rev_comparison = NULL_RTX; >> bool swapped = false; >> - if (swap_commutative_operands_p (op2, op3) >> - && ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL)) >> - != UNKNOWN)) >> + >> + code = unsignedp ? unsigned_condition (code) : code; >> + comparison = simplify_gen_relational (code, VOIDmode, cmode, op0, op1); >> + >> + if ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL)) >> + != UNKNOWN) >> { >> - std::swap (op2, op3); >> - code = reversed; >> - swapped = true; >> + reversed = unsignedp ? unsigned_condition (reversed) : reversed; > > When is this needed? I'd have expected the reversed from of an unsigned > code to be naturally unsigned. This was also introduced by the commit above, probably just repeating what was done for the non-reversed comparison. Regards Robin