Debian Codegraph @

gcc/testsuite/gcc.target/riscv/amo/zacas-preferred-over-zalrsc.c

raw
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-final { scan-assembler-not "\tlr\.w" } } */
8 /* { dg-final { scan-assembler-not "\tsc\.w" } } */
9 /* { dg-final { scan-assembler-times "amocas\.w\t" 2 } } */
10
11
12 void atomic_compare_exchange_weak_int_relaxed (int *bar, int *baz, int qux)
13 {
14 __atomic_compare_exchange_n(bar, baz, qux, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
15 }
16
17 void atomic_compare_exchange_strong_int_relaxed (int *bar, int *baz, int qux)
18 {
19 __atomic_compare_exchange_n(bar, baz, qux, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
20 }