Go to file
Lulu Cheng aa8fd7f656 LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.
Under the LA architecture, when the stack is dropped too far, the process
of dropping the stack is divided into two steps.
step1: After dropping the stack, save callee saved registers on the stack.
step2: The rest of it.

The stack drop operation is optimized when frame->total_size minus
frame->sp_fp_offset is an integer multiple of 4096, can reduce the number
of instructions required to drop the stack. However, this optimization is
not effective because of the original calculation method

The following case:
	int main()
	{
  	  char buf[1024 * 12];
  	  printf ("%p\n", buf);
  	  return 0;
	}

As you can see from the generated assembler, the old GCC has two more
instructions than the new GCC, lines 14 and line 24.

	   new                                        old
 10 main:                       | 11 main:
 11   addi.d  $r3,$r3,-16       | 12   lu12i.w $r13,-12288>>12
 12   lu12i.w $r13,-12288>>12   | 13   addi.d  $r3,$r3,-2032
 13   lu12i.w $r5,-12288>>12    | 14   ori $r13,$r13,2016
 14   lu12i.w $r12,12288>>12    | 15   lu12i.w $r5,-12288>>12
 15   st.d  $r1,$r3,8           | 16   lu12i.w $r12,12288>>12
 16   add.d $r12,$r12,$r5       | 17   st.d  $r1,$r3,2024
 17   add.d $r3,$r3,$r13        | 18   add.d $r12,$r12,$r5
 18   add.d $r5,$r12,$r3        | 19   add.d $r3,$r3,$r13
 19   la.local  $r4,.LC0        | 20   add.d $r5,$r12,$r3
 20   bl  %plt(printf)          | 21   la.local  $r4,.LC0
 21   lu12i.w $r13,12288>>12    | 22   bl  %plt(printf)
 22   add.d $r3,$r3,$r13        | 23   lu12i.w $r13,8192>>12
 23   ld.d  $r1,$r3,8           | 24   ori $r13,$r13,2080
 24   or  $r4,$r0,$r0           | 25   add.d $r3,$r3,$r13
 25   addi.d  $r3,$r3,16        | 26   ld.d  $r1,$r3,2024
 26   jr  $r1                   | 27   or  $r4,$r0,$r0
			        | 28   addi.d  $r3,$r3,2032
 				| 29   jr  $r1
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/testsuite/ChangeLog:

	* gcc.target/loongarch/prolog-opt.c: New test.
2022-07-08 11:11:20 +08:00
INSTALL
c++tools Daily bump. 2022-03-19 00:16:22 +00:00
config Daily bump. 2022-06-02 00:16:32 +00:00
contrib Daily bump. 2022-07-05 00:16:36 +00:00
fixincludes Daily bump. 2022-02-28 00:16:17 +00:00
gcc LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero. 2022-07-08 11:11:20 +08:00
gnattools
gotools Daily bump. 2022-02-14 00:16:23 +00:00
include Daily bump. 2022-07-07 00:16:46 +00:00
intl
libada
libatomic Daily bump. 2022-06-03 00:16:40 +00:00
libbacktrace Daily bump. 2022-07-08 00:16:22 +00:00
libcc1 Daily bump. 2022-06-28 00:16:58 +00:00
libcody Daily bump. 2022-06-04 00:16:27 +00:00
libcpp Daily bump. 2022-07-08 00:16:22 +00:00
libdecnumber Daily bump. 2022-05-21 00:16:32 +00:00
libffi
libgcc Daily bump. 2022-06-26 00:16:33 +00:00
libgfortran Daily bump. 2022-06-30 00:16:46 +00:00
libgo libgo: handle stat st_atim32 field and SYS_SECCOMP 2022-06-30 12:35:08 -07:00
libgomp Daily bump. 2022-07-08 00:16:22 +00:00
libiberty Daily bump. 2022-07-05 00:16:36 +00:00
libitm Daily bump. 2022-06-03 00:16:40 +00:00
libobjc
liboffloadmic Daily bump. 2022-07-05 00:16:36 +00:00
libphobos Daily bump. 2022-07-07 00:16:46 +00:00
libquadmath Daily bump. 2022-01-12 00:16:39 +00:00
libsanitizer libsanitizer: Cherry-pick 5d8077565e41 from upstream 2022-07-07 10:19:58 +08:00
libssp
libstdc++-v3 Daily bump. 2022-07-08 00:16:22 +00:00
libvtv
lto-plugin Daily bump. 2022-07-08 00:16:22 +00:00
maintainer-scripts Daily bump. 2022-05-21 00:16:32 +00:00
zlib
.dir-locals.el
.gitattributes
.gitignore Vim swap files not ignored 2022-05-28 09:38:29 -06:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Daily bump. 2022-07-05 00:16:36 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: fix alphabetic sorting 2022-07-04 12:16:32 +02:00
Makefile.def toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.in Add TFLAGS to gcc's GCC_FOR_TARGET 2022-06-28 09:41:07 -03:00
Makefile.tpl Add TFLAGS to gcc's GCC_FOR_TARGET 2022-06-28 09:41:07 -03:00
README
ar-lib
compile
config-ml.in
config.guess
config.rpath
config.sub
configure [gdb/build] Fix gdbserver build with -fsanitize=thread 2022-06-27 10:52:23 +02:00
configure.ac [gdb/build] Fix gdbserver build with -fsanitize=thread 2022-06-27 10:52:23 +02:00
depcomp
install-sh
libtool-ldflags
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
symlink-tree
test-driver
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.