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

Subversion Repositories openrisc

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
// { dg-do run }
2
 
3
extern "C" void abort ();
4
int x = 6, cnt;
5
 
6
int
7
foo ()
8
{
9
  return cnt++;
10
}
11
 
12
int
13
main ()
14
{
15
  int v, *p;
16
  #pragma omp atomic update
17
    x = x + 7;
18
  #pragma omp atomic
19
    x = x + 7 + 6;
20
  #pragma omp atomic update
21
    x = x + 2 * 3;
22
  #pragma omp atomic
23
    x = x * (2 - 1);
24
  #pragma omp atomic read
25
    v = x;
26
  if (v != 32)
27
    abort ();
28
  #pragma omp atomic write
29
    x = 0;
30
  #pragma omp atomic capture
31
    {
32
      v = x;
33
      x = x | 1 ^ 2;
34
    }
35
  if (v != 0)
36
    abort ();
37
  #pragma omp atomic capture
38
    {
39
      v = x;
40
      x = x | 4 | 2;
41
    }
42
  if (v != 3)
43
    abort ();
44
  #pragma omp atomic read
45
    v = x;
46
  if (v != 7)
47
    abort ();
48
  #pragma omp atomic capture
49
    {
50
      x = x ^ 6 & 2;
51
      v = x;
52
    }
53
  if (v != 5)
54
    abort ();
55
  #pragma omp atomic capture
56
    { x = x - (6 + 4); v = x; }
57
  if (v != -5)
58
    abort ();
59
  #pragma omp atomic capture
60
    { v = x; x = x - (1 | 2); }
61
  if (v != -5)
62
    abort ();
63
  #pragma omp atomic read
64
    v = x;
65
  if (v != -8)
66
    abort ();
67
  #pragma omp atomic
68
    x = x * -4 / 2;
69
  #pragma omp atomic read
70
    v = x;
71
  if (v != 16)
72
    abort ();
73
  p = &x;
74
  #pragma omp atomic update
75
    p[foo (), 0] = p[foo (), 0] - 16;
76
  #pragma omp atomic read
77
    v = x;
78
  if (cnt != 2 || v != 0)
79
    abort ();
80
  #pragma omp atomic capture
81
    {
82
      p[foo (), 0] += 6;
83
      v = p[foo (), 0];
84
    }
85
  if (cnt != 4 || v != 6)
86
    abort ();
87
  #pragma omp atomic capture
88
    {
89
      v = p[foo (), 0];
90
      p[foo (), 0] += 6;
91
    }
92
  if (cnt != 6 || v != 6)
93
    abort ();
94
  #pragma omp atomic read
95
    v = x;
96
  if (v != 12)
97
    abort ();
98
  #pragma omp atomic capture
99
    {
100
      p[foo (), 0] = p[foo (), 0] + 6;
101
      v = p[foo (), 0];
102
    }
103
  if (cnt != 9 || v != 18)
104
    abort ();
105
  #pragma omp atomic capture
106
    {
107
      v = p[foo (), 0];
108
      p[foo (), 0] = p[foo (), 0] + 6;
109
    }
110
  if (cnt != 12 || v != 18)
111
    abort ();
112
  #pragma omp atomic read
113
    v = x;
114
  if (v != 24)
115
    abort ();
116
  #pragma omp atomic capture
117
  { v = p[foo (), 0]; p[foo (), 0]++; }
118
  #pragma omp atomic capture
119
  { v = p[foo (), 0]; ++p[foo (), 0]; }
120
  #pragma omp atomic capture
121
  { p[foo (), 0]++; v = p[foo (), 0]; }
122
  #pragma omp atomic capture
123
  { ++p[foo (), 0]; v = p[foo (), 0]; }
124
  if (cnt != 20 || v != 28)
125
    abort ();
126
  #pragma omp atomic capture
127
  { v = p[foo (), 0]; p[foo (), 0]--; }
128
  #pragma omp atomic capture
129
  { v = p[foo (), 0]; --p[foo (), 0]; }
130
  #pragma omp atomic capture
131
  { p[foo (), 0]--; v = p[foo (), 0]; }
132
  #pragma omp atomic capture
133
  { --p[foo (), 0]; v = p[foo (), 0]; }
134
  if (cnt != 28 || v != 24)
135
    abort ();
136
  return 0;
137
}

powered by: WebSVN 2.1.0

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