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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c++/] [reduction-1.C] - Blame information for rev 837

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

Line No. Rev Author Line
1 273 jeremybenn
#include 
2
#include 
3
 
4
int
5
main (void)
6
{
7
  int i = 0, j = 0, k = ~0;
8
  double d = 1.0;
9
#pragma omp parallel num_threads(4) reduction(+:i) reduction(*:d) reduction(&:k)
10
  {
11
    if (i != 0 || d != 1.0 || k != ~0)
12
#pragma omp atomic
13
      j |= 1;
14
 
15
    if (omp_get_num_threads () != 4)
16
#pragma omp atomic
17
      j |= 2;
18
 
19
    i = omp_get_thread_num ();
20
    d = i + 1;
21
    k = ~(1 << (2 * i));
22
  }
23
 
24
  if (j & 1)
25
    abort ();
26
  if ((j & 2) == 0)
27
    {
28
      if (i != (0 + 1 + 2 + 3))
29
        abort ();
30
      if (d != (1.0 * 2.0 * 3.0 * 4.0))
31
        abort ();
32
      if (k != (~0 ^ 0x55))
33
        abort ();
34
    }
35
  return 0;
36
}

powered by: WebSVN 2.1.0

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