aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/lastprivate-conditional-5.c
blob: 51f6b30ffecd3fd49221680865b953a0b21b998b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* { dg-do compile } */
/* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */
/* { dg-final { scan-tree-dump-times "GOMP_loop_start " 3 "ompexp" } } */
/* { dg-final { scan-tree-dump-times "GOMP_loop_end_nowait " 3 "ompexp" } } */

int r;

void
foo (int *a)
{
  #pragma omp for nowait lastprivate(conditional: r)
  for (int i = 0; i < 64; ++i)
    if (a[i])
      r = a[i];
}

void
bar (int *a)
{
  #pragma omp for nowait lastprivate(conditional: r) schedule (static, 4)
  for (int i = 0; i < 64; ++i)
    if (a[i])
      r = a[i];
}

void
baz (int *a)
{
  #pragma omp for nowait lastprivate(conditional: r) schedule (runtime)
  for (int i = 0; i < 64; ++i)
    if (a[i])
      r = a[i];
}