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

Subversion Repositories openrisc

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

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 (void);
4
bool v, x1, x2, x3, x4, x5, x6;
5
 
6
void
7
foo ()
8
{
9
  #pragma omp atomic capture
10
  v = ++x1;
11
  if (!v)
12
    abort ();
13
  #pragma omp atomic capture
14
  v = x2++;
15
  if (v)
16
    abort ();
17
  #pragma omp atomic read
18
  v = x3;
19
  if (!v)
20
    abort ();
21
  #pragma omp atomic read
22
  v = x4;
23
  if (!v)
24
    abort ();
25
  #pragma omp atomic capture
26
  { v = x5; x5 |= 1; }
27
  if (v)
28
    abort ();
29
  #pragma omp atomic capture
30
  { x6 |= 1; v = x6; }
31
  if (!v)
32
    abort ();
33
}
34
 
35
void
36
bar ()
37
{
38
  #pragma omp atomic write
39
  x1 = false;
40
  #pragma omp atomic write
41
  x2 = false;
42
  #pragma omp atomic capture
43
  { ++x1; v = x1; }
44
  if (!v)
45
    abort ();
46
  #pragma omp atomic capture
47
  { v = x2; x2++; }
48
  if (v)
49
    abort ();
50
  #pragma omp atomic write
51
  x1 = false;
52
  #pragma omp atomic write
53
  x2 = false;
54
  #pragma omp atomic capture
55
  { x1++; v = x1; }
56
  if (!v)
57
    abort ();
58
  #pragma omp atomic capture
59
  { v = x2; ++x2; }
60
  if (v)
61
    abort ();
62
}
63
 
64
int
65
main ()
66
{
67
  #pragma omp atomic write
68
  x3 = true;
69
  #pragma omp atomic write
70
  x4 = true;
71
  foo ();
72
  bar ();
73
  return 0;
74
}

powered by: WebSVN 2.1.0

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