| 1 |
/* Test atomic exchange instruction is disabled with -mno-v3-atomics. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-mno-v3-atomics -O2 -masm=normal" } */ |
| 4 |
|
| 5 |
int foo (int *p, int *new) |
| 6 |
{ |
| 7 |
int old; |
| 8 |
__atomic_exchange (p, new, &old, __ATOMIC_RELAXED); |
| 9 |
return old; |
| 10 |
} |
| 11 |
|
| 12 |
int foo64 (long *p, long *new) |
| 13 |
{ |
| 14 |
long old; |
| 15 |
__atomic_exchange (p, new, &old, __ATOMIC_SEQ_CST); |
| 16 |
return old; |
| 17 |
} |
| 18 |
|
| 19 |
/* { dg-final { scan-assembler-not "axchg\t.*" } } */ |
| 20 |
/* { dg-final { scan-assembler-not "axchg32\t.*" } } */ |