mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-26 00:06:21 +08:00
In previous, we allowed the target(("arch=+v")) for a function with rv64gc build. This patch would like to support more arch options as below: * zve32x * zve32f * zve64x * zve64f * zve64d * zvfhmin * zvfh * zvk* * zvbb For example, we have sample code as below. vfloat32m1_t __attribute__((target("arch=+zve64f"))) test_9 (vfloat32m1_t a, vfloat32m1_t b, size_t vl) { return __riscv_vfadd_vv_f32m1 (a, b, vl); } It will generate the asm code when build with -O3 -march=rv64gc test_9: vsetvli zero,a0,e32,m1,ta,ma vfadd.vv v8,v8,v9 ret Meanwhile, this patch introduces more error handling for the target attribute. Take arch=+zve32x with vfloat32m1_t will have error message "'vfloat32m1_t' requires the zve32f, zve64f or zve64d ISA extension". And take arch=+zve32f with vfloat16m1_t will have error message "'vfloat16m1_t' requires the zvfhmin or zvfh ISA extension". By default, all the RVV types includes the cmdline march will be registered when include the riscv_vector.h. And we have sorts of check during args and return types. Below test are passed for this patch: * The riscv fully regression test. gcc/ChangeLog: * config/riscv/riscv-c.cc (struct pragma_intrinsic_flags): New struct to hold all intrinisc related flags. (riscv_pragma_intrinsic_flags_pollute): New func to pollute the intrinsic flags and backup original flags. (riscv_pragma_intrinsic_flags_restore): New func to restore the flags from the backup intrinsic flags. (riscv_pragma_intrinsic): Pollute the flags and register all possible builtin types and functions, then restore and reinit. * config/riscv/riscv-protos.h (reinit_builtins): New func decl to reinit after flags pollution. (riscv_option_override): New extern func decl. * config/riscv/riscv-vector-builtins.cc (register_builtin_types_on_null): New func to register builtin types if null. (DEF_RVV_TYPE): Ditto. (DEF_RVV_TUPLE_TYPE): Ditto. (reinit_builtins): New func impl to reinit after flags pollution. (expand_builtin): Return target rtx after error_at. * config/riscv/riscv.cc (riscv_vector_int_type_p): New predicate func to tell one tree type is integer or not. (riscv_vector_float_type_p): New predicate func to tell one tree type is float or not. (riscv_vector_element_bitsize): New func to get the element bitsize of a vector tree type. (riscv_vector_required_min_vlen): New func to get the required min vlen of a vector tree type. (riscv_validate_vector_type): New func to validate the tree type is valid on flags. (riscv_return_value_is_vector_type_p): Leverage the func riscv_validate_vector_type to do the tree type validation. (riscv_arguments_is_vector_type_p): Ditto. (riscv_override_options_internal): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/pr109479-1.c: Adjust the existing test scenarios and add new error check tests. * gcc.target/riscv/rvv/base/pr109479-2.c: Ditto. * gcc.target/riscv/rvv/base/pr109479-3.c: Ditto. * gcc.target/riscv/rvv/base/pr109479-4.c: Diito. * gcc.target/riscv/rvv/base/pr109479-5.c: Diito. * gcc.target/riscv/rvv/base/pr109479-6.c: Diito. * gcc.target/riscv/rvv/base/user-10.c: Ditto. * gcc.target/riscv/rvv/base/user-12.c: Ditto. * gcc.target/riscv/rvv/base/user-13.c: Ditto. * gcc.target/riscv/rvv/base/user-14.c: Ditto. * gcc.target/riscv/rvv/base/user-15.c: Ditto. * gcc.target/riscv/rvv/base/user-2.c: Ditto. * gcc.target/riscv/rvv/base/user-3.c: Ditto. * gcc.target/riscv/rvv/base/user-5.c: Ditto. * gcc.target/riscv/rvv/base/user-6.c: Ditto. * gcc.target/riscv/rvv/base/user-9.c: Ditto. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-10.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-11.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-12.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-13.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-14.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-15.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-16.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-17.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-18.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-19.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-20.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-21.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-22.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-23.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-24.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-25.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-26.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-27.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-28.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-29.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-30.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-31.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-32.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-33.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-34.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-35.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-36.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-37.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-38.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-39.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-40.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-41.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-42.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-43.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-44.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-45.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-46.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-47.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-48.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-49.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-50.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-51.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-52.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-53.c: New test. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-9.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com> |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
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.