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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c/] [task-1.c] - Blame information for rev 810

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

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

powered by: WebSVN 2.1.0

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