Go to file
Pan Li 5cab64a9cf RISC-V: Allow RVV intrinsic when function target("arch=+v")
This patch would like to allow the RVV intrinsic when function is
attributed as target("arch=+v") and build with rv64gc.  For example:

vint32m1_t
__attribute__((target("arch=+v")))
test_1 (vint32m1_t a, vint32m1_t b, size_t vl)
{
  return __riscv_vadd_vv_i32m1 (a, b, vl);
}

build with -march=rv64gc -mabi=lp64d -O3, we will have asm like below:
test_1:
  .option push
  .option arch, rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_v1p0_zicsr2p0_\
zifencei2p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0
  vsetvli zero,a0,e32,m1,ta,ma
  vadd.vv v8,v8,v9
  ret

The riscv_vector.h must be included when leverage intrinisc type(s) and
API(s).  And the scope of this attribute should not excced the function
body.  Meanwhile, to make rvv types and API(s) available for this attribute,
include riscv_vector.h will not report error for now if v is not present
in march.

Below test are passed for this patch:
* The riscv fully regression test.

gcc/ChangeLog:

	* config/riscv/riscv-c.cc (riscv_pragma_intrinsic): Remove error
	when V is disabled and init the RVV types and intrinic APIs.
	* config/riscv/riscv-vector-builtins.cc (expand_builtin): Report
	error if V ext is disabled.
	* config/riscv/riscv.cc (riscv_return_value_is_vector_type_p):
	Ditto.
	(riscv_arguments_is_vector_type_p): Ditto.
	(riscv_vector_cc_function_p): Ditto.
	* config/riscv/riscv_vector.h: Remove error if V is disable.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/pragma-1.c: Remove.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-1.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-2.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-3.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-4.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-5.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-6.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c: New test.
	* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2024-03-25 20:08:28 +08:00
.github
c++tools
config
contrib
fixincludes
gcc RISC-V: Allow RVV intrinsic when function target("arch=+v") 2024-03-25 20:08:28 +08:00
gnattools
gotools
include
INSTALL
libada
libatomic
libbacktrace
libcc1
libcody
libcpp
libdecnumber
libffi
libgcc Daily bump. 2024-03-23 00:17:26 +00:00
libgfortran
libgm2
libgo
libgomp Daily bump. 2024-03-23 00:17:26 +00:00
libgrust
libiberty
libitm
libobjc
libphobos
libquadmath
libsanitizer
libssp
libstdc++-v3 Daily bump. 2024-03-24 00:16:50 +00:00
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.