[gcc/devel/omp/gcc-16] testsuite: Skip atomic-builtins-1 on targets with sync_int_128 support

Sandra Loosemore via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:bc88bb1cab0616a73cc7c6a9b2677033633fff98

commit bc88bb1cab0616a73cc7c6a9b2677033633fff98
Author: Paul-Antoine Arras <[email protected]>
Date:   Fri Jun 26 11:08:04 2026 +0200

    testsuite: Skip atomic-builtins-1 on targets with sync_int_128 support
    
    The test checks that __int128 OMP atomic operations expand to
    GOMP_atomic_start/end when hardware 128-bit atomic support is unavailable.  It
    should not run on targets that do support such operations natively.
    
    Update check_effective_target_sync_int_128 to return 1 for targets that do *not*
    emit a call to __atomic_compare_exchange_16, and restrict the test to targets
    where that check is false.
    
    gcc/testsuite/ChangeLog:
    
            * c-c++-common/gomp/atomic-builtins-1.c: Skip test when sync_int_128 is
            available.
            * lib/target-supports.exp (check_effective_target_sync_int_128): Return
            1 for targets that do not emit a call to __atomic_compare_exchange_16.
    
    (cherry picked from commit 1f9e8e26e851fa1805bd781048de6362051e1295)

Diff:
---
 gcc/testsuite/c-c++-common/gomp/atomic-builtins-1.c |  2 +-
 gcc/testsuite/lib/target-supports.exp               | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-builtins-1.c b/gcc/testsuite/c-c++-common/gomp/atomic-builtins-1.c
index d33f28107165..0742efc87318 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-builtins-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-builtins-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target int128 } } */
+/* { dg-do compile { target { int128 && { ! sync_int_128 } } } } */
 /* { dg-additional-options "-fdump-tree-ompexp" } */
 
 /* Check that an GIMPLE_OMP_ATOMIC statement expands to GOMP_atomic_start/end
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 7f790be14ddb..6f6ac9473e72 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10306,7 +10306,15 @@ proc check_effective_target_section_anchors { } {
 # Return 1 if the target supports atomic operations on "int_128" values.
 
 proc check_effective_target_sync_int_128 { } {
-    return 0
+    return [check_no_messages_and_pattern sync_int_128 \
+	    "!__atomic_compare_exchange_16" assembly {
+	__int128 v;
+	void foo (__int128 *expected, __int128 desired)
+	  {
+	    __atomic_compare_exchange_n (&v, expected, desired, 0,
+					__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+	  }
+    } "" ]
 }
 
 # Return 1 if the target supports atomic operations on "int_128" values
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.