gcc/libatomic
Tom de Vries 1554556312 [libatomic] Add nvptx support
Add nvptx support to libatomic.

Given that atomic_test_and_set is not implemented for nvptx (PR96964), the
compiler translates __atomic_test_and_set falling back onto the "Failing all
else, assume a single threaded environment and simply perform the operation"
case in expand_atomic_test_and_set, so it doesn't map onto an actual atomic
operation.

Still, that counts as supported for the configure test of libatomic, so we
end up with HAVE_ATOMIC_TAS_1/2/4/8/16 == 1, and the corresponding
__atomic_test_and_set_1/2/4/8/16 in libatomic all using that non-atomic
implementation.

Fix this by adding an atomic_test_and_set expansion for nvptx, that uses
libatomics __atomic_test_and_set_1.

This again makes the configure tests for HAVE_ATOMIC_TAS_1/2/4/8/16 fail, so
instead we use this case in tas_n.c:
...
/* If this type is smaller than word-sized, fall back to a word-sized
   compare-and-swap loop.  */
bool
SIZE(libat_test_and_set) (UTYPE *mptr, int smodel)
...
which for __atomic_test_and_set_8 uses INVERT_MASK_8.

Add INVERT_MASK_8 in libatomic_i.h, as well as MASK_8.

Tested libatomic testsuite on nvptx.

gcc/ChangeLog:

	PR target/96964
	* config/nvptx/nvptx.md (define_expand "atomic_test_and_set"): New
	expansion.

libatomic/ChangeLog:

	PR target/96898
	* configure.tgt: Add nvptx.
	* libatomic_i.h (MASK_8, INVERT_MASK_8): New macro definition.
	* config/nvptx/host-config.h: New file.
	* config/nvptx/lock.c: New file.
2020-09-11 12:06:15 +02:00
..
config [libatomic] Add nvptx support 2020-09-11 12:06:15 +02:00
testsuite [libatomic, testsuite] Add missing include in atomic-generic.c 2020-09-07 12:02:05 +02:00
.gitignore
ChangeLog Daily bump. 2020-09-08 00:16:32 +00:00
Makefile.am build: Use -include instead of conditional include. 2020-06-22 21:31:48 +00:00
Makefile.in build: Use -include instead of conditional include. 2020-06-22 21:31:48 +00:00
acinclude.m4 re PR other/79543 (Inappropriate "ld --version" checking) 2019-09-03 14:10:26 +00:00
aclocal.m4 Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
auto-config.h.in Makefile.am (ARCH_AARCH64_LINUX): Add IFUNC_OPTIONS and libatomic_la_LIBADD. 2017-12-05 00:49:09 +00:00
cas_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
configure aix: Add GCC64 configuration and FAT target libraries. 2020-06-21 14:14:46 -04:00
configure.ac aix: Add GCC64 configuration and FAT target libraries. 2020-06-21 14:14:46 -04:00
configure.tgt [libatomic] Add nvptx support 2020-09-11 12:06:15 +02:00
exch_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
fadd_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
fand_n.c
fence.c Update copyright years. 2020-01-01 12:51:42 +01:00
fenv.c Update copyright years. 2020-01-01 12:51:42 +01:00
fior_n.c
flag.c Update copyright years. 2020-01-01 12:51:42 +01:00
fnand_n.c
fop_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
fsub_n.c
fxor_n.c
gcas.c Update copyright years. 2020-01-01 12:51:42 +01:00
gexch.c Update copyright years. 2020-01-01 12:51:42 +01:00
glfree.c Update copyright years. 2020-01-01 12:51:42 +01:00
gload.c Update copyright years. 2020-01-01 12:51:42 +01:00
gstore.c Update copyright years. 2020-01-01 12:51:42 +01:00
host-config.h Update copyright years. 2020-01-01 12:51:42 +01:00
init.c
libatomic.map Add out-of-line versions of some <stdatomic.h> functions (PR c/65083). 2015-11-18 22:13:44 +00:00
libatomic_i.h [libatomic] Add nvptx support 2020-09-11 12:06:15 +02:00
load_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
store_n.c Update copyright years. 2020-01-01 12:51:42 +01:00
tas_n.c Update copyright years. 2020-01-01 12:51:42 +01:00