From patchwork Fri Jun 30 05:57:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 114572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10128733vqr; Thu, 29 Jun 2023 22:58:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMKTSSasaYPZg/xl8H6y+HDK792acVKAdq+lWRMAbNsPYYtr3WeEWtkd6u3juWsuaPMmXx X-Received: by 2002:a17:906:c408:b0:991:caa8:fc3a with SMTP id u8-20020a170906c40800b00991caa8fc3amr833723ejz.72.1688104690017; Thu, 29 Jun 2023 22:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688104690; cv=none; d=google.com; s=arc-20160816; b=a0PTmNVjyq3lZjoXfMhLIOHwfjy+YWijsPGyVMzjHpl4BIfGrqyHsN3Ni95HOSOJku SGBQq0YHEV9tky22azyx11JHkYHKV/i3I1I7JXWqt3SCvwF81yBjjDz+tvLX2NFxsIuB XZwaulaxdx5s+NSptp+84BAFiqemFvQoLdzmEqTT8oKHWd8y+t+a71xojnVbEW/L7dRg 3HL1Rc4/vYtU1DNaO2oS/IfmtNxBfkd1uJsFciu5tzIoGPCVVw0k2FQv/2A67bRmYxsv zYGTyVs/4hKHNWmNOPHnnj5Qs8NBjWGiNFG3ipdg1ZHhbZ/Oc3d+AdVqGbe79w+bOla2 PTdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=hGHVrvbEVu3jpJHjbPeWLQ23EPLNLjZDJQ8SCGVFSFM=; fh=JfKmbSeM6fXZIM00SzGWS+35iyIQip/nJNOoiv7NlbU=; b=aJ7QWfCu3tqcok2kdWCn4iYAKSn+G7dg84VwYgRbTSlvF4xElqB5fb7O/7QrC1qHSD MkhSHp6laJsYxqkOvAl+Gbcq7GEJlvxQKPzo2BpsIak5j48yp4NiFQB1Jxc6idxDzEM1 DcgY89HzQt8C5KGYQ13PtAsAgqvFJAIFuYP95VpjPwQXjgIl1292NcB+UBA4qVV1VI6S pCZwkvIGZnMgFV1BmVsUee/hgabl74hEri+agRnv81KMRhYpFoNqkzAtGsQbU1NRXuRN ll4gln05hA46DnhLNdVvJYX+sLhEjTpCPK/epttHf+wUTIdzsZ+79d4ob4DNWDTMREAM gskw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=na6+K7NC; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id qn10-20020a170907210a00b0098e229400acsi6549479ejb.324.2023.06.29.22.58.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 22:58:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=na6+K7NC; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E06ED3857726 for ; Fri, 30 Jun 2023 05:58:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E06ED3857726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688104688; bh=hGHVrvbEVu3jpJHjbPeWLQ23EPLNLjZDJQ8SCGVFSFM=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=na6+K7NCVTarH+u5f9Nbel05pRDvSgdJQPRcFxNDWCBKfGdKfEqMl66o71q354t22 6ZTShVOFP1Kc4931m0nh75PjYiL7OvzWqKRLut/FWjAiVvEaDy86pxODubUEqtA9Jx DnpuBHlhLWJsp7QoCopEFeZs0CkA9qXuybqJOLYg= 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 5D2613858280 for ; Fri, 30 Jun 2023 05:57:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D2613858280 Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35U5ktXO017742; Fri, 30 Jun 2023 05:57:22 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rhs7086w3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 05:57:21 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35U5vLQQ016683; Fri, 30 Jun 2023 05:57:21 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rhs7086vn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 05:57:21 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35U4D3jx012979; Fri, 30 Jun 2023 05:57:19 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3rdr452xad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 05:57:19 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35U5vHda7078512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Jun 2023 05:57:17 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4467120043; Fri, 30 Jun 2023 05:57:17 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCDE720040; Fri, 30 Jun 2023 05:57:14 +0000 (GMT) Received: from [9.200.56.250] (unknown [9.200.56.250]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 30 Jun 2023 05:57:14 +0000 (GMT) Message-ID: <62a04bba-f0b2-7cde-abca-ee72f524e256@linux.ibm.com> Date: Fri, 30 Jun 2023 13:57:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH 3/3] rs6000: Teach legitimate_address_p about LEN_{LOAD, STORE} [PR110248] Content-Language: en-US To: GCC Patches Cc: Richard Biener , Richard Sandiford , Segher Boessenkool , David Edelsohn , Peter Bergner References: <7928a68a-cb83-3cd7-eacd-63e3f7c2445c@linux.ibm.com> In-Reply-To: <7928a68a-cb83-3cd7-eacd-63e3f7c2445c@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 71qYOisOS06Qa7Brx2vOFx8XMLef_S5Q X-Proofpoint-GUID: wG8rek21QRiVswgoOnW9XAONnGXkI3WP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-30_02,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306300048 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_MSPIKE_H5, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770106063533593521?= X-GMAIL-MSGID: =?utf-8?q?1770106063533593521?= Hi, This patch is to teach rs6000_legitimate_address_p to handle the queried rtx constructed for LEN_{LOAD,STORE}, since lxvl and stxvl doesn't support x-form or ds-form, so consider it as not legitimate when outer code is PLUS. This can help to fix SPEC2017 503.bwaves_r degradation as reported in PR110248 (note that with explicit option --param=vect-partial-vector-usage=2), also +1.69% for 507.cactuBSSN_r, +2.35% for 510.parest_r (likely noise), the others are neutral. I didn't associate one test case for this as I think checking some dumping of ivopts or final assembly insns seems quite fragile. Bootstrapped and regtested on powerpc64-linux-gnu P7/P8/P9 and powerpc64le-linux-gnu P9/P10. Is it ok for trunk? BR, Kewen ------ PR tree-optimization/110248 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_legitimate_address_p): Check if the given code is for ifn LEN_{LOAD,STORE}, if yes then make it not legitimate when outer code is PLUS. --- gcc/config/rs6000/rs6000.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.39.3 diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index efc54528b23..f5c9289fda0 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -9856,7 +9856,7 @@ use_toc_relative_ref (rtx sym, machine_mode mode) during assembly output. */ static bool rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict, - code_helper = ERROR_MARK) + code_helper ch = ERROR_MARK) { bool reg_offset_p = reg_offset_addressing_ok_p (mode); bool quad_offset_p = mode_supports_dq_form (mode); @@ -9864,6 +9864,12 @@ rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict, if (TARGET_ELF && RS6000_SYMBOL_REF_TLS_P (x)) return 0; + /* lxvl and stxvl doesn't support any addressing modes with PLUS. */ + if (ch.is_internal_fn () + && (ch == IFN_LEN_LOAD || ch == IFN_LEN_STORE) + && GET_CODE (x) == PLUS) + return 0; + /* Handle unaligned altivec lvx/stvx type addresses. */ if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) && GET_CODE (x) == AND