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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c/] [copyin-3.c] - Blame information for rev 735

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
/* { dg-require-effective-target tls_runtime } */
4
 
5
#include <omp.h>
6
#include <stdlib.h>
7
 
8
int thr;
9
#pragma omp threadprivate (thr)
10
 
11
int
12
test (int l)
13
{
14
  return l || (thr != omp_get_thread_num () * 2);
15
}
16
 
17
int
18
main (void)
19
{
20
  int l = 0;
21
 
22
  omp_set_dynamic (0);
23
  omp_set_num_threads (6);
24
 
25
  thr = 8;
26
  /* Broadcast the value to all threads.  */
27
#pragma omp parallel copyin (thr)
28
  ;
29
 
30
#pragma omp parallel reduction (||:l)
31
  {
32
    /* Now test if the broadcast succeeded.  */
33
    l = thr != 8;
34
    thr = omp_get_thread_num () * 2;
35
#pragma omp barrier
36
    l = test (l);
37
  }
38
 
39
  if (l)
40
    abort ();
41
  return 0;
42
}

powered by: WebSVN 2.1.0

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