GCC modified for the FreeChainXenon project
Find a file
Juzhe-Zhong 5ea3c039b7 RISC-V: Fix redundant vsetvl in fixed-vlmax vectorized codes[PR112326]
With compile option --param=riscv-autovec-preference=fixed-vlmax, we have
redundant AVL/VL toggling:

	vsetvli	a5,a3,e8,mf4,ta,ma -> should be changed into e32m1
	vle32.v	v1,0(a1)
	vle32.v	v2,0(a0)
	vsetivli	zero,4,e32,m1,ta,ma -> redundant
	slli	a2,a5,2
	vadd.vv	v1,v1,v2
	sub	a3,a3,a5
	vsetvli	zero,a5,e32,m1,ta,ma -> redundant
	vse32.v	v1,0(a4)
	add	a0,a0,a2
	add	a1,a1,a2
	add	a4,a4,a2
	bne	a3,zero,.L3

The root cause is because we simplify AVL into immediate AVL too early
in FIXED-VLMAX situation. The later avlprop PASS failed to propagate AVL
generated by (SELECT_VL/vsetvl VL, AVL) into the normal RVV instruction.

So we need to remove immedate AVL simplification in 'expand' stage.

After this patch:

  	vsetvli	a5,a3,e32,m1,ta,ma
	slli	a2,a5,2
	vle32.v	v1,0(a1)
	vle32.v	v2,0(a0)
	sub	a3,a3,a5
	vadd.vv	v1,v1,v2
	vse32.v	v1,0(a4)
	add	a0,a0,a2
	add	a1,a1,a2
	add	a4,a4,a2
	bne	a3,zero,.L3

After the removed simplification, the following situation should be fixed:
typedef int8_t vnx2qi __attribute__ ((vector_size (2)));

__attribute__ ((noipa)) void
f_vnx2qi (int8_t a, int8_t b, int8_t *out)
{
  vnx2qi v = {a, b};
  *(vnx2qi *) out = v;
}

We should use vsetvili zero, 2 instead of vsetvl a5,zero.
Such simplification is done in avlprop PASS which is also included in this patch
to fix regression of these situation.

	PR target/112326

gcc/ChangeLog:

	* config/riscv/riscv-avlprop.cc (get_insn_vtype_mode): New function.
	(simplify_replace_vlmax_avl): Ditto.
	(pass_avlprop::execute): Add immediate AVL simplification.
	* config/riscv/riscv-protos.h (imm_avl_p): Rename.
	* config/riscv/riscv-v.cc (const_vlmax_p): Ditto.
	(imm_avl_p): Ditto.
	(emit_vlmax_insn): Adapt for new interface name.
	* config/riscv/vector.md (mode_idx): New attribute.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr112326.c: New test.
2023-11-03 09:08:16 +08:00
.github Minor formatting fix for newly-added file from previous commit 2023-11-01 19:28:56 -04:00
c++tools Daily bump. 2023-06-23 00:16:38 +00:00
config Daily bump. 2023-09-16 00:17:55 +00:00
contrib Daily bump. 2023-10-06 00:17:37 +00:00
fixincludes Daily bump. 2023-10-31 00:17:32 +00:00
gcc RISC-V: Fix redundant vsetvl in fixed-vlmax vectorized codes[PR112326] 2023-11-03 09:08:16 +08:00
gnattools Daily bump. 2023-04-26 00:17:46 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2023-10-26 00:17:43 +00:00
INSTALL
intl Daily bump. 2023-08-08 00:17:37 +00:00
libada Daily bump. 2023-08-08 00:17:37 +00:00
libatomic Daily bump. 2023-10-27 00:17:12 +00:00
libbacktrace Daily bump. 2023-10-23 00:16:43 +00:00
libcc1 Daily bump. 2023-10-23 00:16:43 +00:00
libcody Daily bump. 2023-06-16 00:17:18 +00:00
libcpp Daily bump. 2023-11-03 00:16:58 +00:00
libdecnumber Daily bump. 2023-06-16 00:17:18 +00:00
libffi Daily bump. 2023-10-27 00:17:12 +00:00
libgcc Daily bump. 2023-11-01 00:17:52 +00:00
libgfortran Daily bump. 2023-10-23 00:16:43 +00:00
libgm2 Daily bump. 2023-10-28 00:16:37 +00:00
libgo syscall: add missing type conversion 2023-10-23 14:03:10 -07:00
libgomp Daily bump. 2023-11-01 00:17:52 +00:00
libiberty Daily bump. 2023-08-23 00:17:59 +00:00
libitm Daily bump. 2023-10-23 00:16:43 +00:00
libobjc Daily bump. 2023-10-23 00:16:43 +00:00
libphobos Daily bump. 2023-11-03 00:16:58 +00:00
libquadmath Daily bump. 2023-10-24 00:17:34 +00:00
libsanitizer Daily bump. 2023-10-23 00:16:43 +00:00
libssp Daily bump. 2023-10-23 00:16:43 +00:00
libstdc++-v3 Daily bump. 2023-11-03 00:16:58 +00:00
libvtv Daily bump. 2023-10-23 00:16:43 +00:00
lto-plugin Daily bump. 2023-10-23 00:16:43 +00:00
maintainer-scripts Daily bump. 2023-07-08 00:16:53 +00:00
zlib Daily bump. 2023-10-23 00:16:43 +00:00
.dir-locals.el
.gitattributes
.gitignore .gitignore: do not ignore config.h 2022-07-19 17:07:04 +03:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-11-02 00:17:30 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in LoongArch: Reimplement multilib build option handling. 2023-09-15 10:42:12 +08:00
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure Config,Darwin: Allow for configuring Darwin to use embedded runpath. 2023-10-22 19:30:02 +01:00
configure.ac Config,Darwin: Allow for configuring Darwin to use embedded runpath. 2023-10-22 19:30:02 +01:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Config,Darwin: Allow for configuring Darwin to use embedded runpath. 2023-10-22 19:30:02 +01:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS MAINTAINERS: Fix write after approval name order 2023-10-11 14:53:44 +02:00
Makefile.def sim: add distclean dep for gnulib 2023-10-15 22:40:42 +05:45
Makefile.in sim: add distclean dep for gnulib 2023-10-15 22:40:42 +05:45
Makefile.tpl Makefile.tpl: disable -Werror for feedback stage [PR111663] 2023-10-06 20:25:20 +01:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt secpol: consistent indentation 2023-10-05 12:00:39 -04:00
symlink-tree
test-driver
ylwrap

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.