(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
atomic-load-4.c
       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  extern void abort(void);
       9  
      10  long long v, count;
      11  
      12  int
      13  main ()
      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