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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [task-2.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
#include 
4
extern "C" void abort ();
5
 
6
int l = 5;
7
 
8
int
9
foo (int i)
10
{
11
  int j = 7;
12
  const int k = 8;
13
  #pragma omp task firstprivate (i) shared (j, l)
14
  {
15
    #pragma omp critical
16
      {
17
        j += i;
18
        l += k;
19
      }
20
  }
21
  i++;
22
  #pragma omp task firstprivate (i) shared (j, l)
23
  {
24
    #pragma omp critical
25
      {
26
        j += i;
27
        l += k;
28
      }
29
  }
30
  i++;
31
  #pragma omp task firstprivate (i) shared (j, l)
32
  {
33
    #pragma omp critical
34
      {
35
        j += i;
36
        l += k;
37
      }
38
  }
39
  i++;
40
  #pragma omp task firstprivate (i) shared (j, l)
41
  {
42
    #pragma omp critical
43
      {
44
        j += i;
45
        l += k;
46
      }
47
  }
48
  i++;
49
  #pragma omp taskwait
50
  return (i != 8 * omp_get_thread_num () + 4
51
          || j != 4 * i - 3
52
          || k != 8);
53
}
54
 
55
int
56
main (void)
57
{
58
  int r = 0;
59
  #pragma omp parallel num_threads (4) reduction(+:r)
60
    if (omp_get_num_threads () != 4)
61
      {
62
        #pragma omp master
63
          l = 133;
64
      }
65
    else if (foo (8 * omp_get_thread_num ()))
66
      r++;
67
  if (r || l != 133)
68
    abort ();
69
  return 0;
70
}

powered by: WebSVN 2.1.0

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