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 2C4D73858D1E; Wed, 4 Jan 2023 06:11:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C4D73858D1E 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 (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3043KIen031685; Wed, 4 Jan 2023 06:11:26 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 : content-type : mime-version; s=pp1; bh=6GtCJqsw4H9+Z7FjsHl9x+c8OqarDlNyZ56hEV5qx64=; b=q4eaxKPaSB2zQWG0KbBfotWS/T04e70bELTSDDphoAHE0XkleU9nO3LkOO3u6Lf3FzG5 gGRO0owbpus8SWdeEB7PDAD3QN7XbDgGJdcIC0PADuYRBW+UQgOai95TcDvCS7B5r1LJ fhY2xofpZHtp7UwxSl1Em6Imn5HZBss/4bBBTKVXjndMR46soPNI7MtGRKLI8lTcPkHA 0yMfQ9sVGkCI3JbpuMH7zvXmt/kijqKnLvIhI7s2xuycZ4XXaCUjMCwN8zga9eDazrxm 33l+Gq3CV0kcYDbFo5vCQZichm439AUxIwUuYnZ0FIcZSFfToodXKiUzg4DYJOoo2TmB XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mvh8q0jr1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 06:11:26 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3045vmX8029954; Wed, 4 Jan 2023 06:11:26 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 3mvh8q0jqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 06:11:25 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3045EElu009551; Wed, 4 Jan 2023 06:11:25 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([9.208.129.118]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3mtcq7e3y5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 06:11:25 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3046BO8s6357678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Jan 2023 06:11:24 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E20715805D; Wed, 4 Jan 2023 06:11:23 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE9A358062; Wed, 4 Jan 2023 06:11:23 +0000 (GMT) Received: from pike (unknown [9.5.12.127]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTPS; Wed, 4 Jan 2023 06:11:23 +0000 (GMT) From: Jiufu Guo To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org Subject: Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant References: <20221212013829.111739-1-guojiufu@linux.ibm.com> <20221212013829.111739-2-guojiufu@linux.ibm.com> Date: Wed, 04 Jan 2023 14:11:20 +0800 In-Reply-To: <20221212013829.111739-2-guojiufu@linux.ibm.com> (Jiufu Guo's message of "Mon, 12 Dec 2022 09:38:29 +0800") Message-ID: <7ezgayde2f.fsf@pike.rch.stglabs.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mKHcH1Jh_qGfoUXt8wEj56atdEI1hEFh X-Proofpoint-ORIG-GUID: gCYIAlJ2xxgjhozml0S6akF50Hoi2xG- X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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=2023-01-04_02,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=960 suspectscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301040050 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H2,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, I would like to have a ping on this patch: https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html BR, Jeff (Jiufu) Jiufu Guo writes: > 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? > > BR, > Jeff (Jiufu) > > > PR target/106708 > > gcc/ChangeLog: > > * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build > constants through "lis; xoris". > > 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;