aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/cris/sync-1.c
blob: 1bc9a674c3b12fe5ca5627135f8312396de00eb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* 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