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  
      14  int
      15  main ()
      16  {
      17    v = 0;
      18    count = 0;
      19  
      20    __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
      21    if (v != ++count)
      22      abort ();
      23  
      24    __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
      25    if (v != ++count)
      26      abort ();
      27  
      28    __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
      29    if (v != ++count)
      30      abort ();
      31  
      32    /* Now test the generic variant.  */
      33    count++;
      34  
      35    __atomic_store (&v, &count, __ATOMIC_RELAXED);
      36    if (v != count++)
      37      abort ();
      38  
      39    __atomic_store (&v, &count, __ATOMIC_RELEASE);
      40    if (v != count++)
      41      abort ();
      42  
      43    __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
      44    if (v != count)
      45      abort ();
      46  
      47  
      48    return 0;
      49  }
      50