From patchwork Wed Nov 15 03:02:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiufu Guo X-Patchwork-Id: 165147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2356666rwb; Tue, 14 Nov 2023 19:07:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHykJdJV8VB4V9YoJZJFKdnfnnBKgKu8EfNdTnT7DY6EoCBWsbN0wjIPcp5ihswGqL5Aihf X-Received: by 2002:a05:6122:2211:b0:4a0:6fd4:4333 with SMTP id bb17-20020a056122221100b004a06fd44333mr11907474vkb.13.1700017620565; Tue, 14 Nov 2023 19:07:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700017620; cv=pass; d=google.com; s=arc-20160816; b=C4Lg1kkckVAJZzy3rr5pluVTzYBkDsolg75Mb36Yke8VSo4jxO117pSlIhZGW5KAJE iOh4nZuq+C/sld04g7n4UlArcEwmsis7e1Ig7uVPmMMg2tE5iDediVVWcA6vw0pMOS1S 8Yix57dY2YBL2AmCqV6j9v/8MPixD7pgzt1QbK6q5p7hd6K3IGMI7CrOYEMx+EANHo5Y UodqomyBC6O3k8P5K6bsIiXr8MGPaCqVWVKot3uuMIcXWw6kj2+Zy2F7QVQnrOR3pazc WhsWYa01ga8JJR+HraQ8a8HnBLTKMnimU2dG6CLGI1EArEZLmV8RyV9MssbrhC/ncSTl 1ZRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=Nt4BF3YV7OdGAv2+Y0v+I7Jndd5v8sR8rqsQrhH+IiY=; fh=AJ+XyiCK9C45D31PcueuCqgpHIDRP2j25uBOQsJKm1w=; b=KeX15zAjgWViAn+nU7ujMBFHw4kC3fEaI7TRQwW6ctC3StqLjUzoMa77pDJRmou2Hn cKrPbUezvhLmEPlySXQcpO3zBSmYUsoJOFcGCRZKGXwJ3hf9cXnyAXXpPiCz1Au4epND Zx1r0CZWvlZdhq2icxcMu8QjgRUQRfgMhAsJqUn33Q58EQfSBIK7+3oa79BgSHAo5cTI dM0HfCpUk4EuxQZABpLkZJYKU3Du0ctDFm7KaRkdfa5aGEMRBQ3ropJrV/uWhgQYDy88 jnxc0Tej7Q/6OvQj8n/HnjuHtGDN9KCxhtgzbBiyNWRx1nk2aVvrqCc45PYnhHfIaCK/ X22g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pu2t5wC3; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p12-20020a05622a00cc00b0040551209eb5si8160491qtw.585.2023.11.14.19.07.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 19:07:00 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pu2t5wC3; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E83A3858C5E for ; Wed, 15 Nov 2023 03:07:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 4FD903858D20; Wed, 15 Nov 2023 03:06:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FD903858D20 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4FD903858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700017596; cv=none; b=VfwR9kyUfb5i9tBXvsZ15j3C+T653XUOV0/3+67+hXbOl9TRN3QCNrJQ2mclzrq5dtxDIvu22jDe1r2xJm+vmCNa4ZnpC5yYUpd+Y6t5dPp+/RJvzD11rzxwAcClWn+cfna/mG/20eZ4TfFx4/HQ47wv88Oo7Uy6bWNPTKQOSzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700017596; c=relaxed/simple; bh=KITCwFxRgQB48/VmNCgZyu2tA83YiADCkg7O8zKjlwY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TtMWZ3OzH5hjdJjaEoUaTd+6UafqrRRLFUJuv6D2cpHPcTNG8S/chL0CFtfUzuLJlN9wbSWr+TazP+a6Nt6wh8c6T/X0keQqJYoZfOAubhesE/+FwWBl98FcqAq84zQs0aaZIJdGLbi2aMzTBl6cL3C8E2Xenv1FANlBK36QRFA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF35jDQ024270; Wed, 15 Nov 2023 03:06:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=Nt4BF3YV7OdGAv2+Y0v+I7Jndd5v8sR8rqsQrhH+IiY=; b=pu2t5wC3VNeOJsnggeMjFJvasI+043AOXQ4Fbja8tm+SvGNcaW0/1CEmUg75ZgI2bqc8 A5b2cbXroHXvBbe50gIMhxms78ovlSHkky7uWLY9XQdsCF0WRAMvRNu/7U2A1mA9AajA KyESdUPp1YzpXv6e5OckNHP0iEo8C9UK8UrRKd/Zw3HBN4k0HYyLuFnRvVTKQtFDpcCo rzREvl0xTrT/Mj4EPNi3q9MlQNWwWRVTKWZqKfovwJHzlK9O12XUcBAVvKZq8vFq1aOy 3G3yli5pPiypIQFkV6MhIPQN/On8gQsPpkQjV5kwZ83PwhQDjxcYCdyvNV+9qXRqRy2z Gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ucns9g18v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 03:06:32 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AF36Whh028981; Wed, 15 Nov 2023 03:06:32 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ucns9g155-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 03:06:32 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF1Oaml015464; Wed, 15 Nov 2023 03:02:44 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uakxsvsv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 03:02:44 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AF32feF2949766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 03:02:41 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CDF22004B; Wed, 15 Nov 2023 03:02:41 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4724F20040; Wed, 15 Nov 2023 03:02:40 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 03:02:40 +0000 (GMT) From: Jiufu Guo To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, guojiufu@linux.ibm.com Subject: [PATCH V2 2/3] Using pli to split 34bits constant Date: Wed, 15 Nov 2023 11:02:36 +0800 Message-Id: <20231115030237.1188073-2-guojiufu@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231115030237.1188073-1-guojiufu@linux.ibm.com> References: <20231115030237.1188073-1-guojiufu@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: y3xqAGJhxtj0t_k_mwYf5SZ_Qn0cc-N- X-Proofpoint-GUID: jNHZszFEod1lBf8DH_2G02j31EGcqDYU X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_01,2023-11-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 impostorscore=0 adultscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150024 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782597676920440009 X-GMAIL-MSGID: 1782597676920440009 Hi, For constants with 16bit values, 'li or lis' can be used to generate the value. For 34bit constant, 'pli' is ok to generate the value. For example: 0x6666666666666666ULL, "pli 3,1717986918; rldimi 3,3,32,0" can be used. Compare with previous: https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634196.html This verion updates a testcase to cover this functionality. Bootstrap®test pass on ppc64{,le}. Is this ok for trunk? BR, Jeff (Jiufu Guo) gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add code to use pli for 34bit constant. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr93012.c: Update to check pli. --- gcc/config/rs6000/rs6000.cc | 9 +++++++++ gcc/testsuite/gcc.target/powerpc/pr93012.c | 1 + 2 files changed, 10 insertions(+) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index ba40dd6eee4..b277c52687b 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -10504,6 +10504,15 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c, int *num_insns) return; \ } + if (TARGET_PREFIXED && SIGNED_INTEGER_34BIT_P (c)) + { + /* li/lis/pli */ + ADJUST_INSN_NUM_AND_RET (1); + + emit_move_insn (dest, GEN_INT (c)); + return; + } + if ((ud4 == 0xffff && ud3 == 0xffff && ud2 == 0xffff && (ud1 & 0x8000)) || (ud4 == 0 && ud3 == 0 && ud2 == 0 && !(ud1 & 0x8000))) { diff --git a/gcc/testsuite/gcc.target/powerpc/pr93012.c b/gcc/testsuite/gcc.target/powerpc/pr93012.c index 4f764d0576f..a07ff764bbf 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr93012.c +++ b/gcc/testsuite/gcc.target/powerpc/pr93012.c @@ -10,4 +10,5 @@ unsigned long long mskh1() { return 0xffff9234ffff9234ULL; } unsigned long long mskl1() { return 0x2bcdffff2bcdffffULL; } unsigned long long mskse() { return 0xffff1234ffff1234ULL; } +/* { dg-final { scan-assembler-times {\mpli\M} 4 { target has_arch_pwr10 }} } */ /* { dg-final { scan-assembler-times {\mrldimi\M} 7 } } */