gcc/testsuite/gcc.target/riscv/amo/zaamo-preferred-over-zalrsc.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* Ensure that AMO ops are emitted when both zalrsc and zaamo are enabled. */ |
| 3 | /* { dg-options "-O3" } */ |
| 4 | /* { dg-add-options riscv_zalrsc } */ |
| 5 | /* { dg-add-options riscv_zaamo } */ |
| 6 | /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ |
| 7 | /* { dg-final { check-function-bodies "**" "" } } */ |
| 8 | |
| 9 | /* |
| 10 | ** foo: |
| 11 | ** amoadd\.w\tzero,a1,0\(a0\) |
| 12 | ** ret |
| 13 | */ |
| 14 | void foo (int* bar, int baz) |
| 15 | { |
| 16 | __atomic_add_fetch(bar, baz, __ATOMIC_RELAXED); |
| 17 | } |