]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: xtensa: add support for effective_target_sync_*
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 28 Apr 2025 01:05:20 +0000 (18:05 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Sun, 11 May 2025 20:12:46 +0000 (13:12 -0700)
Add new function check_effective_target_xtensa_atomic and use it in the
check_effective_target_sync_int_long and
check_effective_target_sync_char_short.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_xtensa_atomic): New function.
(check_effective_target_sync_int_long)
(check_effective_target_sync_char_short): Add test for xtensa.

gcc/testsuite/lib/target-supports.exp

index 287e51bbfc6619826b3b0df01c5f532928ec5d80..24d0b3d08e340cf7c362a2e0cd57e5f631c62c25 100644 (file)
@@ -10145,6 +10145,7 @@ proc check_effective_target_sync_int_long { } {
             || ([istarget arc*-*-*] && [check_effective_target_arc_atomic])
             || [check_effective_target_mips_llsc]
             || [istarget nvptx*-*-*]
+            || ([istarget xtensa*-*-*] && [check_effective_target_xtensa_atomic])
         }}]
 }
 
@@ -10182,7 +10183,9 @@ proc check_effective_target_sync_char_short { } {
             || ([istarget riscv*-*-*]
                 && ([check_effective_target_riscv_zalrsc]
                     || [check_effective_target_riscv_zabha]))
-            || [check_effective_target_mips_llsc] }}]
+            || [check_effective_target_mips_llsc]
+            || ([istarget xtensa*-*-*] && [check_effective_target_xtensa_atomic])
+        }}]
 }
 
 # Return 1 if thread_fence does not rely on __sync_synchronize
@@ -14407,3 +14410,12 @@ proc check_effective_target_speculation_barrier_defined { } {
            }
        }]
 }
+
+# Return 1 if this is a compiler supporting Xtensa atomic operations
+proc check_effective_target_xtensa_atomic { } {
+    return [check_no_compiler_messages xtensa_atomic assembly {
+       #if __XCHAL_HAVE_S32C1I != 1 && __XCHAL_HAVE_EXCLUSIVE != 1
+       #error FOO
+       #endif
+    }]
+}