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 244903887F78; Mon, 5 Dec 2022 06:11:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 244903887F78 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 (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B54G1Es012141; Mon, 5 Dec 2022 06:11:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type : content-transfer-encoding; s=pp1; bh=/8O0XwHfrf3mJ7TpVHl98iHJJYVOouJKkpY4H7eApMs=; b=S3i8HVWHDFF5u1T0U7+AzT5Ifae0WCqT7NxLBtN5H4liji9FaRsljF1HM82FXS08TYLX XjBvk2j81uA22XEoNxq3PPY+n4EwfQqT3R8E64FBU5psPy6V9X/XDdhMQMwZgI/9VkJa G5sW8D06ha3d/l5nhWfU8oSGg7tRyl4xsGzHk2t64Yj4onO+s01R/GG51TfNxrwYEYVk i7wM7c5qWlSQR2xYUd1V5WC57BAzqgPCFyzb423Juui25HEs90zEslkTlWtD2jXhAcnH CufEWzbSTihbJlTyT6L4/jL9k39ay6/wfDIWsadlCXGWi/flYhpMjQhff7cRdHnwenpw AA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m8ganhj0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Dec 2022 06:11:38 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2B558wfd032080; Mon, 5 Dec 2022 06:11:37 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m8ganhj05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Dec 2022 06:11:37 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2B53Ld2N025967; Mon, 5 Dec 2022 06:11:36 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma03wdc.us.ibm.com with ESMTP id 3m7x39bphr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Dec 2022 06:11:36 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2B56BZNc62456270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 5 Dec 2022 06:11:36 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F18258058; Mon, 5 Dec 2022 06:11:35 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30CD45805C; Mon, 5 Dec 2022 06:11:35 +0000 (GMT) Received: from pike (unknown [9.5.12.127]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Mon, 5 Dec 2022 06:11:35 +0000 (GMT) From: Jiufu Guo To: "Kewen.Lin" Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH 2/3]rs6000: NFC use sext_hwi to replace ((v&0xf..f)^0x80..0) - 0x80..0 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> <3f42f78c-7b28-02b8-6e78-17819f784979@linux.ibm.com> Date: Mon, 05 Dec 2022 14:11:32 +0800 In-Reply-To: <3f42f78c-7b28-02b8-6e78-17819f784979@linux.ibm.com> (Kewen Lin's message of "Fri, 2 Dec 2022 16:56:55 +0800") Message-ID: <7er0xev0q3.fsf@pike.rch.stglabs.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: GwSE0FEYR-dCnmDo4eIyHUEdLBW9Tt7v X-Proofpoint-ORIG-GUID: rd7oVQjj82pDNpJsKyqG1skiAqc5t4U1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-05_01,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 clxscore=1015 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212050023 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,KAM_NUMSUBJECT,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: Hi Kewen, "Kewen.Lin" writes: > on 2022/12/1 20:16, guojiufu wrote: >> On 2022-12-01 15:10, Jiufu Guo via Gcc-patches wrote: >>> Hi Kewen, >>> >>> =E5=9C=A8 12/1/22 2:11 PM, Kewen.Lin =E5=86=99=E9=81=93: >>>> on 2022/12/1 13:35, Jiufu Guo wrote: >>>>> Hi Kewen, >>>>> >>>>> Thanks for your quick and insight review! >>>>> >>>>> =E5=9C=A8 12/1/22 1:17 PM, Kewen.Lin =E5=86=99=E9=81=93: >>>>>> 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?=C2=A0 I noticed there are still two = places >>>>>> using this kind of expression in function constant_generates_xxsplti= w, >>>>>> but I assumed it's intentional as their types are not HOST_WIDE_INT. >>>>>> >>>>>> gcc/config/rs6000/rs6000.cc:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 short sig= n_h_word =3D ((h_word & 0xffff) ^ 0x8000) - 0x8000; >>>>>> gcc/config/rs6000/rs6000.cc:=C2=A0 int sign_word =3D ((word & 0xffff= ffff) ^ 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 assignme= nt >>>>> is ok. >>>> >>>> ah, I see.=C2=A0 I agree using the assignment is quite enough.=C2=A0 C= ould you >>>> please also simplify them together?=C2=A0 Since they are with the form >>>> "((value & 0xf..f) ^ 0x80..0) - 0x80..0" too, and can be refactored >>>> in a better way.=C2=A0 Thanks! >>> >>> Sure, I believe just "short sign_h_word =3D vsx_const->half_words[0];" >>> should be correct :-), and included in the updated patch. >>> >>> Updated patch is attached,=C2=A0 bootstrap®test is on going. >>=20 > > 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 c= ode: like sext_hwi >>=20 > > May be shorter with "rs6000: Update sign extension computation with > sext_hwi"? Thanks for your great suggestions! > >> This patch just replaces the expression like:=20 >> ((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}. >>=20 > > Thanks for updating and testing, this patch is OK. BR, Jeff (Jiufu) > > BR, > Kewen