2 /* { dg-additional-options "-DSYNC_FALLBACK" { target { ! cas_int } } } */
5 /* The SYNC_FALLBACK code is just so we don't have to restrict this test
6 to any subset of targets. For targets with no atomics support at
7 all, the cas_int effective-target is false and the fallback provides
8 a PASS. Where the bug trigs (at the time this test-case was added),
9 cas_int is also false but the fallback isn't used. */
10 __attribute__((__noinline__
, __noclone__
))
12 # if __INT_MAX__ == 0x7fff
13 __sync_fetch_and_add_2
15 __sync_fetch_and_add_4
17 (volatile void *at
, unsigned val
)
19 unsigned tmp
= *(volatile unsigned*)at
;
21 *(volatile unsigned*)at
= tmp
+ val
;
26 __attribute__((__noinline__
, __noclone__
))
27 void g (unsigned *at
, unsigned val
)
30 __sync_fetch_and_add (at
, val
);
35 /* On PTX it is not valid to perform atomic operations on auto
36 variables, which end up in .local. Making this static places it
38 static unsigned x
= 41;