summaryrefslogtreecommitdiff
path: root/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c')
-rw-r--r--libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c85
1 files changed, 0 insertions, 85 deletions
diff --git a/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c b/libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c
deleted file mode 100644
index f424c4a2fb..0000000000
--- a/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 } */
-
-/* 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
-
-int
-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;
-}