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  /* Test the execution of the __atomic_store_n builtin for a 16 byte value.  */
       8  
       9  extern void abort(void);
      10  
      11  __int128_t v, count;
      12  
      13  int
      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