1 /* Test __atomic routines for existence and proper execution on 8 byte
2    values with each valid memory model.  */
3 /* { dg-do run } */
4 /* { dg-require-effective-target sync_long_long_runtime } */
5 /* { dg-options "" } */
6 /* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
7 
8 /* Test the execution of the __atomic_store_n builtin for a long long.  */
9 
10 extern void abort(void);
11 
12 long long v, count;
13 
main()14 main ()
15 {
16   v = 0;
17   count = 0;
18 
19   __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
20   if (v != ++count)
21     abort ();
22 
23   __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
24   if (v != ++count)
25     abort ();
26 
27   __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
28   if (v != ++count)
29     abort ();
30 
31   /* Now test the generic variant.  */
32   count++;
33 
34   __atomic_store (&v, &count, __ATOMIC_RELAXED);
35   if (v != count++)
36     abort ();
37 
38   __atomic_store (&v, &count, __ATOMIC_RELEASE);
39   if (v != count++)
40     abort ();
41 
42   __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
43   if (v != count)
44     abort ();
45 
46 
47   return 0;
48 }
49 
50