gcc/testsuite/gcc.target/bpf/atomic-xchg-1.c
raw| 1 | /* Test atomic exchange instruction. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-mv3-atomics -O2 -masm=normal" } */ |
| 4 | |
| 5 | int foo (int *p, int *new) |
| 6 | { |
| 7 | int old; |
| 8 | __atomic_exchange (p, new, &old, __ATOMIC_RELAXED); |
| 9 | return old; |
| 10 | } |
| 11 | |
| 12 | int foo64 (long *p, long *new) |
| 13 | { |
| 14 | long old; |
| 15 | __atomic_exchange (p, new, &old, __ATOMIC_SEQ_CST); |
| 16 | return old; |
| 17 | } |
| 18 | |
| 19 | /* { dg-final { scan-assembler-times "axchg\t.*" 1 } } */ |
| 20 | /* { dg-final { scan-assembler-times "axchg32\t.*" 1 } } */ |