aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bpf/atomic-fetch-op-3.c
blob: 044a2f76474b8a086cb185f926766d0607c4e973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Test atomic-fetch-op instructions are disabled with -mno-v3-atomics.  */

/* { dg-do compile } */
/* { dg-options "-mno-v3-atomics -O2" } */

long val;

long
test_atomic_fetch_add (long x)
{
  return __atomic_fetch_add (&val, x, __ATOMIC_ACQUIRE);
}

long
test_atomic_fetch_sub (long x)
{
  return __atomic_fetch_sub (&val, x, __ATOMIC_RELEASE);
}

long
test_atomic_fetch_and (long x)
{
  return __atomic_fetch_and (&val, x, __ATOMIC_ACQUIRE);
}

long
test_atomic_fetch_nand (long x)
{
  return __atomic_fetch_nand (&val, x, __ATOMIC_ACQUIRE);
}

long
test_atomic_fetch_or (long x)
{
  return __atomic_fetch_or (&val, x, __ATOMIC_ACQUIRE);
}

long
test_atomic_fetch_xor (long x)
{
  return __atomic_fetch_xor (&val, x, __ATOMIC_ACQUIRE);
}

/* { dg-final { scan-assembler-not "afadd\t" } } */
/* { dg-final { scan-assembler-not "afand\t" } } */
/* { dg-final { scan-assembler-not "afor\t" } } */
/* { dg-final { scan-assembler-not "afxor\t" } } */
/* { dg-final { scan-assembler-not "acmp\t" } } */
/* { dg-final { scan-assembler-not "axchg\t" } } */