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