1 /* Check that we can assemble both base atomic variants, for v0. */
2 /* { dg-do assemble } */
3 /* { dg-options "-O2 -march=v0" { target { ! march_option } } } */
4
5 #ifndef type
6 #define type char
7 #endif
8
9 #if !defined(op) && !defined(xchg)
10 #define op 1
11 #define xchg 1
12 #endif
13
14 #ifndef op
15 #define op 0
16 #endif
17
18 #ifndef xchg
19 #define xchg 0
20 #endif
21
22 #if op
sfa(type * p,type * q,int a)23 int sfa (type *p, type *q, int a)
24 {
25 return __atomic_fetch_nand (p, a, __ATOMIC_ACQ_REL)
26 + __atomic_fetch_add (q, a, __ATOMIC_SEQ_CST);
27 }
28 #endif
29
30 #if xchg
acen(type * ptr,type * val,type * ret)31 void acen (type *ptr, type *val, type *ret)
32 {
33 __atomic_exchange (ptr, val, ret, __ATOMIC_SEQ_CST);
34 }
35 #endif
36