* [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.
@ 2022-07-07 8:04 Lulu Cheng
2022-07-07 8:31 ` WANG Xuerui
0 siblings, 1 reply; 3+ messages in thread
From: Lulu Cheng @ 2022-07-07 8:04 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, xuchenghua, Lulu Cheng
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_compute_frame_info):
Modify fp_sp_offset and gp_sp_offset's calculation method,
when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD
or UNITS_PER_FP_REG.
---
gcc/config/loongarch/loongarch.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
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)
frame->frame_pointer_offset = offset;
/* Next are the callee-saved FPRs. */
if (frame->fmask)
- offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
- frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
+ {
+ offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
+ frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
+ }
+ else
+ frame->fp_sp_offset = offset;
/* Next are the callee-saved GPRs. */
if (frame->mask)
{
@@ -931,8 +935,10 @@ loongarch_compute_frame_info (void)
frame->save_libcall_adjustment = x_save_size;
offset += x_save_size;
+ frame->gp_sp_offset = offset - UNITS_PER_WORD;
}
- frame->gp_sp_offset = offset - UNITS_PER_WORD;
+ else
+ frame->gp_sp_offset = offset;
/* The hard frame pointer points above the callee-saved GPRs. */
frame->hard_frame_pointer_offset = offset;
/* Above the hard frame pointer is the callee-allocated varags save area. */
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.
2022-07-07 8:04 [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero Lulu Cheng
@ 2022-07-07 8:31 ` WANG Xuerui
2022-07-07 8:58 ` Xi Ruoyao
0 siblings, 1 reply; 3+ messages in thread
From: WANG Xuerui @ 2022-07-07 8:31 UTC (permalink / raw)
To: Lulu Cheng, gcc-patches; +Cc: xry111, xuchenghua
Hi,
On 2022/7/7 16:04, Lulu Cheng wrote:
> gcc/ChangeLog:
>
> * config/loongarch/loongarch.cc (loongarch_compute_frame_info):
> Modify fp_sp_offset and gp_sp_offset's calculation method,
> when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD
> or UNITS_PER_FP_REG.
IMO it's better to also state which problem this change is meant to
solve (i.e. your intent), better yet, with an appropriate bugzilla link.
> ---
> gcc/config/loongarch/loongarch.cc | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> 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)
> frame->frame_pointer_offset = offset;
> /* Next are the callee-saved FPRs. */
> if (frame->fmask)
> - offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> - frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> + {
> + offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> + frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> + }
> + else
> + frame->fp_sp_offset = offset;
> /* Next are the callee-saved GPRs. */
> if (frame->mask)
> {
> @@ -931,8 +935,10 @@ loongarch_compute_frame_info (void)
> frame->save_libcall_adjustment = x_save_size;
>
> offset += x_save_size;
> + frame->gp_sp_offset = offset - UNITS_PER_WORD;
> }
> - frame->gp_sp_offset = offset - UNITS_PER_WORD;
> + else
> + frame->gp_sp_offset = offset;
> /* The hard frame pointer points above the callee-saved GPRs. */
> frame->hard_frame_pointer_offset = offset;
> /* Above the hard frame pointer is the callee-allocated varags save area. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.
2022-07-07 8:31 ` WANG Xuerui
@ 2022-07-07 8:58 ` Xi Ruoyao
0 siblings, 0 replies; 3+ messages in thread
From: Xi Ruoyao @ 2022-07-07 8:58 UTC (permalink / raw)
To: WANG Xuerui, Lulu Cheng, gcc-patches; +Cc: xuchenghua
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
> 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.
> > ---
> > gcc/config/loongarch/loongarch.cc | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > 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)
> > frame->frame_pointer_offset = offset;
> > /* Next are the callee-saved FPRs. */
> > if (frame->fmask)
> > - offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> > - frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> > + {
> > + offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> > + frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> > + }
> > + else
> > + frame->fp_sp_offset = offset;
> > /* Next are the callee-saved GPRs. */
> > if (frame->mask)
> > {
> > @@ -931,8 +935,10 @@ loongarch_compute_frame_info (void)
> > frame->save_libcall_adjustment = x_save_size;
> >
> > offset += x_save_size;
> > + frame->gp_sp_offset = offset - UNITS_PER_WORD;
> > }
> > - frame->gp_sp_offset = offset - UNITS_PER_WORD;
> > + else
> > + frame->gp_sp_offset = offset;
> > /* The hard frame pointer points above the callee-saved GPRs.
> > */
> > frame->hard_frame_pointer_offset = offset;
> > /* Above the hard frame pointer is the callee-allocated varags
> > save area. */
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-07 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 8:04 [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero Lulu Cheng
2022-07-07 8:31 ` WANG Xuerui
2022-07-07 8:58 ` Xi Ruoyao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).