PR target/83368
[official-gcc.git] / gcc / testsuite / gcc.target / cris / sync-1.c
blob1bc9a674c3b12fe5ca5627135f8312396de00eb0
1 /* Check that we can assemble both base atomic variants, for v0. */
2 /* { dg-do assemble } */
3 /* { dg-options "-O2 -march=v0" } */
5 #ifndef type
6 #define type char
7 #endif
9 #if !defined(op) && !defined(xchg)
10 #define op 1
11 #define xchg 1
12 #endif
14 #ifndef op
15 #define op 0
16 #endif
18 #ifndef xchg
19 #define xchg 0
20 #endif
22 #if op
23 int sfa (type *p, type *q, int a)
25 return __atomic_fetch_nand (p, a, __ATOMIC_ACQ_REL)
26 + __atomic_fetch_add (q, a, __ATOMIC_SEQ_CST);
28 #endif
30 #if xchg
31 void acen (type *ptr, type *val, type *ret)
33 __atomic_exchange (ptr, val, ret, __ATOMIC_SEQ_CST);
35 #endif