| 1 |
/* Verify that atomic op mappings match the PSABI doc's recommended mapping. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O3" } */ |
| 4 |
/* { dg-add-options riscv_zabha } */ |
| 5 |
/* { dg-add-options riscv_zacas } */ |
| 6 |
/* { dg-add-options riscv_ztso } */ |
| 7 |
/* { dg-final { scan-assembler-not "\tlr\.w" } } */ |
| 8 |
/* { dg-final { scan-assembler-not "\tsc\.w" } } */ |
| 9 |
/* { dg-final { scan-assembler-times "amocas\.h\t" 8 } } */ |
| 10 |
|
| 11 |
void atomic_compare_exchange_weak_short_relaxed (short *bar, short *baz, short qux) |
| 12 |
{ |
| 13 |
__atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 14 |
} |
| 15 |
|
| 16 |
void atomic_compare_exchange_strong_short_relaxed (short *bar, short *baz, short qux) |
| 17 |
{ |
| 18 |
__atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
| 19 |
} |
| 20 |
|
| 21 |
void atomic_compare_exchange_weak_short_acquire (short *bar, short *baz, short qux) |
| 22 |
{ |
| 23 |
__atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); |
| 24 |
} |
| 25 |
|
| 26 |
void atomic_compare_exchange_strong_short_acquire (short *bar, short *baz, short qux) |
| 27 |
{ |
| 28 |
__atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); |
| 29 |
} |
| 30 |
|
| 31 |
void atomic_compare_exchange_weak_short_release (short *bar, short *baz, short qux) |
| 32 |
{ |
| 33 |
__atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED); |
| 34 |
} |
| 35 |
|
| 36 |
void atomic_compare_exchange_strong_short_release (short *bar, short *baz, short qux) |
| 37 |
{ |
| 38 |
__atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_RELAXED); |
| 39 |
} |
| 40 |
|
| 41 |
void atomic_compare_exchange_weak_short_acq_rel (short *bar, short *baz, short qux) |
| 42 |
{ |
| 43 |
__atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED); |
| 44 |
} |
| 45 |
|
| 46 |
void atomic_compare_exchange_strong_short_acq_rel (short *bar, short *baz, short qux) |
| 47 |
{ |
| 48 |
__atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED); |
| 49 |
} |