| 1 |
/* Test that atomic insns are properly disabled with -mno-v3-atomics. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-mno-v3-atomics -O2 -masm=normal" } */ |
| 4 |
|
| 5 |
int val; |
| 6 |
|
| 7 |
void |
| 8 |
test_atomic_add (int x) |
| 9 |
{ |
| 10 |
__atomic_add_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 11 |
} |
| 12 |
|
| 13 |
void |
| 14 |
test_atomic_sub (int x) |
| 15 |
{ |
| 16 |
__atomic_add_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 17 |
} |
| 18 |
|
| 19 |
void |
| 20 |
test_atomic_and (int x) |
| 21 |
{ |
| 22 |
__atomic_and_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
test_atomic_nand (int x) |
| 27 |
{ |
| 28 |
__atomic_nand_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
test_atomic_or (int x) |
| 33 |
{ |
| 34 |
__atomic_or_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 35 |
} |
| 36 |
|
| 37 |
void |
| 38 |
test_atomic_xor (int x) |
| 39 |
{ |
| 40 |
__atomic_xor_fetch (&val, x, __ATOMIC_ACQUIRE); |
| 41 |
} |
| 42 |
|
| 43 |
/* Without v3 atomics, only xadd{w,dw} is available. */ |
| 44 |
/* { dg-final { scan-assembler-not "aadd" } } */ |
| 45 |
/* { dg-final { scan-assembler-not "aand" } } */ |
| 46 |
/* { dg-final { scan-assembler-not "aor" } } */ |
| 47 |
/* { dg-final { scan-assembler-not "axor" } } */ |
| 48 |
/* { dg-final { scan-assembler-not "axchg" } } */ |
| 49 |
/* { dg-final { scan-assembler-not "acmp" } } */ |