Debian Codegraph @

gcc/testsuite/gcc.target/riscv/amo/zacas-ztso-compare-exchange-compatability-mapping-no-fence.c

raw
1 /*
2 ** Verify that atomic op mappings match the PSABI doc's recommended mapping.
3 ** compare_exchange ops without a seq_cst failure ordering do *not* need a
4 ** leading fence.
5 */
6 /* { dg-do compile } */
7 /* { dg-options "-O3" } */
8 /* { dg-add-options riscv_zacas } */
9 /* { dg-add-options riscv_ztso } */
10 /* { dg-final { scan-assembler-not "\tfence" } } */
11
12 void atomic_compare_exchange_weak_int_seq_cst_relaxed (int *bar, int *baz, int qux)
13 {
14 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
15 }
16
17 void atomic_compare_exchange_weak_int_seq_cst_acquire (int *bar, int *baz, int qux)
18 {
19 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
20 }
21
22 void atomic_compare_exchange_strong_int_seq_cst_relaxed (int *bar, int *baz, int qux)
23 {
24 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
25 }
26
27 void atomic_compare_exchange_strong_int_seq_cst_acquire (int *bar, int *baz, int qux)
28 {
29 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
30 }