]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/atomic-load-4.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / atomic-load-4.c
CommitLineData
86951993
AM
1/* Test __atomic routines for existence and proper execution on 8 byte
2 values with each valid memory model. */
3/* { dg-do run } */
bf71de94 4/* { dg-require-effective-target sync_long_long_runtime } */
86951993 5/* { dg-options "" } */
9e08718a 6/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
86951993
AM
7
8extern void abort(void);
9
10long long v, count;
11
722516b8 12int
86951993
AM
13main ()
14{
15 v = 0;
16 count = 0;
17
18 if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
19 abort();
20 else
21 v++;
22
23 if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
24 abort();
25 else
26 v++;
27
28 if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
29 abort();
30 else
31 v++;
32
33 if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
34 abort();
35 else
36 v++;
37
38 /* Now test the generic variants. */
39
40 __atomic_load (&v, &count, __ATOMIC_RELAXED);
41 if (count != v)
42 abort();
43 else
44 v++;
45
46 __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
47 if (count != v)
48 abort();
49 else
50 v++;
51
52 __atomic_load (&v, &count, __ATOMIC_CONSUME);
53 if (count != v)
54 abort();
55 else
56 v++;
57
58 __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
59 if (count != v)
60 abort();
61 else
62 v++;
63
64
65 return 0;
66}
67