Debian Codegraph @

gcc/testsuite/gcc.target/bpf/atomic-fetch-op-3.c

raw
1 /* Test atomic-fetch-op instructions are disabled with -mno-v3-atomics. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-mno-v3-atomics -O2 -masm=normal" } */
5
6 long val;
7
8 long
9 test_atomic_fetch_add (long x)
10 {
11 return __atomic_fetch_add (&val, x, __ATOMIC_ACQUIRE);
12 }
13
14 long
15 test_atomic_fetch_sub (long x)
16 {
17 return __atomic_fetch_sub (&val, x, __ATOMIC_RELEASE);
18 }
19
20 long
21 test_atomic_fetch_and (long x)
22 {
23 return __atomic_fetch_and (&val, x, __ATOMIC_ACQUIRE);
24 }
25
26 long
27 test_atomic_fetch_nand (long x)
28 {
29 return __atomic_fetch_nand (&val, x, __ATOMIC_ACQUIRE);
30 }
31
32 long
33 test_atomic_fetch_or (long x)
34 {
35 return __atomic_fetch_or (&val, x, __ATOMIC_ACQUIRE);
36 }
37
38 long
39 test_atomic_fetch_xor (long x)
40 {
41 return __atomic_fetch_xor (&val, x, __ATOMIC_ACQUIRE);
42 }
43
44 /* { dg-final { scan-assembler-not "afadd\t" } } */
45 /* { dg-final { scan-assembler-not "afand\t" } } */
46 /* { dg-final { scan-assembler-not "afor\t" } } */
47 /* { dg-final { scan-assembler-not "afxor\t" } } */
48 /* { dg-final { scan-assembler-not "acmp\t" } } */
49 /* { dg-final { scan-assembler-not "axchg\t" } } */