From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 6A1373858D32 for ; Thu, 7 Jul 2022 08:58:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A1373858D32 Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id EE7E866869; Thu, 7 Jul 2022 04:58:52 -0400 (EDT) Message-ID: <05d3c1293e6eddf7dcc95dbb09c15c76a8cd25e1.camel@xry111.site> Subject: Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero. From: Xi Ruoyao To: WANG Xuerui , Lulu Cheng , gcc-patches@gcc.gnu.org Cc: xuchenghua@loongson.cn Date: Thu, 07 Jul 2022 16:58:50 +0800 In-Reply-To: References: <20220707080428.2236776-1-chenglulu@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.3 MIME-Version: 1.0 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, KAM_SHORT, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD, 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-List-Received-Date: Thu, 07 Jul 2022 08:58:56 -0000 On Thu, 2022-07-07 at 16:31 +0800, WANG Xuerui wrote: > IMO it's better to also state which problem this change is meant to=20 > solve (i.e. your intent), better yet, with an appropriate bugzilla > link. And/or add a testcase (which FAILs without this change) into gcc/testsuite/gcc.target/loongarch. > > --- > > =C2=A0 gcc/config/loongarch/loongarch.cc | 12 +++++++++--- > > =C2=A0 1 file changed, 9 insertions(+), 3 deletions(-) > >=20 > > diff --git a/gcc/config/loongarch/loongarch.cc > > b/gcc/config/loongarch/loongarch.cc > > index d72b256df51..5c9a33c14f7 100644 > > --- a/gcc/config/loongarch/loongarch.cc > > +++ b/gcc/config/loongarch/loongarch.cc > > @@ -917,8 +917,12 @@ loongarch_compute_frame_info (void) > > =C2=A0=C2=A0=C2=A0 frame->frame_pointer_offset =3D offset; > > =C2=A0=C2=A0=C2=A0 /* Next are the callee-saved FPRs.=C2=A0 */ > > =C2=A0=C2=A0=C2=A0 if (frame->fmask) > > -=C2=A0=C2=A0=C2=A0 offset +=3D LARCH_STACK_ALIGN (num_f_saved * UNITS_= PER_FP_REG); > > -=C2=A0 frame->fp_sp_offset =3D offset - UNITS_PER_FP_REG; > > +=C2=A0=C2=A0=C2=A0 { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 offset +=3D LARCH_STACK_ALIGN (num_f_sa= ved * UNITS_PER_FP_REG); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 frame->fp_sp_offset =3D offset - UNITS_= PER_FP_REG; > > +=C2=A0=C2=A0=C2=A0 } > > +=C2=A0 else > > +=C2=A0=C2=A0=C2=A0 frame->fp_sp_offset =3D offset; > > =C2=A0=C2=A0=C2=A0 /* Next are the callee-saved GPRs.=C2=A0 */ > > =C2=A0=C2=A0=C2=A0 if (frame->mask) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { > > @@ -931,8 +935,10 @@ loongarch_compute_frame_info (void) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0frame->save_libcall_adj= ustment =3D x_save_size; > > =C2=A0=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 offset +=3D x_save_size; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 frame->gp_sp_offset =3D offset - UNITS_= PER_WORD; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > -=C2=A0 frame->gp_sp_offset =3D offset - UNITS_PER_WORD; > > +=C2=A0 else > > +=C2=A0=C2=A0=C2=A0 frame->gp_sp_offset =3D offset; > > =C2=A0=C2=A0=C2=A0 /* The hard frame pointer points above the callee-sa= ved GPRs.=C2=A0 > > */ > > =C2=A0=C2=A0=C2=A0 frame->hard_frame_pointer_offset =3D offset; > > =C2=A0=C2=A0=C2=A0 /* Above the hard frame pointer is the callee-alloca= ted varags > > save area.=C2=A0 */ --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University