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

Subversion Repositories openrisc

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

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 <omp.h>
4
#include <stdlib.h>
5
#include <string.h>
6
 
7
int e;
8
 
9
void __attribute__((noinline))
10
baz (int i, int *p, int j, int *q)
11
{
12
  if (p[0] != 1 || p[i] != 3 || q[0] != 2 || q[j] != 4)
13
    #pragma omp atomic
14
      e++;
15
}
16
 
17
void __attribute__((noinline))
18
foo (int i, int j)
19
{
20
  int p[i + 1];
21
  int q[j + 1];
22
  memset (p, 0, sizeof (p));
23
  memset (q, 0, sizeof (q));
24
  p[0] = 1;
25
  p[i] = 3;
26
  q[0] = 2;
27
  q[j] = 4;
28
  #pragma omp task firstprivate (p, q)
29
    baz (i, p, j, q);
30
}
31
 
32
int
33
main (void)
34
{
35
  #pragma omp parallel num_threads (4)
36
    foo (5 + omp_get_thread_num (), 7 + omp_get_thread_num ());
37
  if (e)
38
    abort ();
39
  return 0;
40
}

powered by: WebSVN 2.1.0

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