This patch cleans up various issues with the tests of atomics built-in functions and libatomic functions, in preparation for adapting those tests to add test coverage of stdatomic.h macros. The tests were missing a return type for main (C11 doesn't allow implicit int return types). Some tests were incrementing a variable in one part of an expression and using its value in another part without a sequence point in between. And the libatomic tests shouldn't have been restricted to targets with hardware sync_* support, or adding command-line options to make such support available, since they are built with -fno-inline-atomics anyway to ensure the library functionality is what's tested, and the library is meant to cover all types regardless of what hardware support may be available.
Tested for x86_64-unknown-linux-gnu. OK to commit? gcc/testsuite: 2013-11-07 Joseph Myers <jos...@codesourcery.com> * gcc.dg/atomic-compare-exchange-1.c, gcc.dg/atomic-compare-exchange-2.c, gcc.dg/atomic-compare-exchange-3.c, gcc.dg/atomic-compare-exchange-4.c, gcc.dg/atomic-compare-exchange-5.c, gcc.dg/atomic-exchange-1.c, gcc.dg/atomic-exchange-2.c, gcc.dg/atomic-exchange-3.c, gcc.dg/atomic-exchange-4.c, gcc.dg/atomic-exchange-5.c, gcc.dg/atomic-fence.c, gcc.dg/atomic-flag.c, gcc.dg/atomic-generic.c, gcc.dg/atomic-invalid.c, gcc.dg/atomic-load-1.c, gcc.dg/atomic-load-2.c, gcc.dg/atomic-load-3.c, gcc.dg/atomic-load-4.c, gcc.dg/atomic-load-5.c, gcc.dg/atomic-lockfree.c, gcc.dg/atomic-noinline.c, gcc.dg/atomic-op-1.c, gcc.dg/atomic-op-2.c, gcc.dg/atomic-op-3.c, gcc.dg/atomic-op-4.c, gcc.dg/atomic-op-5.c, gcc.dg/atomic-param.c, gcc.dg/atomic-store-1.c, gcc.dg/atomic-store-2.c, gcc.dg/atomic-store-3.c, gcc.dg/atomic-store-4.c, gcc.dg/atomic-store-5.c: Declare main as returning int. * gcc.dg/atomic-exchange-1.c, gcc.dg/atomic-exchange-2.c, gcc.dg/atomic-exchange-3.c, gcc.dg/atomic-exchange-4.c, gcc.dg/atomic-exchange-5.c: Separate increments of count from expression using value of count. libatomic: 2013-11-07 Joseph Myers <jos...@codesourcery.com> * testsuite/libatomic.c/atomic-compare-exchange-1.c, testsuite/libatomic.c/atomic-compare-exchange-2.c, testsuite/libatomic.c/atomic-compare-exchange-3.c, testsuite/libatomic.c/atomic-compare-exchange-4.c, testsuite/libatomic.c/atomic-compare-exchange-5.c, testsuite/libatomic.c/atomic-exchange-1.c, testsuite/libatomic.c/atomic-exchange-2.c, testsuite/libatomic.c/atomic-exchange-3.c, testsuite/libatomic.c/atomic-exchange-4.c, testsuite/libatomic.c/atomic-exchange-5.c, testsuite/libatomic.c/atomic-generic.c, testsuite/libatomic.c/atomic-load-1.c, testsuite/libatomic.c/atomic-load-2.c, testsuite/libatomic.c/atomic-load-3.c, testsuite/libatomic.c/atomic-load-4.c, testsuite/libatomic.c/atomic-load-5.c, testsuite/libatomic.c/atomic-op-1.c, testsuite/libatomic.c/atomic-op-2.c, testsuite/libatomic.c/atomic-op-3.c, testsuite/libatomic.c/atomic-op-4.c, testsuite/libatomic.c/atomic-op-5.c, testsuite/libatomic.c/atomic-store-1.c, testsuite/libatomic.c/atomic-store-2.c, testsuite/libatomic.c/atomic-store-3.c, testsuite/libatomic.c/atomic-store-4.c, testsuite/libatomic.c/atomic-store-5.c: Declare main as returning int. Do not require built-in sync support or add target-specific options. * testsuite/libatomic.c/atomic-exchange-1.c, testsuite/libatomic.c/atomic-exchange-2.c, testsuite/libatomic.c/atomic-exchange-3.c, testsuite/libatomic.c/atomic-exchange-4.c, testsuite/libatomic.c/atomic-exchange-5.c: Separate increments of count from expression using value of count. Index: gcc/testsuite/gcc.dg/atomic-op-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-2.c (working copy) @@ -528,6 +528,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-exchange-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-3.c (working copy) @@ -9,25 +9,31 @@ int v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c (working copy) @@ -17,6 +17,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-4.c (working copy) @@ -9,6 +9,7 @@ long long v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-2.c (working copy) @@ -9,6 +9,7 @@ short v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-noinline.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-noinline.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-noinline.c (working copy) @@ -16,6 +16,7 @@ short as,bs,cs; char ac,bc,cc; +int main () { Index: gcc/testsuite/gcc.dg/atomic-op-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-3.c (working copy) @@ -527,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-1.c (working copy) @@ -10,6 +10,7 @@ char v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-exchange-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-4.c (working copy) @@ -11,25 +11,31 @@ long long v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-flag.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-flag.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-flag.c (working copy) @@ -7,6 +7,7 @@ extern void abort(void); unsigned char a; +int main () { int b; Index: gcc/testsuite/gcc.dg/atomic-generic.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-generic.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-generic.c (working copy) @@ -23,6 +23,7 @@ int size = sizeof (test_struct); /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { test_struct c; Index: gcc/testsuite/gcc.dg/atomic-lockfree.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-lockfree.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-lockfree.c (working copy) @@ -17,6 +17,7 @@ int r1, r2; /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { Index: gcc/testsuite/gcc.dg/atomic-param.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-param.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-param.c (working copy) @@ -5,6 +5,7 @@ int i; +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-5.c (working copy) @@ -8,6 +8,7 @@ __int128_t v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-3.c (working copy) @@ -9,6 +9,7 @@ int v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-invalid.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-invalid.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-invalid.c (working copy) @@ -10,6 +10,7 @@ size_t s; bool x; +int main () { __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_RELAXED, __ATOMIC_SEQ_CST); /* { dg-error "failure memory model cannot be stronger" } */ Index: gcc/testsuite/gcc.dg/atomic-op-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-4.c (working copy) @@ -529,6 +529,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-exchange-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-1.c (working copy) @@ -9,25 +9,31 @@ char v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-2.c (working copy) @@ -11,6 +11,7 @@ short v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-exchange-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-5.c (working copy) @@ -10,25 +10,31 @@ __int128_t v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-store-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-4.c (working copy) @@ -11,6 +11,7 @@ long long v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-op-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-1.c (working copy) @@ -527,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-op-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-5.c (working copy) @@ -528,6 +528,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-exchange-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-2.c (working copy) @@ -9,25 +9,31 @@ short v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c (working copy) @@ -18,6 +18,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-3.c (working copy) @@ -8,6 +8,7 @@ int v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-1.c (working copy) @@ -9,6 +9,7 @@ char v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-fence.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-fence.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-fence.c (working copy) @@ -6,6 +6,7 @@ /* Test that __atomic_{thread,signal}_fence builtins execute. */ +int main () { __atomic_thread_fence (__ATOMIC_RELAXED); Index: gcc/testsuite/gcc.dg/atomic-store-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-5.c (working copy) @@ -10,6 +10,7 @@ __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-generic.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-generic.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-generic.c (working copy) @@ -22,6 +22,7 @@ int size = sizeof (test_struct); /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { test_struct c; Index: libatomic/testsuite/libatomic.c/atomic-op-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_*OP builtin routines for a char. */ @@ -527,6 +526,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_load_n builtin for a char. */ @@ -10,6 +9,7 @@ char v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_*OP builtin routines for a short. */ @@ -528,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-op-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_*OP builtin routines for an int. */ @@ -527,6 +526,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_load_n builtin for a short. */ @@ -11,6 +10,7 @@ short v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-load-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-3.c (working copy) @@ -1,13 +1,13 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ extern void abort(void); int v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-4.c (working copy) @@ -1,9 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_*OP builtin routines for long long. */ @@ -529,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-exchange-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_exchange_n builtin for a char. */ @@ -9,25 +8,31 @@ char v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-load-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-4.c (working copy) @@ -1,14 +1,13 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ extern void abort(void); long long v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-5.c (working copy) @@ -1,8 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_*OP builtin routines for an int_128. */ @@ -528,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-5.c (working copy) @@ -1,13 +1,13 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ extern void abort(void); __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-exchange-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_X builtin for a short. */ @@ -9,25 +8,31 @@ short v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_X builtin for an int. */ @@ -9,25 +8,31 @@ int v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-4.c (working copy) @@ -1,9 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_X builtin for a long_long. */ @@ -11,25 +9,31 @@ long long v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-5.c (working copy) @@ -1,8 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_X builtin for a 16 byte value. */ @@ -10,25 +9,31 @@ __int128_t v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-store-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_store_n builtin for a char. */ @@ -9,6 +8,7 @@ char v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_store_n builtin for a short. */ @@ -9,6 +8,7 @@ short v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_store_n builtin for an int. */ @@ -9,6 +8,7 @@ int v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-4.c (working copy) @@ -1,9 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_store_n builtin for a long long. */ @@ -11,6 +9,7 @@ long long v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-5.c (working copy) @@ -1,8 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_store_n builtin for a 16 byte value. */ @@ -10,6 +9,7 @@ __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_compare_exchange_n builtin for a char. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_compare_exchange_n builtin for a short. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_compare_exchange_n builtin for an int. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c (working copy) @@ -1,9 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of __atomic_compare_exchange_n builtin for a long_long. */ @@ -18,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c (working copy) @@ -1,8 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */ @@ -17,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { -- Joseph S. Myers jos...@codesourcery.com