(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr103069-3.c
       1  /* PR target/103068 */
       2  /* { dg-do compile } */
       3  /* { dg-additional-options "-O2 -march=x86-64 -mtune=generic -mrelax-cmpxchg-loop" } */ 
       4  
       5  #include <stdint.h>
       6  
       7  #define FUNC_CMPXCHG(TYPE) \
       8  __attribute__ ((noinline, noclone))	\
       9  TYPE f_##TYPE##_cmpxchg (TYPE *lock, TYPE newval, TYPE oldval)  \
      10  { \
      11    do  \
      12    { \
      13      newval = oldval | 1;  \
      14    } while (! __atomic_compare_exchange_n (lock, &oldval, newval,  \
      15  					  0, __ATOMIC_RELEASE,  \
      16  					  __ATOMIC_RELAXED));  \
      17    return *lock;	\
      18  }
      19  
      20  
      21  FUNC_CMPXCHG (int64_t)
      22  FUNC_CMPXCHG (int)
      23  FUNC_CMPXCHG (short)
      24  FUNC_CMPXCHG (char)