Debian Codegraph @

gcc/testsuite/gcc.target/riscv/amo/zacas-ztso-compare-exchange-char.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_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\.b\t" 8 } } */
10
11 void atomic_compare_exchange_weak_char_relaxed (char *bar, char *baz, char qux)
12 {
13 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
14 }
15
16 void atomic_compare_exchange_strong_char_relaxed (char *bar, char *baz, char qux)
17 {
18 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
19 }
20
21 void atomic_compare_exchange_weak_char_acquire (char *bar, char *baz, char qux)
22 {
23 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
24 }
25
26 void atomic_compare_exchange_strong_char_acquire (char *bar, char *baz, char qux)
27 {
28 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
29 }
30
31 void atomic_compare_exchange_weak_char_release (char *bar, char *baz, char qux)
32 {
33 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
34 }
35
36 void atomic_compare_exchange_strong_char_release (char *bar, char *baz, char qux)
37 {
38 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
39 }
40
41 void atomic_compare_exchange_weak_char_acq_rel (char *bar, char *baz, char qux)
42 {
43 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
44 }
45
46 void atomic_compare_exchange_strong_char_acq_rel (char *bar, char *baz, char qux)
47 {
48 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
49 }