gcc/testsuite/gcc.target/riscv/amo/zalrsc-rvwmo-compare-exchange-int-release.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* Verify that compare exchange mappings match the PSABI doc's recommended mapping. */ |
| 3 | /* { dg-add-options riscv_zalrsc } */ |
| 4 | /* { dg-remove-options riscv_ztso } */ |
| 5 | /* { dg-remove-options riscv_zacas } */ |
| 6 | /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ |
| 7 | /* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ |
| 8 | |
| 9 | void foo (int bar, int baz, int qux) |
| 10 | { |
| 11 | __atomic_compare_exchange_n(&bar, &baz, qux, 1, __ATOMIC_RELEASE, __ATOMIC_RELAXED); |
| 12 | } |