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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [shared-1.c] - Blame information for rev 859

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

Line No. Rev Author Line
1 273 jeremybenn
extern void abort (void);
2
 
3
struct Y
4
{
5
  int l[5][10];
6
};
7
 
8
struct X
9
{
10
  struct Y y;
11
  float b[10];
12
};
13
 
14
void
15
parallel (int a, int b)
16
{
17
  int i, j;
18
  struct X A[10][5];
19
  a = b = 3;
20
 
21
  for (i = 0; i < 10; i++)
22
    for (j = 0; j < 5; j++)
23
      A[i][j].y.l[3][3] = -10;
24
 
25
  #pragma omp parallel shared (a, b, A) num_threads (5)
26
    {
27
      int i, j;
28
 
29
      #pragma omp atomic
30
      a += omp_get_num_threads ();
31
 
32
      #pragma omp atomic
33
      b += omp_get_num_threads ();
34
 
35
      #pragma omp for private (j)
36
      for (i = 0; i < 10; i++)
37
        for (j = 0; j < 5; j++)
38
          A[i][j].y.l[3][3] += 20;
39
 
40
    }
41
 
42
  for (i = 0; i < 10; i++)
43
    for (j = 0; j < 5; j++)
44
      if (A[i][j].y.l[3][3] != 10)
45
        abort ();
46
 
47
  if (a != 28)
48
    abort ();
49
 
50
  if (b != 28)
51
    abort ();
52
}
53
 
54
main()
55
{
56
  parallel (1, 2);
57
  return 0;
58
}

powered by: WebSVN 2.1.0

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