mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-29 12:50:35 +00:00
47 lines
737 B
C
47 lines
737 B
C
|
/* { 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;
|
||
|
}
|