mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-04 06:29:58 +08:00
66c26e5cfd
Given we have code like below: typedef char vnx16i __attribute__ ((vector_size (16))); vnx16i __attribute__ ((noinline, noclone)) test (vnx16i x, vnx16i y) { return __builtin_shufflevector (x, y, 11, 12, 13, 14, 11, 12, 13, 14, 11, 12, 13, 14, 11, 12, 13, 14); } It can perform the auto vectorization when -march=rv64gcv_zvl1024b --param=riscv-autovec-preference=fixed-vlmax but cannot when -march=rv64gcv_zvl2048b --param=riscv-autovec-preference=fixed-vlmax The reason comes from the miniaml machine mode of QI is RVVMF8QI, which is 1024 / 8 = 128 bits, aka the size of VNx16QI. When we set zvl2048b, the bit size of RVVMFQI is 2048 / 8 = 256, which is not matching the bit size of VNx16QI (128 bits). Thus, this patch would like to enable the VLS mode for such case, aka VNx16QI vls mode for zvl2048b. Before this patch: test: srli a4,a1,40 andi a4,a4,0xff srli a3,a1,32 srli a5,a1,48 slli a0,a4,8 andi a3,a3,0xff andi a5,a5,0xff slli a2,a5,16 or a0,a3,a0 srli a1,a1,56 or a0,a0,a2 slli a2,a1,24 slli a3,a3,32 or a0,a0,a2 slli a4,a4,40 or a0,a0,a3 slli a5,a5,48 or a0,a0,a4 or a0,a0,a5 slli a1,a1,56 or a0,a0,a1 mv a1,a0 ret After this patch: test: vsetivli zero,16,e8,mf8,ta,ma vle8.v v2,0(a1) vsetivli zero,4,e32,mf2,ta,ma vrgather.vi v1,v2,3 vsetivli zero,16,e8,mf8,ta,ma vse8.v v1,0(a0) ret PR target/111857 gcc/ChangeLog: * config/riscv/riscv-opts.h (TARGET_VECTOR_VLS): Remove. * config/riscv/riscv-protos.h (vls_mode_valid_p): New func decl. * config/riscv/riscv-v.cc (autovectorize_vector_modes): Replace macro reference to func. (vls_mode_valid_p): New func impl for vls mode valid or not. * config/riscv/riscv-vector-switch.def (VLS_ENTRY): Replace macro reference to func. * config/riscv/vector-iterators.md: Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/perm-4.c: Adjust checker. * gcc.target/riscv/rvv/autovec/vls/def.h: Add help define. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-0.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-1.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-2.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-3.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-4.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-5.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/pr111857-6.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com> |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
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.