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 DD1A03858D32; Tue, 13 Jun 2023 02:16:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD1A03858D32 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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D2FjLm002995; Tue, 13 Jun 2023 02:15:58 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 : mime-version : content-type : content-transfer-encoding; s=pp1; bh=789sPlVwzgnsjnVFmz9I2vtd8a5rJmBBmlNQWWxSI6Q=; b=XbQdLfmY4/IK26iaIQELWzT25qW3sFgk7XqRvvePRbCQMmWlteEz3lHtxeNKYp/4yIH/ YGyP1GQie3yGAk3KyekMCZCF1MHwaSfX0E9jAtH/ahGY/m8z57BU6aFzKwyDrOCpfLvD e4hI0oFnIjyC1jOrPhfAo1+DGyf+Dj/c751qYcl3K3ZpQkQyXre3gNVNw3cm/olb/+6C ShUAfoxuYVoFqauzSFo5zm9UIofRRrqYe7r5pCof8eGsBdmEeO7Zr5JxkN70YQxh/qcR jQN/60bDQXuxNPdibGvxQRIG9KhovxAHsWp4O+CfIkwTv8BGj857mxpntcdlVjF0X8iE bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r6fh2806e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 02:15:57 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35D2FvSH003344; Tue, 13 Jun 2023 02:15:57 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r6fh2805y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 02:15:57 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35D025rc012038; Tue, 13 Jun 2023 02:15:56 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5x4dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 02:15:56 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35D2FseU66257304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2023 02:15:55 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DAC658055; Tue, 13 Jun 2023 02:15:54 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72E0F58043; Tue, 13 Jun 2023 02:15:54 +0000 (GMT) Received: from ltcden2-lp1.aus.stglabs.ibm.com (unknown [9.3.90.43]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTPS; Tue, 13 Jun 2023 02:15:54 +0000 (GMT) From: Jiufu Guo To: David Edelsohn Cc: gcc-patches@gcc.gnu.org, segher@kernel.crashing.org, linkw@gcc.gnu.org, bergner@linux.ibm.com, rguenther@suse.de, richard.sandiford@arm.com Subject: Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie References: <20230612131919.269681-1-guojiufu@linux.ibm.com> Date: Tue, 13 Jun 2023 10:15:49 +0800 In-Reply-To: (David Edelsohn's message of "Mon, 12 Jun 2023 20:24:24 -0400") Message-ID: <7nv8fscdka.fsf@ltcden2-lp1.aus.stglabs.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MZnWH2AJceV73NkTgjU866r8oEGpxOJK X-Proofpoint-ORIG-GUID: eqxDdiM-sgKVUmG6DQ46Bf2E4lZugCij X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_18,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130016 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: Hi David, David Edelsohn writes: > Hi, Jiufu > > This definitely seems to be a better solution. > > The TARGET_CONST_ANCHOR change should not be part of this patch. Also > there is no ChangeLog for the patch. Thanks a lot for your quick review!! And sorry for the sending this patch in a hurry. I would update the patch accordingly. BR, Jeff (Jiufu Guo) > > This generally looks correct and consistent with other ports. I want > to give Segher a chance to double check it, if he wishes. > > Thanks David > > On Mon, Jun 12, 2023 at 9:19=E2=80=AFAM Jiufu Guo wrote: >> >> Hi, >> >> For stack_tie, currently below insn is generated: >> (insn 15 14 16 3 (parallel [ >> (set (mem/c:BLK (reg/f:DI 1 1) [1 A8]) >> (const_int 0 [0])) >> ]) "/home/guojiufu/temp/gdb.c":13:3 922 {stack_tie} >> (nil)) >> >> It is "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0 [0])". This maybe >> looks like "a memory block is zerored", while actually stack_tie >> may be more like a placeholder, and does not generate any thing. >> >> To avoid potential misunderstand, "UNPSEC:BLK [(const_int 0)].." could >> be used here like other ports. >> >> This patch does this. Bootstrap®test pass on ppc64{,le}. >> Is this ok for trunk? >> >> BR, >> Jeff (Jiufu Guo) >> >> --- >> gcc/config/rs6000/predicates.md | 11 +++++++---- >> gcc/config/rs6000/rs6000-logue.cc | 4 +++- >> gcc/config/rs6000/rs6000.cc | 4 ++++ >> gcc/config/rs6000/rs6000.md | 14 ++++++++++---- >> 4 files changed, 24 insertions(+), 9 deletions(-) >> >> diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predica= tes.md >> index a16ee30f0c0..4748cb37ce8 100644 >> --- a/gcc/config/rs6000/predicates.md >> +++ b/gcc/config/rs6000/predicates.md >> @@ -1854,10 +1854,13 @@ (define_predicate "stmw_operation" >> (define_predicate "tie_operand" >> (match_code "parallel") >> { >> - return (GET_CODE (XVECEXP (op, 0, 0)) =3D=3D SET >> - && MEM_P (XEXP (XVECEXP (op, 0, 0), 0)) >> - && GET_MODE (XEXP (XVECEXP (op, 0, 0), 0)) =3D=3D BLKmode >> - && XEXP (XVECEXP (op, 0, 0), 1) =3D=3D const0_rtx); >> + rtx set =3D XVECEXP (op, 0, 0); >> + return (GET_CODE (set) =3D=3D SET >> + && MEM_P (SET_DEST (set)) >> + && GET_MODE (SET_DEST (set)) =3D=3D BLKmode >> + && GET_CODE (SET_SRC (set)) =3D=3D UNSPEC >> + && XINT (SET_SRC (set), 1) =3D=3D UNSPEC_TIE >> + && XVECEXP (SET_SRC (set), 0, 0) =3D=3D const0_rtx); >> }) >> >> ;; Match a small code model toc reference (or medium and large >> diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs600= 0-logue.cc >> index bc6b153b59f..b99f43a8282 100644 >> --- a/gcc/config/rs6000/rs6000-logue.cc >> +++ b/gcc/config/rs6000/rs6000-logue.cc >> @@ -1463,7 +1463,9 @@ rs6000_emit_stack_tie (rtx fp, bool hard_frame_nee= ded) >> while (--i >=3D 0) >> { >> rtx mem =3D gen_frame_mem (BLKmode, regs[i]); >> - RTVEC_ELT (p, i) =3D gen_rtx_SET (mem, const0_rtx); >> + RTVEC_ELT (p, i) >> + =3D gen_rtx_SET (mem, gen_rtx_UNSPEC (BLKmode, gen_rtvec (1, con= st0_rtx), >> + UNSPEC_TIE)); >> } >> >> emit_insn (gen_stack_tie (gen_rtx_PARALLEL (VOIDmode, p))); >> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc >> index d197c3f3289..0c81ebea711 100644 >> --- a/gcc/config/rs6000/rs6000.cc >> +++ b/gcc/config/rs6000/rs6000.cc >> @@ -1760,6 +1760,10 @@ static const struct attribute_spec rs6000_attribu= te_table[] =3D >> >> #undef TARGET_UPDATE_IPA_FN_TARGET_INFO >> #define TARGET_UPDATE_IPA_FN_TARGET_INFO rs6000_update_ipa_fn_target_in= fo >> + >> +#undef TARGET_CONST_ANCHOR >> +#define TARGET_CONST_ANCHOR 0x8000 >> + >> >> >> /* Processor table. */ >> diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md >> index b0db8ae508d..fdcf8347812 100644 >> --- a/gcc/config/rs6000/rs6000.md >> +++ b/gcc/config/rs6000/rs6000.md >> @@ -158,6 +158,7 @@ (define_c_enum "unspec" >> UNSPEC_HASHCHK >> UNSPEC_XXSPLTIDP_CONST >> UNSPEC_XXSPLTIW_CONST >> + UNSPEC_TIE >> ]) >> >> ;; >> @@ -10828,7 +10829,9 @@ (define_expand "restore_stack_block" >> operands[4] =3D gen_frame_mem (Pmode, operands[1]); >> p =3D rtvec_alloc (1); >> RTVEC_ELT (p, 0) =3D gen_rtx_SET (gen_frame_mem (BLKmode, operands[0]= ), >> - const0_rtx); >> + gen_rtx_UNSPEC (BLKmode, >> + gen_rtvec (1, const0_r= tx), >> + UNSPEC_TIE)); >> operands[5] =3D gen_rtx_PARALLEL (VOIDmode, p); >> }) >> >> @@ -10866,7 +10869,9 @@ (define_expand "restore_stack_nonlocal" >> operands[5] =3D gen_frame_mem (Pmode, operands[3]); >> p =3D rtvec_alloc (1); >> RTVEC_ELT (p, 0) =3D gen_rtx_SET (gen_frame_mem (BLKmode, operands[0]= ), >> - const0_rtx); >> + gen_rtx_UNSPEC (BLKmode, >> + gen_rtvec (1, const0_r= tx), >> + UNSPEC_TIE)); >> operands[6] =3D gen_rtx_PARALLEL (VOIDmode, p); >> }) >> >> @@ -13898,7 +13903,8 @@ (define_insn "*save_fpregs__r1" >> ; not be moved over loads from or stores to stack memory. >> (define_insn "stack_tie" >> [(match_parallel 0 "tie_operand" >> - [(set (mem:BLK (reg 1)) (const_int 0))])] >> + [(set (mem:BLK (reg 1)) >> + (unspec:BLK [(const_int 0)] UNSPEC_TIE))])] >> "" >> "" >> [(set_attr "length" "0")]) >> @@ -13910,7 +13916,7 @@ (define_insn "stack_restore_tie" >> [(set (match_operand:SI 0 "gpc_reg_operand" "=3Dr,r") >> (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") >> (match_operand:SI 2 "reg_or_cint_operand" "O,rI"))) >> - (set (mem:BLK (scratch)) (const_int 0))] >> + (set (mem:BLK (scratch)) (unspec:BLK [(const_int 0)] UNSPEC_TIE))] >> "TARGET_32BIT" >> "@ >> mr %0,%1 >> -- >> 2.39.3 >>