| 1 |
/* { dg-do compile } */ |
| 2 |
/* Ensure that AMO ops are emitted for subword cas when both zalrsc and |
| 3 |
zacas/zabha are enabled. */ |
| 4 |
/* { dg-options "-O3" } */ |
| 5 |
/* { dg-add-options riscv_zalrsc } */ |
| 6 |
/* { dg-add-options riscv_zacas } */ |
| 7 |
/* { dg-add-options riscv_zabha } */ |
| 8 |
/* { dg-final { scan-assembler-not "\tlr\.w" } } */ |
| 9 |
/* { dg-final { scan-assembler-not "\tsc\.w" } } */ |
| 10 |
/* { dg-final { scan-assembler-times "amocas\.b\t" 2 } } */ |
| 11 |
|
| 12 |
|
| 13 |
void atomic_compare_exchange_weak_char_relaxed (char *bar, char *baz, char qux) |
| 14 |
{ |
| 15 |
__atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 16 |
} |
| 17 |
|
| 18 |
void atomic_compare_exchange_strong_char_relaxed (char *bar, char *baz, char qux) |
| 19 |
{ |
| 20 |
__atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 21 |
} |