mirror of git://gcc.gnu.org/git/gcc.git
36 lines
587 B
C
36 lines
587 B
C
/* Check that we can assemble both base atomic variants, for v0. */
|
|
/* { dg-do assemble } */
|
|
/* { dg-options "-O2 -march=v0" } */
|
|
|
|
#ifndef type
|
|
#define type char
|
|
#endif
|
|
|
|
#if !defined(op) && !defined(xchg)
|
|
#define op 1
|
|
#define xchg 1
|
|
#endif
|
|
|
|
#ifndef op
|
|
#define op 0
|
|
#endif
|
|
|
|
#ifndef xchg
|
|
#define xchg 0
|
|
#endif
|
|
|
|
#if op
|
|
int sfa (type *p, type *q, int a)
|
|
{
|
|
return __atomic_fetch_nand (p, a, __ATOMIC_ACQ_REL)
|
|
+ __atomic_fetch_add (q, a, __ATOMIC_SEQ_CST);
|
|
}
|
|
#endif
|
|
|
|
#if xchg
|
|
void acen (type *ptr, type *val, type *ret)
|
|
{
|
|
__atomic_exchange (ptr, val, ret, __ATOMIC_SEQ_CST);
|
|
}
|
|
#endif
|