diff options
Diffstat (limited to 'gcc-4.8.1/libatomic/testsuite/libatomic.c')
28 files changed, 0 insertions, 4309 deletions
diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c deleted file mode 100644 index 2ac54e808..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* 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. */ - -extern void abort(void); - -char v = 0; -char expected = 0; -char max = ~0; -char desired = ~0; -char zero = 0; - -#define STRONG 0 -#define WEAK 1 - -main () -{ - - if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - /* Now test the generic version. */ - - v = 0; - - if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c deleted file mode 100644 index 73b259777..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c +++ /dev/null @@ -1,85 +0,0 @@ -/* 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. */ - -extern void abort(void); - -short v = 0; -short expected = 0; -short max = ~0; -short desired = ~0; -short zero = 0; - -#define STRONG 0 -#define WEAK 1 - -main () -{ - - if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - /* Now test the generic version. */ - - v = 0; - - if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c deleted file mode 100644 index 26097288c..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c +++ /dev/null @@ -1,85 +0,0 @@ -/* 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. */ - -extern void abort(void); - -int v = 0; -int expected = 0; -int max = ~0; -int desired = ~0; -int zero = 0; - -#define STRONG 0 -#define WEAK 1 - -main () -{ - - if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - /* Now test the generic version. */ - - v = 0; - - if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c deleted file mode 100644 index b6c783dda..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c +++ /dev/null @@ -1,87 +0,0 @@ -/* 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. */ - -extern void abort(void); - -long long v = 0; -long long expected = 0; -long long max = ~0; -long long desired = ~0; -long long zero = 0; - -#define STRONG 0 -#define WEAK 1 - -main () -{ - - if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - /* Now test the generic version. */ - - v = 0; - - if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c deleted file mode 100644 index 4cc0209b3..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c +++ /dev/null @@ -1,86 +0,0 @@ -/* 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-*-* } } } */ - -/* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */ - -extern void abort(void); - -__int128_t v = 0; -__int128_t expected = 0; -__int128_t max = ~0; -__int128_t desired = ~0; -__int128_t zero = 0; - -#define STRONG 0 -#define WEAK 1 - -main () -{ - - if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - /* Now test the generic version. */ - - v = 0; - - if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) - abort (); - if (expected != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) - abort (); - if (expected != max) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE)) - abort (); - if (expected != max) - abort (); - if (v != 0) - abort (); - - if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)) - abort (); - if (expected != 0) - abort (); - - if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) - abort (); - if (expected != 0) - abort (); - if (v != max) - abort (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-1.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-1.c deleted file mode 100644 index fb78cdbca..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. */ - -extern void abort(void); - -char v, count, ret; - -main () -{ - v = 0; - count = 0; - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) - abort (); - - /* Now test the generic version. */ - - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); - if (ret != count - 1 || v != count) - abort (); - count++; - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-2.c deleted file mode 100644 index 153771a2c..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-2.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. */ - -extern void abort(void); - -short v, count, ret; - -main () -{ - v = 0; - count = 0; - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) - abort (); - - /* Now test the generic version. */ - - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); - if (ret != count - 1 || v != count) - abort (); - count++; - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-3.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-3.c deleted file mode 100644 index fbf8f6b96..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-3.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. */ - -extern void abort(void); - -int v, count, ret; - -main () -{ - v = 0; - count = 0; - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) - abort (); - - /* Now test the generic version. */ - - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); - if (ret != count - 1 || v != count) - abort (); - count++; - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-4.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-4.c deleted file mode 100644 index 13022dd38..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-4.c +++ /dev/null @@ -1,64 +0,0 @@ -/* 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. */ - -extern void abort(void); - -long long v, count, ret; - -main () -{ - v = 0; - count = 0; - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) - abort (); - - /* Now test the generic version. */ - - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); - if (ret != count - 1 || v != count) - abort (); - count++; - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-5.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-5.c deleted file mode 100644 index b0c84b17f..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-exchange-5.c +++ /dev/null @@ -1,63 +0,0 @@ -/* 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-*-* } } } */ - -/* Test the execution of the __atomic_X builtin for a 16 byte value. */ - -extern void abort(void); - -__int128_t v, count, ret; - -main () -{ - v = 0; - count = 0; - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) - abort (); - - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) - abort (); - - /* Now test the generic version. */ - - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL); - if (ret != count - 1 || v != count) - abort (); - count++; - - __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST); - if (ret != count - 1 || v != count) - abort (); - count++; - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-generic.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-generic.c deleted file mode 100644 index c3c486a03..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-generic.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Test generic __atomic routines for proper function calling. - memory model. */ -/* { dg-options "-w" } */ -/* { dg-do run } */ - -/* Test that the generioc atomic builtins execute as expected.. - sync-mem-generic-aux.c supplies a functional external entry point for - the 4 generic functions. */ - -#include <stdlib.h> -#include <stdbool.h> - -extern void abort(); - -typedef struct test { - int array[10]; -} test_struct; - -test_struct zero = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -test_struct ones = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; -test_struct a,b; - -int size = sizeof (test_struct); -/* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ -main () -{ - test_struct c; - - __atomic_store (&a, &zero, __ATOMIC_RELAXED); - if (memcmp (&a, &zero, size)) - abort (); - - __atomic_exchange (&a, &ones, &c, __ATOMIC_SEQ_CST); - if (memcmp (&c, &zero, size)) - abort (); - if (memcmp (&a, &ones, size)) - abort (); - - __atomic_load (&a, &b, __ATOMIC_RELAXED); - if (memcmp (&b, &ones, size)) - abort (); - - if (!__atomic_compare_exchange (&a, &b, &zero, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE)) - abort(); - if (memcmp (&a, &zero, size)) - abort (); - - if (__atomic_compare_exchange (&a, &b, &ones, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE)) - abort(); - if (memcmp (&b, &zero, size)) - abort (); - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-1.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-1.c deleted file mode 100644 index 928f9b0f1..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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. */ - -extern void abort(void); - -char v, count; - -main () -{ - v = 0; - count = 0; - - if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++) - abort(); - else - v++; - - /* Now test the generic variants. */ - - __atomic_load (&v, &count, __ATOMIC_RELAXED); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_ACQUIRE); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_CONSUME); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_SEQ_CST); - if (count != v) - abort(); - else - v++; - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-2.c deleted file mode 100644 index 3d1df1cff..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-2.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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. */ - -extern void abort(void); - -short v, count; - - -main () -{ - v = 0; - count = 0; - - if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++) - abort(); - else - v++; - - /* Now test the generic variants. */ - - __atomic_load (&v, &count, __ATOMIC_RELAXED); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_ACQUIRE); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_CONSUME); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_SEQ_CST); - if (count != v) - abort(); - else - v++; - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-3.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-3.c deleted file mode 100644 index ec238be9e..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-3.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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; - - -main () -{ - v = 0; - count = 0; - - if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++) - abort(); - else - v++; - - /* Now test the generic variants. */ - - __atomic_load (&v, &count, __ATOMIC_RELAXED); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_ACQUIRE); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_CONSUME); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_SEQ_CST); - if (count != v) - abort(); - else - v++; - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-4.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-4.c deleted file mode 100644 index 032ad246f..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-4.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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; - -main () -{ - v = 0; - count = 0; - - if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++) - abort(); - else - v++; - - /* Now test the generic variants. */ - - __atomic_load (&v, &count, __ATOMIC_RELAXED); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_ACQUIRE); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_CONSUME); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_SEQ_CST); - if (count != v) - abort(); - else - v++; - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-5.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-5.c deleted file mode 100644 index 31d806633..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-load-5.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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-*-* } } } */ - -extern void abort(void); - -__int128_t v, count; - -main () -{ - v = 0; - count = 0; - - if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++) - abort(); - else - v++; - - if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++) - abort(); - else - v++; - - /* Now test the generic variants. */ - - __atomic_load (&v, &count, __ATOMIC_RELAXED); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_ACQUIRE); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_CONSUME); - if (count != v) - abort(); - else - v++; - - __atomic_load (&v, &count, __ATOMIC_SEQ_CST); - if (count != v) - abort(); - else - v++; - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-1.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-1.c deleted file mode 100644 index bc1716f77..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-1.c +++ /dev/null @@ -1,554 +0,0 @@ -/* 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. */ - -extern void abort(void); - -char v, count, res; -const char init = ~0; - -/* The fetch_op routines return the original value before the operation. */ - -void -test_fetch_add () -{ - v = 0; - count = 1; - - if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5) - abort (); -} - - -void -test_fetch_sub() -{ - v = res = 20; - count = 0; - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--) - abort (); -} - -void -test_fetch_and () -{ - v = init; - - if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_fetch_nand () -{ - v = init; - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 ) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_xor () -{ - v = init; - count = 0; - - if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_or () -{ - v = 0; - count = 1; - - if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31) - abort (); -} - -/* The OP_fetch routines return the new value after the operation. */ - -void -test_add_fetch () -{ - v = 0; - count = 1; - - if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6) - abort (); -} - - -void -test_sub_fetch () -{ - v = res = 20; - count = 0; - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res) - abort (); -} - -void -test_and_fetch () -{ - v = init; - - if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0) - abort (); - - v = init; - if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_nand_fetch () -{ - v = init; - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - - - -void -test_xor_fetch () -{ - v = init; - count = 0; - - if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_or_fetch () -{ - v = 0; - count = 1; - - if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63) - abort (); -} - - -/* Test the OP routines with a result which isn't used. Use both variations - within each function. */ - -void -test_add () -{ - v = 0; - count = 1; - - __atomic_add_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_CONSUME); - if (v != 2) - abort (); - - __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE); - if (v != 3) - abort (); - - __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE); - if (v != 4) - abort (); - - __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 5) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST); - if (v != 6) - abort (); -} - - -void -test_sub() -{ - v = res = 20; - count = 0; - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != --res) - abort (); -} - -void -test_and () -{ - v = init; - - __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED); - if (v != 0) - abort (); - - v = init; - __atomic_fetch_and (&v, init, __ATOMIC_CONSUME); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, init, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_nand () -{ - v = init; - - __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE); - if (v != 0) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST); - if (v != init) - abort (); -} - - - -void -test_xor () -{ - v = init; - count = 0; - - __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_or () -{ - v = 0; - count = 1; - - __atomic_or_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_CONSUME); - if (v != 3) - abort (); - - count *= 2; - __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE); - if (v != 7) - abort (); - - count *= 2; - __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE); - if (v != 15) - abort (); - - count *= 2; - __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 31) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST); - if (v != 63) - abort (); -} - -main () -{ - test_fetch_add (); - test_fetch_sub (); - test_fetch_and (); - test_fetch_nand (); - test_fetch_xor (); - test_fetch_or (); - - test_add_fetch (); - test_sub_fetch (); - test_and_fetch (); - test_nand_fetch (); - test_xor_fetch (); - test_or_fetch (); - - test_add (); - test_sub (); - test_and (); - test_nand (); - test_xor (); - test_or (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-2.c deleted file mode 100644 index 8755340cc..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-2.c +++ /dev/null @@ -1,555 +0,0 @@ -/* 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. */ - -extern void abort(void); - -short v, count, res; -const short init = ~0; - -/* The fetch_op routines return the original value before the operation. */ - -void -test_fetch_add () -{ - v = 0; - count = 1; - - if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5) - abort (); -} - - -void -test_fetch_sub() -{ - v = res = 20; - count = 0; - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--) - abort (); -} - -void -test_fetch_and () -{ - v = init; - - if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_fetch_nand () -{ - v = init; - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 ) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_xor () -{ - v = init; - count = 0; - - if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_or () -{ - v = 0; - count = 1; - - if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31) - abort (); -} - -/* The OP_fetch routines return the new value after the operation. */ - -void -test_add_fetch () -{ - v = 0; - count = 1; - - if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6) - abort (); -} - - -void -test_sub_fetch () -{ - v = res = 20; - count = 0; - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res) - abort (); -} - -void -test_and_fetch () -{ - v = init; - - if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0) - abort (); - - v = init; - if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_nand_fetch () -{ - v = init; - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - - - -void -test_xor_fetch () -{ - v = init; - count = 0; - - if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_or_fetch () -{ - v = 0; - count = 1; - - if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63) - abort (); -} - - -/* Test the OP routines with a result which isn't used. Use both variations - within each function. */ - -void -test_add () -{ - v = 0; - count = 1; - - __atomic_add_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_CONSUME); - if (v != 2) - abort (); - - __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE); - if (v != 3) - abort (); - - __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE); - if (v != 4) - abort (); - - __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 5) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST); - if (v != 6) - abort (); -} - - -void -test_sub() -{ - v = res = 20; - count = 0; - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != --res) - abort (); -} - -void -test_and () -{ - v = init; - - __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED); - if (v != 0) - abort (); - - v = init; - __atomic_fetch_and (&v, init, __ATOMIC_CONSUME); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, init, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_nand () -{ - v = init; - - __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE); - if (v != 0) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST); - if (v != init) - abort (); -} - - - -void -test_xor () -{ - v = init; - count = 0; - - __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_or () -{ - v = 0; - count = 1; - - __atomic_or_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_CONSUME); - if (v != 3) - abort (); - - count *= 2; - __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE); - if (v != 7) - abort (); - - count *= 2; - __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE); - if (v != 15) - abort (); - - count *= 2; - __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 31) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST); - if (v != 63) - abort (); -} - -main () -{ - test_fetch_add (); - test_fetch_sub (); - test_fetch_and (); - test_fetch_nand (); - test_fetch_xor (); - test_fetch_or (); - - test_add_fetch (); - test_sub_fetch (); - test_and_fetch (); - test_nand_fetch (); - test_xor_fetch (); - test_or_fetch (); - - test_add (); - test_sub (); - test_and (); - test_nand (); - test_xor (); - test_or (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-3.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-3.c deleted file mode 100644 index 69db4894b..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-3.c +++ /dev/null @@ -1,554 +0,0 @@ -/* 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. */ - -extern void abort(void); - -int v, count, res; -const int init = ~0; - -/* The fetch_op routines return the original value before the operation. */ - -void -test_fetch_add () -{ - v = 0; - count = 1; - - if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5) - abort (); -} - - -void -test_fetch_sub() -{ - v = res = 20; - count = 0; - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--) - abort (); -} - -void -test_fetch_and () -{ - v = init; - - if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_fetch_nand () -{ - v = init; - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 ) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_xor () -{ - v = init; - count = 0; - - if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_or () -{ - v = 0; - count = 1; - - if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31) - abort (); -} - -/* The OP_fetch routines return the new value after the operation. */ - -void -test_add_fetch () -{ - v = 0; - count = 1; - - if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6) - abort (); -} - - -void -test_sub_fetch () -{ - v = res = 20; - count = 0; - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res) - abort (); -} - -void -test_and_fetch () -{ - v = init; - - if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0) - abort (); - - v = init; - if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_nand_fetch () -{ - v = init; - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - - - -void -test_xor_fetch () -{ - v = init; - count = 0; - - if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_or_fetch () -{ - v = 0; - count = 1; - - if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63) - abort (); -} - - -/* Test the OP routines with a result which isn't used. Use both variations - within each function. */ - -void -test_add () -{ - v = 0; - count = 1; - - __atomic_add_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_CONSUME); - if (v != 2) - abort (); - - __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE); - if (v != 3) - abort (); - - __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE); - if (v != 4) - abort (); - - __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 5) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST); - if (v != 6) - abort (); -} - - -void -test_sub() -{ - v = res = 20; - count = 0; - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != --res) - abort (); -} - -void -test_and () -{ - v = init; - - __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED); - if (v != 0) - abort (); - - v = init; - __atomic_fetch_and (&v, init, __ATOMIC_CONSUME); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, init, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_nand () -{ - v = init; - - __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE); - if (v != 0) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST); - if (v != init) - abort (); -} - - - -void -test_xor () -{ - v = init; - count = 0; - - __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_or () -{ - v = 0; - count = 1; - - __atomic_or_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_CONSUME); - if (v != 3) - abort (); - - count *= 2; - __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE); - if (v != 7) - abort (); - - count *= 2; - __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE); - if (v != 15) - abort (); - - count *= 2; - __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 31) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST); - if (v != 63) - abort (); -} - -main () -{ - test_fetch_add (); - test_fetch_sub (); - test_fetch_and (); - test_fetch_nand (); - test_fetch_xor (); - test_fetch_or (); - - test_add_fetch (); - test_sub_fetch (); - test_and_fetch (); - test_nand_fetch (); - test_xor_fetch (); - test_or_fetch (); - - test_add (); - test_sub (); - test_and (); - test_nand (); - test_xor (); - test_or (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-4.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-4.c deleted file mode 100644 index 7c4a819bf..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-4.c +++ /dev/null @@ -1,556 +0,0 @@ -/* 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. */ - -extern void abort(void); - -long long v, count, res; -const long long init = ~0; - -/* The fetch_op routines return the original value before the operation. */ - -void -test_fetch_add () -{ - v = 0; - count = 1; - - if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5) - abort (); -} - - -void -test_fetch_sub() -{ - v = res = 20; - count = 0; - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--) - abort (); -} - -void -test_fetch_and () -{ - v = init; - - if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_fetch_nand () -{ - v = init; - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 ) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_xor () -{ - v = init; - count = 0; - - if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_or () -{ - v = 0; - count = 1; - - if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31) - abort (); -} - -/* The OP_fetch routines return the new value after the operation. */ - -void -test_add_fetch () -{ - v = 0; - count = 1; - - if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6) - abort (); -} - - -void -test_sub_fetch () -{ - v = res = 20; - count = 0; - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res) - abort (); -} - -void -test_and_fetch () -{ - v = init; - - if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0) - abort (); - - v = init; - if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_nand_fetch () -{ - v = init; - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - - - -void -test_xor_fetch () -{ - v = init; - count = 0; - - if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_or_fetch () -{ - v = 0; - count = 1; - - if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63) - abort (); -} - - -/* Test the OP routines with a result which isn't used. Use both variations - within each function. */ - -void -test_add () -{ - v = 0; - count = 1; - - __atomic_add_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_CONSUME); - if (v != 2) - abort (); - - __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE); - if (v != 3) - abort (); - - __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE); - if (v != 4) - abort (); - - __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 5) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST); - if (v != 6) - abort (); -} - - -void -test_sub() -{ - v = res = 20; - count = 0; - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != --res) - abort (); -} - -void -test_and () -{ - v = init; - - __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED); - if (v != 0) - abort (); - - v = init; - __atomic_fetch_and (&v, init, __ATOMIC_CONSUME); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, init, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_nand () -{ - v = init; - - __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE); - if (v != 0) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST); - if (v != init) - abort (); -} - - - -void -test_xor () -{ - v = init; - count = 0; - - __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_or () -{ - v = 0; - count = 1; - - __atomic_or_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_CONSUME); - if (v != 3) - abort (); - - count *= 2; - __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE); - if (v != 7) - abort (); - - count *= 2; - __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE); - if (v != 15) - abort (); - - count *= 2; - __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 31) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST); - if (v != 63) - abort (); -} - -main () -{ - test_fetch_add (); - test_fetch_sub (); - test_fetch_and (); - test_fetch_nand (); - test_fetch_xor (); - test_fetch_or (); - - test_add_fetch (); - test_sub_fetch (); - test_and_fetch (); - test_nand_fetch (); - test_xor_fetch (); - test_or_fetch (); - - test_add (); - test_sub (); - test_and (); - test_nand (); - test_xor (); - test_or (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-5.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-5.c deleted file mode 100644 index e78d81509..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-op-5.c +++ /dev/null @@ -1,555 +0,0 @@ -/* 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-*-* } } } */ - -/* Test the execution of the __atomic_*OP builtin routines for an int_128. */ - -extern void abort(void); - -__int128_t v, count, res; -const __int128_t init = ~0; - -/* The fetch_op routines return the original value before the operation. */ - -void -test_fetch_add () -{ - v = 0; - count = 1; - - if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3) - abort (); - - if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4) - abort (); - - if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5) - abort (); -} - - -void -test_fetch_sub() -{ - v = res = 20; - count = 0; - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--) - abort (); - - if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--) - abort (); - - if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--) - abort (); -} - -void -test_fetch_and () -{ - v = init; - - if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_fetch_nand () -{ - v = init; - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 ) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0) - abort (); - - if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_xor () -{ - v = init; - count = 0; - - if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init) - abort (); -} - -void -test_fetch_or () -{ - v = 0; - count = 1; - - if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15) - abort (); - - count *= 2; - if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31) - abort (); -} - -/* The OP_fetch routines return the new value after the operation. */ - -void -test_add_fetch () -{ - v = 0; - count = 1; - - if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3) - abort (); - - if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5) - abort (); - - if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6) - abort (); -} - - -void -test_sub_fetch () -{ - v = res = 20; - count = 0; - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res) - abort (); - - if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res) - abort (); -} - -void -test_and_fetch () -{ - v = init; - - if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0) - abort (); - - v = init; - if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0) - abort (); - - v = ~v; - if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_nand_fetch () -{ - v = init; - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0) - abort (); - - if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init) - abort (); -} - - - -void -test_xor_fetch () -{ - v = init; - count = 0; - - if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init) - abort (); - - if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init) - abort (); - - if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0) - abort (); -} - -void -test_or_fetch () -{ - v = 0; - count = 1; - - if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31) - abort (); - - count *= 2; - if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63) - abort (); -} - - -/* Test the OP routines with a result which isn't used. Use both variations - within each function. */ - -void -test_add () -{ - v = 0; - count = 1; - - __atomic_add_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_CONSUME); - if (v != 2) - abort (); - - __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE); - if (v != 3) - abort (); - - __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE); - if (v != 4) - abort (); - - __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 5) - abort (); - - __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST); - if (v != 6) - abort (); -} - - -void -test_sub() -{ - v = res = 20; - count = 0; - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE); - if (v != --res) - abort (); - - __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL); - if (v != --res) - abort (); - - __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != --res) - abort (); -} - -void -test_and () -{ - v = init; - - __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED); - if (v != 0) - abort (); - - v = init; - __atomic_fetch_and (&v, init, __ATOMIC_CONSUME); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, init, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL); - if (v != 0) - abort (); - - v = ~v; - __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_nand () -{ - v = init; - - __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE); - if (v != 0) - abort (); - - __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST); - if (v != init) - abort (); -} - - - -void -test_xor () -{ - v = init; - count = 0; - - __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME); - if (v != 0) - abort (); - - __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE); - if (v != 0) - abort (); - - __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE); - if (v != init) - abort (); - - __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL); - if (v != init) - abort (); - - __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST); - if (v != 0) - abort (); -} - -void -test_or () -{ - v = 0; - count = 1; - - __atomic_or_fetch (&v, count, __ATOMIC_RELAXED); - if (v != 1) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_CONSUME); - if (v != 3) - abort (); - - count *= 2; - __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE); - if (v != 7) - abort (); - - count *= 2; - __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE); - if (v != 15) - abort (); - - count *= 2; - __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL); - if (v != 31) - abort (); - - count *= 2; - __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST); - if (v != 63) - abort (); -} - -main () -{ - test_fetch_add (); - test_fetch_sub (); - test_fetch_and (); - test_fetch_nand (); - test_fetch_xor (); - test_fetch_or (); - - test_add_fetch (); - test_sub_fetch (); - test_and_fetch (); - test_nand_fetch (); - test_xor_fetch (); - test_or_fetch (); - - test_add (); - test_sub (); - test_and (); - test_nand (); - test_xor (); - test_or (); - - return 0; -} diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-1.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-1.c deleted file mode 100644 index f99eb9c84..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. */ - -extern void abort(void); - -char v, count; - -main () -{ - v = 0; - count = 0; - - __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != ++count) - abort (); - - /* Now test the generic variant. */ - count++; - - __atomic_store (&v, &count, __ATOMIC_RELAXED); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_RELEASE); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_SEQ_CST); - if (v != count) - abort (); - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-2.c deleted file mode 100644 index da346fd7d..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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. */ - -extern void abort(void); - -short v, count; - -main () -{ - v = 0; - count = 0; - - __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != ++count) - abort (); - - /* Now test the generic variant. */ - count++; - - __atomic_store (&v, &count, __ATOMIC_RELAXED); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_RELEASE); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_SEQ_CST); - if (v != count) - abort (); - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-3.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-3.c deleted file mode 100644 index b691da459..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-3.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. */ - -extern void abort(void); - -int v, count; - -main () -{ - v = 0; - count = 0; - - __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != ++count) - abort (); - - /* Now test the generic variant. */ - count++; - - __atomic_store (&v, &count, __ATOMIC_RELAXED); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_RELEASE); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_SEQ_CST); - if (v != count) - abort (); - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-4.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-4.c deleted file mode 100644 index 0863be99d..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-4.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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. */ - -extern void abort(void); - -long long v, count; - -main () -{ - v = 0; - count = 0; - - __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != ++count) - abort (); - - /* Now test the generic variant. */ - count++; - - __atomic_store (&v, &count, __ATOMIC_RELAXED); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_RELEASE); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_SEQ_CST); - if (v != count) - abort (); - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-5.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-5.c deleted file mode 100644 index 763d29e24..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/atomic-store-5.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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-*-* } } } */ - -/* Test the execution of the __atomic_store_n builtin for a 16 byte value. */ - -extern void abort(void); - -__int128_t v, count; - -main () -{ - v = 0; - count = 0; - - __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE); - if (v != ++count) - abort (); - - __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST); - if (v != ++count) - abort (); - - /* Now test the generic variant. */ - count++; - - __atomic_store (&v, &count, __ATOMIC_RELAXED); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_RELEASE); - if (v != count++) - abort (); - - __atomic_store (&v, &count, __ATOMIC_SEQ_CST); - if (v != count) - abort (); - - - return 0; -} - diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/c.exp b/gcc-4.8.1/libatomic/testsuite/libatomic.c/c.exp deleted file mode 100644 index 1da3cb1e8..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/c.exp +++ /dev/null @@ -1,44 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file] then { - unset lang_test_file -} - -load_lib libatomic-dg.exp - -# If a testcase doesn't have special options, use these. -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS "-g" -} - -# Initialize dg. -dg-init - -# Gather a list of all tests. -set tests [lsort [find $srcdir/$subdir *.c]] - -set ld_library_path $always_ld_library_path -append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] -set_ld_library_path_env_vars - -# Main loop. -dg-runtest $tests "" $DEFAULT_CFLAGS - -# All done. -dg-finish diff --git a/gcc-4.8.1/libatomic/testsuite/libatomic.c/generic-2.c b/gcc-4.8.1/libatomic/testsuite/libatomic.c/generic-2.c deleted file mode 100644 index aa0014d2d..000000000 --- a/gcc-4.8.1/libatomic/testsuite/libatomic.c/generic-2.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do run } */ - -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -/* Avoid using the builtins, calling directly to the library functions - of the same name, so that we get direct access to the size_t and - don't have to create myriad types of different sizes. */ - -#define C2_(X,Y) X ## Y -#define C2(X,Y) C2_(X,Y) - -#define S2(X) #X -#define S(X) S2(X) - -#define ASMNAME(X) __asm__(S(C2(__USER_LABEL_PREFIX__,X))) -#define MAN(X) ASMNAME(C2(__atomic_,X)) - -void libat_load (size_t, void *, void *, int) MAN(load); -void libat_store (size_t, void *, void *, int) MAN(store); -void libat_exchange (size_t, void *, void *, void *, int) MAN(exchange); -bool libat_compare_exchange (size_t, void *, void *, void *, int, int) - MAN(compare_exchange); -bool libat_is_lock_free (size_t, void *) MAN(is_lock_free); - - -#define ALIGN 16 -#define MAX 4*ALIGN - -static char a[MAX]; -static char b[MAX]; -static char c[MAX]; -static char pa[MAX]; -static char pb[MAX]; - -static void test_load(void) -{ - int i, j; - for (i = ALIGN; i < 2*ALIGN; ++i) - for (j = 1; j <= 2*ALIGN; ++j) - { - memcpy(b, pa, MAX); - memcpy(b + i, pb, j); - libat_load (j, b + i, a, 0); - if (memcmp (a, pb, j) != 0) abort (); - } -} - -static void test_store(void) -{ - int i, j; - for (i = ALIGN; i < 2*ALIGN; ++i) - for (j = 1; j <= 2*ALIGN; ++j) - { - memcpy(a, pa, MAX); - memcpy(b, pa, MAX); - memcpy(b + i, pb, j); - libat_store (j, a + i, pb, 0); - if (memcmp (a, b, MAX) != 0) abort (); - } -} - -static void test_exch(void) -{ - int i, j; - for (i = ALIGN; i < 2 * ALIGN; ++i) - for (j = 1; j <= 2*ALIGN; ++j) - { - memcpy(a, pa, MAX); - memcpy(b, pa, MAX); - memcpy(b + i, pb, j); - libat_exchange (j, a + i, pb, c, 0); - if (memcmp (a, b, MAX) != 0) abort (); - if (memcmp (c, pa + i, j) != 0) abort (); - - memcpy(a, pa, MAX); - memcpy(c, pb, MAX); - libat_exchange (j, a + i, c + i, c + i, 0); - memcpy(b, pa, MAX); - memcpy(b + i, pb + i, j); - if (memcmp (b, a, MAX) != 0) abort (); - memcpy(b, pb, MAX); - memcpy(b + i, pa + i, j); - if (memcmp (b, c, MAX) != 0) abort (); - } -} - -static void test_cas(void) -{ - int i, j; - for (i = ALIGN; i < 2 * ALIGN; ++i) - for (j = 1; j <= 2*ALIGN; ++j) - { - memcpy(a, pa, MAX); - memcpy(b, pa, MAX); - memcpy(c, pa, MAX); - memcpy(b + i, pb, j); - if (!libat_compare_exchange (j, a + i, c + i, pb, 0, 0)) abort (); - if (memcmp (c, pa, MAX) != 0) abort (); - if (memcmp (a, b, MAX) != 0) abort (); - - memcpy(a, pb, MAX); - memcpy(b, pa, MAX); - memcpy(c, pa, MAX); - memcpy(b + i, pb + i, j); - if (libat_compare_exchange (j, a + i, c + i, pb, 0, 0)) abort (); - if (memcmp (a, pb, MAX) != 0) abort (); - if (memcmp (b, c, MAX) != 0) abort (); - } -} - -int main (void) -{ - int i; - for (i = 0; i < MAX; ++i) - { - pa[i] = i * 2; - pb[i] = i * 2 + 1; - } - - test_load (); - test_store (); - test_exch (); - test_cas (); - - return 0; -} |