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 <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University