https://gcc.gnu.org/g:1f9e8e26e851fa1805bd781048de6362051e1295

commit r17-2024-g1f9e8e26e851fa1805bd781048de6362051e1295
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.

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 ae3af5893ccc..d35a53952c6d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10364,7 +10364,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

Reply via email to