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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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