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 893173858D1E; Wed, 17 May 2023 02:17:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 893173858D1E 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 (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34H28GOn010037; Wed, 17 May 2023 02:17:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : in-reply-to : references : message-id : content-type : content-transfer-encoding : mime-version; s=pp1; bh=9xxo4hDgd8sjTzdXlDR3ouLDaXcWVXiUSbGJVTVWUZo=; b=tpyvOPY5s7WyrPJ8Zt71JuaAiHdG1b2jXmpX2P1bRIcaZWckDZyPc//4g/JFr56+4Wgc TgN4uKnQ+7q3q4wi/0sP3Hk744bx9fjnmZ937wPHqjK8Rc8mozpyDcIqGX7Hod48KpCn c7DvErHNlixQcCgd81Ljh9upz+V7NZ18GEnnu+tU5r+R7ebXygKeAVmXw2RcFCBbwbhi rBw2dotecnltgzzNVlhQbV5bAqrrvWSJ3eRsQeW+Jzg9WrdWePzLXu1fbQIyB7tMz8Yy mimd510X+mF66BZ/XYbERvHGoUmXURCKgVuC/dRQMPSqZFizrfmfBIqQ4yjiYxxLKTA2 NA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qmmsq9pur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 02:17:52 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34H2EtD8006849; Wed, 17 May 2023 02:17:52 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qmmsq9pug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 02:17:52 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34H0ErQu025393; Wed, 17 May 2023 02:17:51 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3qj266079r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 May 2023 02:17:51 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34H2HoAA48496972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 May 2023 02:17:50 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B42D5805A; Wed, 17 May 2023 02:17:50 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C66F258054; Wed, 17 May 2023 02:17:49 +0000 (GMT) Received: from ltc.linux.ibm.com (unknown [9.5.196.140]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 May 2023 02:17:49 +0000 (GMT) Date: Wed, 17 May 2023 10:17:49 +0800 From: guojiufu To: "Kewen.Lin" Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant In-Reply-To: <2230a42c-98cc-bad4-7c3e-98d42a9281b9@linux.ibm.com> References: <20221212013829.111739-1-guojiufu@linux.ibm.com> <20221212013829.111739-2-guojiufu@linux.ibm.com> <2230a42c-98cc-bad4-7c3e-98d42a9281b9@linux.ibm.com> Message-ID: <26ec3110a18bc6d20478f2ec4c968f78@linux.ibm.com> X-Sender: guojiufu@linux.ibm.com Content-Type: text/plain; charset=US-ASCII; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-GUID: NutIhorl8ba6xYd0aoijnYUhZ0pqRvYB X-Proofpoint-ORIG-GUID: eLPkB3igAkFS_7RI1MjHPv9OBe5P9Kqy 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.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_14,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305170015 X-Spam-Status: No, score=-11.4 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,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, On 2023-05-15 14:53, Kewen.Lin wrote: > 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! Yeap! Retested and verified. Thanks so much for your always insight review and helpful comments! Committed via r14-923-g5eb7d560626e42. BR, Jeff (Jiufu) > >> >> 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/ Yes :) > > 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;