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 524503858D20; Fri, 2 Dec 2022 08:57:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 524503858D20 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 2B26msAP016634; Fri, 2 Dec 2022 08:57:05 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=4UsYaQ7WRopw5OisuASl1PXGN2L+NoeaKPPNVTGQXtc=; b=cLZkss/5U82w192OOv3sbTCqjL+LSMnIv/J4Nm7BmFrGw+Me876FijYIiJJLnLJ5KYPT dVxoAbn0r+qrKE6kxd9+LSBMTfrnE4VRAdcGE1uUQz/qoJwVSyXS/lGpg3VHF7ofeEsC 5CanDsaCfj9wrF9wvFU4HPqidKX18ZRvPPtsFyRqxOqCF4EvKO4GeSj6TmcqgngKW3Ve sRRyS+dZwg2HtLC+znqaochDSR2SOChBRV12u8rXyFmxKLU/ZJisRWgwjf8ThGNvrlJp Ln01YVW51Tp7wmia4cPdiMARMfKmAYxWn2DIJg1wXe/bxAeGxOIXUwoXlDSR31kbsAfJ kg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m7ce4axg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 08:57:04 +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 2B28uwOt019877; Fri, 2 Dec 2022 08:57:04 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m7ce4axfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 08:57:04 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2B28oCoD001551; Fri, 2 Dec 2022 08:57:02 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3m3ae8xd7r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Dec 2022 08:57:02 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2B28oQGw6423064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Dec 2022 08:50:26 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A47DAA4054; Fri, 2 Dec 2022 08:56:59 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63D06A4093; Fri, 2 Dec 2022 08:56:57 +0000 (GMT) Received: from [9.197.236.147] (unknown [9.197.236.147]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 2 Dec 2022 08:56:57 +0000 (GMT) Message-ID: <3f42f78c-7b28-02b8-6e78-17819f784979@linux.ibm.com> Date: Fri, 2 Dec 2022 16:56:55 +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: [PATCH 2/3]rs6000: NFC use sext_hwi to replace ((v&0xf..f)^0x80..0) - 0x80..0 Content-Language: en-US To: guojiufu Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, gcc-patches@gcc.gnu.org References: <20221201013619.196004-1-guojiufu@linux.ibm.com> <20221201013619.196004-2-guojiufu@linux.ibm.com> <94338e4c-baf4-ec09-68a7-064a23c79327@linux.ibm.com> <9cbc0b3d-0d4b-5646-0ed8-fa2d4f8dc8c3@linux.ibm.com> <81db0995-8ba5-766c-1e0e-67d3d47c40ce@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: XcZzvGEPvzQ8KG4d4AkRYPuA6KDOq6I6 X-Proofpoint-GUID: LffuwpXfvWQzD7AFTCf9tHRC7UQQb1b3 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=2022-12-02_04,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 phishscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212020065 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,BODY_8BITS,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: on 2022/12/1 20:16, guojiufu wrote: > On 2022-12-01 15:10, Jiufu Guo via Gcc-patches wrote: >> Hi Kewen, >> >> 在 12/1/22 2:11 PM, Kewen.Lin 写道: >>> on 2022/12/1 13:35, Jiufu Guo wrote: >>>> Hi Kewen, >>>> >>>> Thanks for your quick and insight review! >>>> >>>> 在 12/1/22 1:17 PM, Kewen.Lin 写道: >>>>> Hi Jeff, >>>>> >>>>> on 2022/12/1 09:36, Jiufu Guo wrote: >>>>>> Hi, >>>>>> >>>>>> This patch just uses sext_hwi to replace the expression like: >>>>>> ((value & 0xf..f) ^ 0x80..0) - 0x80..0 for rs6000.cc and rs6000.md. >>>>>> >>>>>> Bootstrap & regtest pass on ppc64{,le}. >>>>>> Is this ok for trunk? >>>>> >>>>> You didn't say it clearly but I guessed you have grepped in the whole >>>>> config/rs6000 directory, right?  I noticed there are still two places >>>>> using this kind of expression in function constant_generates_xxspltiw, >>>>> but I assumed it's intentional as their types are not HOST_WIDE_INT. >>>>> >>>>> gcc/config/rs6000/rs6000.cc:      short sign_h_word = ((h_word & 0xffff) ^ 0x8000) - 0x8000; >>>>> gcc/config/rs6000/rs6000.cc:  int sign_word = ((word & 0xffffffff) ^ 0x80000000) - 0x80000000; >>>>> >>>>> If so, could you state it clearly in commit log like "with type >>>>> signed/unsigned HOST_WIDE_INT" or similar? >>>>> >>>> Good question! >>>> >>>> And as you said sext_hwi is more for "signed/unsigned HOST_WIDE_INT". >>>> For these two places, it seems sext_hwi is not needed actually! >>>> And I did see why these expressions are used, may be just an assignment >>>> is ok. >>> >>> ah, I see.  I agree using the assignment is quite enough.  Could you >>> please also simplify them together?  Since they are with the form >>> "((value & 0xf..f) ^ 0x80..0) - 0x80..0" too, and can be refactored >>> in a better way.  Thanks! >> >> Sure, I believe just "short sign_h_word = vsx_const->half_words[0];" >> should be correct :-), and included in the updated patch. >> >> Updated patch is attached,  bootstrap®test is on going. > on 2022/12/1 15:10, Jiufu Guo wrote: > From 8aa8e1234b6ec34473434951a3a6177253aac770 Mon Sep 17 00:00:00 2001 > From: Jiufu Guo > Date: Wed, 30 Nov 2022 13:13:37 +0800 > Subject: [PATCH 2/2]rs6000: update ((v&0xf..f)^0x80..0) - 0x80..0 with code: like sext_hwi > May be shorter with "rs6000: Update sign extension computation with sext_hwi"? > This patch just replaces the expression like: > ((value & 0xf..f) ^ 0x80..0) - 0x80..0 to better code(e.g. sext_hwi) for > rs6000.cc, rs6000.md and predicates.md (files under rs6000/). > Bootstrap and regtest pass on ppc64{,le}. > Thanks for updating and testing, this patch is OK. BR, Kewen