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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [task-6.C] - Blame information for rev 760

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

Line No. Rev Author Line
1 735 jeremybenn
extern "C" void abort ();
2
 
3
int a = 18;
4
 
5
template 
6
void
7
f1 (T i, T j, T k)
8
{
9
  T l = 6, m = 7, n = 8;
10
#pragma omp task private(j, m) shared(k, n)
11
  {
12
    j = 6;
13
    m = 5;
14
    if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9)
15
      #pragma omp atomic
16
        k++;
17
  }
18
#pragma omp taskwait
19
  if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9)
20
    abort ();
21
}
22
 
23
int v1 = 1, v2 = 2, v5 = 5;
24
int e;
25
 
26
template 
27
void
28
f2 (void)
29
{
30
  T v3 = 3;
31
#pragma omp sections private (v1) firstprivate (v2)
32
  {
33
  #pragma omp section
34
    {
35
      T v4 = 4;
36
      v1 = 7;
37
      #pragma omp task
38
        {
39
          if (++v1 != 8 || ++v2 != 3 || ++v3 != 4 || ++v4 != 5 || ++v5 != 6)
40
            e = 1;
41
        }
42
      #pragma omp taskwait
43
      if (v1 != 7 || v2 != 2 || v3 != 3 || v4 != 4 || v5 != 6)
44
        abort ();
45
      if (e)
46
        abort ();
47
    }
48
  }
49
}
50
 
51
template 
52
void
53
f3 (T i, T j, T k)
54
{
55
  T l = 6, m = 7, n = 8;
56
#pragma omp task private(j, m) shared(k, n) untied
57
  {
58
    j = 6;
59
    m = 5;
60
    if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9)
61
      #pragma omp atomic
62
        k++;
63
  }
64
#pragma omp taskwait
65
  if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9)
66
    abort ();
67
}
68
 
69
int
70
main ()
71
{
72
  f1  (8, 26, 0);
73
  f2  ();
74
  a = 18;
75
  f3  (8, 26, 0);
76
  a = 18;
77
#pragma omp parallel num_threads(4)
78
  {
79
    #pragma omp master
80
      {
81
        f1  (8, 26, 0);
82
        a = 18;
83
        f3  (8, 26, 0);
84
      }
85
  }
86
}

powered by: WebSVN 2.1.0

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