Go to file
Roger Sayle 8240f2f498 nvptx: Provide vec_set<mode> and vec_extract<vmode><mode> patterns
This patch provides standard vec_extract and vec_set patterns to the
nvptx backend, to extract an element from a PTX vector and set an
element of a PTX vector respectively.  PTX vectors (I hesitate to
call them SIMD vectors) may contain up to four elements, so vector
modes up to size four are supported by this patch even though the
nvptx backend currently only allows V2SI and V2DI, i.e. two out
of the ten possible vector modes.

As an example of the improvement, the following C function:

typedef int __v2si __attribute__((__vector_size__(8)));
int foo (__v2si arg) { return arg[0]+arg[1]; }

previously generated this code using a shift:

  mov.u64     %r25, %ar0;
  ld.v2.u32   %r26, [%r25];
  mov.b64     %r28, %r26;
  shr.s64     %r30, %r28, 32;
  cvt.u32.u32 %r31, %r26.x;
  cvt.u32.u64 %r32, %r30;
  add.u32     %value, %r31, %r32;

but with this patch now generates:

  mov.u64   %r25, %ar0;
  ld.v2.u32 %r26, [%r25];
  mov.u32   %r28, %r26.x;
  mov.u32   %r29, %r26.y;
  add.u32   %value, %r28, %r29;

I've implemented these getters and setters as their own instructions
instead of attempting the much more intrusive patch of changing the
backend's definition of register_operand.  Given the limited utility
of PTX vectors, I'm not convinced that attempting to support them as
operands in every instruction would be worth the effort involved.

This patch has been tested on nvptx-none hosted on x86_64-pc-linux-gnu
with "make" and "make check" with no new regressions.

2020-07-15  Roger Sayle  <roger@nextmovesoftware.com>
	    Tom de Vries  <tdevries@suse.de>

gcc/ChangeLog:

	* config/nvptx/nvptx.md (nvptx_vector_index_operand): New predicate.
	(VECELEM): New mode attribute for a vector's uppercase element mode.
	(Vecelem): New mode attribute for a vector's lowercase element mode.
	(*vec_set<mode>_0, *vec_set<mode>_1, *vec_set<mode>_2)
	(*vec_set<mode>_3): New instructions.
	(vec_set<mode>): New expander to generate one of the above insns.
	(vec_extract<mode><Vecelem>): New instruction.

gcc/testsuite/ChangeLog:

	* gcc.target/nvptx/v2si-vec-set-extract.c: New test.
2020-07-30 10:42:01 +02:00
INSTALL
config
contrib Daily bump. 2020-07-30 00:16:24 +00:00
fixincludes
gcc nvptx: Provide vec_set<mode> and vec_extract<vmode><mode> patterns 2020-07-30 10:42:01 +02:00
gnattools
gotools
include Daily bump. 2020-07-10 00:16:28 +00:00
intl
libada
libatomic Daily bump. 2020-07-15 00:16:35 +00:00
libbacktrace Daily bump. 2020-07-09 00:16:44 +00:00
libcc1 Daily bump. 2020-07-01 00:16:26 +00:00
libcpp Daily bump. 2020-07-30 00:16:24 +00:00
libdecnumber
libffi
libgcc Daily bump. 2020-07-25 00:16:22 +00:00
libgfortran Daily bump. 2020-07-27 00:16:20 +00:00
libgo compiler,runtime: pass only ptr and len to some runtime calls 2020-07-27 17:05:17 -07:00
libgomp Daily bump. 2020-07-28 00:16:25 +00:00
libhsail-rt
libiberty Daily bump. 2020-07-15 00:16:35 +00:00
libitm Daily bump. 2020-07-25 00:16:22 +00:00
libobjc
liboffloadmic
libphobos Daily bump. 2020-06-26 00:16:23 +00:00
libquadmath
libsanitizer Daily bump. 2020-07-17 00:16:27 +00:00
libssp
libstdc++-v3 Daily bump. 2020-07-30 00:16:24 +00:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Daily bump. 2020-07-23 00:16:28 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Add myself for write after approval 2020-07-22 10:13:00 +01:00
Makefile.def
Makefile.in
Makefile.tpl
README
ar-lib
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
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.