https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96494
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #0) > AFAICT, from the point of view of the PTX isa, there's no reason why we > couldn't support this. > > So, unless a testsuite run points to some problem, we should enable the > sync_int_long for nvptx. Well, I found a problem with test-case gcc/testsuite/gcc.dg/pr86314.c. There we try to do an atomic insn on stack, and since stack is implemented as .local, and the atom insn is not supported for .local, we run into: ... nvptx-run: error getting kernel result: operation not supported on global/shared address space ... Something like this would work: ... $ git diff diff --git a/gcc/testsuite/gcc.dg/pr86314.c b/gcc/testsuite/gcc.dg/pr86314.c index 8962a3cf2ff..565fb02eee2 100644 --- a/gcc/testsuite/gcc.dg/pr86314.c +++ b/gcc/testsuite/gcc.dg/pr86314.c @@ -1,5 +1,5 @@ // PR target/86314 -// { dg-do run { target sync_int_long } } +// { dg-do run { target sync_int_long_stack } } // { dg-options "-O2" } __attribute__((noinline, noclone)) unsigned long diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e79015b4d54..a870b1de275 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7704,7 +7704,16 @@ proc check_effective_target_sync_int_long { } { || [istarget cris-*-*] || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9]) || ([istarget arc*-*-*] && [check_effective_target_arc_atomic]) - || [check_effective_target_mips_llsc] }}] + || [check_effective_target_mips_llsc] + || [istarget nvptx*-*-*] + }}] +} + +proc check_effective_target_sync_int_long_stack { } { + return [check_cached_effective_target sync_int_long_stack { + expr { ![istarget nvptx*-*-*] + && [check_effective_target_sync_int_long] + }}] } # Return 1 if the target supports atomic operations on "char" and "short". ...