]> git.ipfire.org Git - thirdparty/gcc.git/commit - libgcc/config/gcn/lib2-divmod-di.c
amdgcn: Enable support for TImode for AMD GCN
authorJulian Brown <julian@codesourcery.com>
Wed, 9 Jun 2021 13:18:23 +0000 (06:18 -0700)
committerJulian Brown <julian@codesourcery.com>
Tue, 29 Jun 2021 15:19:56 +0000 (08:19 -0700)
commita8a730cd99184e62c4d026b8c775b96589a9c262
treedbdae551485ac2725318d60267b2cb95fccf95e9
parent0c06e46a81d86d70d788ca1a93d27b6902bd4dc1
amdgcn: Enable support for TImode for AMD GCN

This patch enables support for TImode for AMD GCN, the lack of which
is currently causing a number of test failures for the target and which
is also needed to support "omp_depend_kind" for OpenMP 5.0, since that
is implemented as a 128-bit integer.

Several libgcc support routines are built by default for the "word size"
of a machine, and also for "2 * word size" of the machine.  The libgcc
build for AMD GCN is changed so that it builds for a "word size" of 64
bits, in order to better match the (64-bit) host compiler.  However it
isn't really true that we have 64-bit words -- GCN has 32-bit registers,
so changing UNITS_PER_WORD unconditionally would be the wrong thing to do.

Changing this setting for libgcc (only) means that support routines
are built for "single word" operations that are DImode (64 bits), and
those for "double word" operations are built for TImode (128 bits).
That leaves some gaps regarding previous operations that were built
for a "single word" size of 32 bits and a "double word" size of 64 bits
(generic code doesn't cover both alternatives for all operations that
might be needed).  Those gaps are filled in by this patch, or by the
preceding patches in the series.

2021-06-18  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn.c (gcn_init_libfuncs): New function.
(TARGET_INIT_LIBFUNCS): Define target hook using above function.
* config/gcn/gcn.h (UNITS_PER_WORD): Define to 8 for IN_LIBGCC2, 4
otherwise.
(LIBGCC2_UNITS_PER_WORD, BITS_PER_WORD): Remove definitions.
(MAX_FIXED_MODE_SIZE): Change to 128.

libgcc/
* config/gcn/lib2-bswapti2.c: New file.
* config/gcn/lib2-divmod-di.c: New file.
* config/gcn/lib2-gcn.h (DItype, UDItype, TItype, UTItype): Add
typedefs.
(__divdi3, __moddi3, __udivdi3, __umoddi3): Add prototypes.
* config/gcn/t-amdgcn (LIB2ADD): Add lib2-divmod-di.c and
lib2-bswapti2.c.
gcc/config/gcn/gcn.c
gcc/config/gcn/gcn.h
libgcc/config/gcn/lib2-bswapti2.c [new file with mode: 0644]
libgcc/config/gcn/lib2-divmod-di.c [new file with mode: 0644]
libgcc/config/gcn/lib2-gcn.h
libgcc/config/gcn/t-amdgcn