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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [reduction-3.C] - Blame information for rev 830

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

Line No. Rev Author Line
1 735 jeremybenn
#include 
2
#include 
3
 
4
int
5
main (void)
6
{
7
  int i = 0, j = 0, k = ~0, l;
8
  double d = 1.0;
9
#pragma omp parallel num_threads(4)
10
  {
11
#pragma omp single
12
    {
13
      i = 16;
14
      k ^= (1 << 16);
15
      d += 32.0;
16
    }
17
 
18
#pragma omp for reduction(+:i) reduction(*:d) reduction(&:k) nowait
19
    for (l = 0; l < 4; l++)
20
      {
21
        if (omp_get_num_threads () == 4 && (i != 0 || d != 1.0 || k != ~0))
22
#pragma omp atomic
23
          j |= 1;
24
 
25
        if (l == omp_get_thread_num ())
26
          {
27
            i = omp_get_thread_num ();
28
            d = i + 1;
29
            k = ~(1 << (2 * i));
30
          }
31
      }
32
 
33
    if (omp_get_num_threads () == 4)
34
      {
35
#pragma omp barrier
36
        if (i != (16 + 0 + 1 + 2 + 3))
37
#pragma omp atomic
38
          j |= 2;
39
        if (d != (33.0 * 1.0 * 2.0 * 3.0 * 4.0))
40
#pragma omp atomic
41
          j |= 4;
42
        if (k != (~0 ^ 0x55 ^ (1 << 16)))
43
#pragma omp atomic
44
          j |= 8;
45
      }
46
  }
47
 
48
  if (j)
49
    abort ();
50
  return 0;
51
}

powered by: WebSVN 2.1.0

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