Retro68/gcc/libgomp/testsuite/libgomp.c/taskloop-1.c

47 lines
737 B
C
Raw Normal View History

2017-04-10 11:32:00 +00:00
/* { dg-do run } */
/* { dg-options "-O2 -fopenmp -std=c99" } */
int q, r, e;
__attribute__((noinline, noclone)) void
foo (long a, long b)
{
#pragma omp taskloop lastprivate (q) nogroup
for (long d = a; d < b; d += 2)
{
q = d;
if (d < 2 || d > 6 || (d & 1))
#pragma omp atomic
e |= 1;
}
}
__attribute__((noinline, noclone)) int
bar (int a, int b)
{
int q = 7;
#pragma omp taskloop lastprivate (q)
for (int d = a; d < b; d++)
{
if (d < 12 || d > 17)
#pragma omp atomic
e |= 1;
q = d;
}
return q;
}
int
main ()
{
#pragma omp parallel
#pragma omp single
{
foo (2, 7);
r = bar (12, 18);
}
if (q != 6 || r != 17 || e)
__builtin_abort ();
return 0;
}