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 68EF23858D37; Mon, 15 May 2023 06:54:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68EF23858D37 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 (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34F6dfAu026306; Mon, 15 May 2023 06:54:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=rJOZPQTCW4JiU3YifqFaA3RlVuYpWqui+t6wEXGBFXA=; b=pB4ZiWsN1nNrjuErIW66RawbW5rZNbCIjWi54B3J3ejPmGUszV8ebw5WbW+3EszNc77t ntavttok9lFnp8gkYOSavV6bLeKUmm915vob+/CrAyxf2UltTTjIFp7FIOjzHF8BVe+c F6AFfaHNmAM2XxZ2yiJwlElAc6C7al8OGbNV0HDOYale3D+zPGkJ4AiA9BiLE3lBEFcn nvngnCEGSdOZ2x4+eXmUdQArWhGJzMyHKxJgyHU6MQTnG2H9QfrSxVFbRTsy9y9ALRj1 sa+RiB7j+03Ii8FJlTdHj1vzF8EW0FwyKCzcdWUzfVeFKHmH+PSRAqKYbBuQbG22GinI gA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qkd3mmk2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 06:54:00 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34F6eAwX029002; Mon, 15 May 2023 06:53:59 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qkd3mmk0s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 06:53:59 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34F36ax8006124; Mon, 15 May 2023 06:53:56 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3qj264rw44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 06:53:55 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34F6rrUe21234338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 May 2023 06:53:53 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70E2920043; Mon, 15 May 2023 06:53:53 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55EE820040; Mon, 15 May 2023 06:53:51 +0000 (GMT) Received: from [9.177.27.227] (unknown [9.177.27.227]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 15 May 2023 06:53:50 +0000 (GMT) Message-ID: <2230a42c-98cc-bad4-7c3e-98d42a9281b9@linux.ibm.com> Date: Mon, 15 May 2023 14:53:49 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant Content-Language: en-US To: Jiufu Guo Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, gcc-patches@gcc.gnu.org References: <20221212013829.111739-1-guojiufu@linux.ibm.com> <20221212013829.111739-2-guojiufu@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: <20221212013829.111739-2-guojiufu@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9SF2p3EoFvgZbUz2-gfH9jL5b7L2-AYZ X-Proofpoint-ORIG-GUID: oOs7c4lyf954mcoB2DRVKprGN2nJeiXY Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-15_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 clxscore=1011 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305150058 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 Jeff, on 2022/12/12 09:38, Jiufu Guo wrote: > Hi, > > For constant C: > If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say: > 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build. > > Here N(M) means N continuous bit M, x for M means it is ok for either > 1 or 0; '||' means concatenation. > > This patch update rs6000_emit_set_long_const to support those constants. > > Compare with previous version: > https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm > This patch fix conflicts with trunk. > > Bootstrap and regtest pass on ppc64{,le}. > > Is this ok for trunk? OK for trunk, thanks for improving this. btw, the test case needs to be updated a bit as the function names in the context changed upstream, please ensure it's tested well before committing, thanks! > > BR, > Jeff (Jiufu) > > > PR target/106708 > > gcc/ChangeLog: > > * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build > constants through "lis; xoris". Maybe s/Add to build/Support building/ BR, Kewen > > gcc/testsuite/ChangeLog: > > * gcc.target/powerpc/pr106708.c: Add test function. > > --- > gcc/config/rs6000/rs6000.cc | 7 +++++++ > gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc > index 8c1192a10c8..1138d5e8cd4 100644 > --- a/gcc/config/rs6000/rs6000.cc > +++ b/gcc/config/rs6000/rs6000.cc > @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c) > if (ud1 != 0) > emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1))); > } > + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0) > + { > + /* lis; xoris */ > + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode); > + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32))); > + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000))); > + } > else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000)) > { > /* li; xoris */ > diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c > index dc9ceda8367..a015c71e630 100644 > --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c > +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c > @@ -4,7 +4,7 @@ > /* { dg-require-effective-target has_arch_ppc64 } */ > > long long arr[] > - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL}; > += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL}; > > void __attribute__ ((__noipa__)) lixoris (long long *arg) > { > @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg) > /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */ > /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */ > > +void __attribute__ ((__noipa__)) lisxoris (long long *arg) > +{ > + *arg = 0xffffffff65430000LL; > +} > +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */ > +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */ > + > int > main () > { > @@ -35,6 +42,7 @@ main () > lixoris (a); > lioris (a + 1); > lisrldicl (a + 2); > + lisxoris (a + 3); > if (__builtin_memcmp (a, arr, sizeof (arr)) != 0) > __builtin_abort (); > return 0;