Debian Codegraph @

gcc/testsuite/gcc.target/riscv/amo/zacas-ztso-compare-exchange-int.c

raw
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_zacas } */
5 /* { dg-add-options riscv_ztso } */
6 /* { dg-final { scan-assembler-not "\tlr\.w" } } */
7 /* { dg-final { scan-assembler-not "\tsc\.w" } } */
8 /* { dg-final { scan-assembler-times "amocas\.w\t" 8 } } */
9
10 void atomic_compare_exchange_weak_int_relaxed (int *bar, int *baz, int qux)
11 {
12 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
13 }
14
15 void atomic_compare_exchange_strong_int_relaxed (int *bar, int *baz, int qux)
16 {
17 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
18 }
19
20 void atomic_compare_exchange_weak_int_acquire (int *bar, int *baz, int qux)
21 {
22 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
23 }
24
25 void atomic_compare_exchange_strong_int_acquire (int *bar, int *baz, int qux)
26 {
27 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
28 }
29
30 void atomic_compare_exchange_weak_int_release (int *bar, int *baz, int qux)
31 {
32 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
33 }
34
35 void atomic_compare_exchange_strong_int_release (int *bar, int *baz, int qux)
36 {
37 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
38 }
39
40 void atomic_compare_exchange_weak_int_acq_rel (int *bar, int *baz, int qux)
41 {
42 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
43 }
44
45 void atomic_compare_exchange_strong_int_acq_rel (int *bar, int *baz, int qux)
46 {
47 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
48 }