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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [atomic-4.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
template 
5
int
6
foo (void)
7
{
8
  extern T x;
9
  extern T2 y;
10
  T v;
11
  T2 f;
12
  #pragma omp atomic read
13
    v = x;
14
  if (v != 6)
15
    abort ();
16
  #pragma omp atomic write
17
    x = 17;
18
  #pragma omp atomic read
19
  v = x;
20
  if (v != 17)
21
    abort ();
22
  #pragma omp atomic update
23
    x++;
24
  #pragma omp atomic read
25
    v = x;
26
  if (v != 18)
27
    abort ();
28
  #pragma omp atomic capture
29
    v = x++;
30
  if (v != 18)
31
    abort ();
32
  #pragma omp atomic read
33
    v = x;
34
  if (v != 19)
35
    abort ();
36
  #pragma omp atomic capture
37
    v = ++x;
38
  if (v != 20)
39
    abort ();
40
  #pragma omp atomic read
41
    v = x;
42
  if (v != 20)
43
    abort ();
44
  #pragma omp atomic capture
45
    { v = x; x *= 3; }
46
  if (v != 20)
47
    abort ();
48
  #pragma omp atomic read
49
    v = x;
50
  if (v != 60)
51
    abort ();
52
  #pragma omp atomic capture
53
    {
54
      x |= 2;
55
      v = x;
56
    }
57
  if (v != 62)
58
    abort ();
59
  #pragma omp atomic read
60
    v = x;
61
  if (v != 62)
62
    abort ();
63
  #pragma omp atomic capture
64
    { v = x; x++; }
65
  if (v != 62)
66
    abort ();
67
  #pragma omp atomic capture
68
    { v = x; ++x; }
69
  if (v != 63)
70
    abort ();
71
  #pragma omp atomic capture
72
    {
73
      ++x;
74
      v = x;
75
    }
76
  if (v != 65)
77
    abort ();
78
#pragma omp atomic capture
79
{x++;v=x;}if (v != 66)
80
    abort ();
81
  #pragma omp atomic read
82
    v = x;
83
  if (v != 66)
84
    abort ();
85
  #pragma omp atomic capture
86
    { v = x; x--; }
87
  if (v != 66)
88
    abort ();
89
  #pragma omp atomic capture
90
    { v = x; --x; }
91
  if (v != 65)
92
    abort ();
93
  #pragma omp atomic capture
94
    {
95
      --x;
96
      v = x;
97
    }
98
  if (v != 63)
99
    abort ();
100
  #pragma omp atomic capture
101
  { x--; v = x; } if (v != 62)
102
    abort ();
103
  #pragma omp atomic read
104
    v = x;
105
  if (v != 62)
106
    abort ();
107
  #pragma omp atomic write
108
    y = 17.5f;
109
  #pragma omp atomic read
110
    f = y;
111
  if (f != 17.5)
112
    abort ();
113
  #pragma omp atomic update
114
    y *= 2.0f;
115
  #pragma omp atomic read
116
    f = y;
117
  if (y != 35.0)
118
    abort ();
119
  #pragma omp atomic capture
120
    f = y *= 2.0f;
121
  if (f != 70.0)
122
    abort ();
123
  #pragma omp atomic capture
124
    f = y++;
125
  if (f != 70.0)
126
    abort ();
127
  #pragma omp atomic read
128
    f = y;
129
  if (f != 71.0)
130
    abort ();
131
  #pragma omp atomic capture
132
    f = --y;
133
  if (f != 70.0)
134
    abort ();
135
  #pragma omp atomic read
136
    f = y;
137
  if (f != 70.0)
138
    abort ();
139
  #pragma omp atomic capture
140
    { f = y; y /= 2.0f; }
141
  if (f != 70.0)
142
    abort ();
143
  #pragma omp atomic read
144
    f = y;
145
  if (f != 35.0)
146
    abort ();
147
  #pragma omp atomic capture
148
    { y /= 2.0f; f = y; }
149
  if (f != 17.5)
150
    abort ();
151
  #pragma omp atomic read
152
    f = y;
153
  if (f != 17.5)
154
    abort ();
155
  return 0;
156
}
157
 
158
int x = 6;
159
float y;
160
 
161
int
162
main ()
163
{
164
  foo  ();
165
  return 0;
166
}

powered by: WebSVN 2.1.0

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