OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [atomic-7.C] - Blame information for rev 735

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
// { dg-do run }
2
 
3
extern "C" void abort (void);
4
 
5
template 
6
void
7
foo (void)
8
{
9
  extern S l, m;
10
  extern T i, j;
11
 
12
  #pragma omp atomic read
13
    i = l;
14
  #pragma omp atomic read
15
    m = j;
16
  if (i != 77 || m != 88)
17
    abort ();
18
  #pragma omp atomic write
19
    l = 1 + i + 6 * 1;
20
  #pragma omp atomic write
21
    j = 170 - 170 + m + 1 * 7;
22
  #pragma omp atomic capture
23
    i = l += 4;
24
  #pragma omp atomic capture
25
    m = j += 4;
26
  if (i != 88 || m != 99)
27
    abort ();
28
  #pragma omp atomic capture
29
    {
30
      i = l;
31
      l += 4;
32
    }
33
  #pragma omp atomic capture
34
    {
35
      m = j;
36
      j += 4;
37
    }
38
  if (i != 88 || m != 99)
39
    abort ();
40
  #pragma omp atomic capture
41
    {
42
      l += 4;
43
      i = l;
44
    }
45
  #pragma omp atomic capture
46
    {
47
      j += 4;
48
      m = j;
49
    }
50
  if (i != 96 || m != 107)
51
    abort ();
52
}
53
 
54
long long l, m;
55
int i, j;
56
 
57
int
58
main ()
59
{
60
  l = 77;
61
  j = 88;
62
  foo  ();
63
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.