| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fopenmp -std=c23" } */ |
| 3 |
|
| 4 |
void |
| 5 |
foo () |
| 6 |
{ |
| 7 |
int a[10] = {}; |
| 8 |
#pragma omp parallel sections |
| 9 |
{ |
| 10 |
#pragma omp section |
| 11 |
a[0]++; |
| 12 |
[[omp::directive (section)]] { |
| 13 |
a[1]++; |
| 14 |
} [[omp::directive (section)]] |
| 15 |
a[2]++; |
| 16 |
#pragma omp section |
| 17 |
{ a[3]++; } |
| 18 |
} |
| 19 |
[[omp::directive (parallel sections)]] |
| 20 |
{ |
| 21 |
#pragma omp section |
| 22 |
a[0]++; |
| 23 |
[[omp::directive (section)]] { |
| 24 |
a[1]++; |
| 25 |
} [[omp::directive (section)]] |
| 26 |
a[2]++; |
| 27 |
#pragma omp section |
| 28 |
{ a[3]++; } |
| 29 |
} |
| 30 |
#pragma omp parallel sections |
| 31 |
{ |
| 32 |
#pragma omp section |
| 33 |
a[0]++; |
| 34 |
a[4]++; |
| 35 |
l1: a[5]++; |
| 36 |
if (a[5] == 42) goto l1; |
| 37 |
[[omp::directive (section)]] { |
| 38 |
a[1]++; |
| 39 |
a[6]++; |
| 40 |
} [[omp::directive (section)]] |
| 41 |
a[2]++; |
| 42 |
a[7]++; |
| 43 |
#pragma omp section |
| 44 |
{ a[3]++; } |
| 45 |
a[8]++; |
| 46 |
} |
| 47 |
[[omp::directive (parallel sections)]] |
| 48 |
{ |
| 49 |
#pragma omp section |
| 50 |
a[0]++; |
| 51 |
a[4]++; |
| 52 |
[[omp::directive (section)]] { |
| 53 |
a[1]++; |
| 54 |
a[5]++; |
| 55 |
} [[omp::directive (section)]] |
| 56 |
a[2]++; |
| 57 |
l2: a[6]++; |
| 58 |
if (a[6] == 42) |
| 59 |
goto l2; |
| 60 |
a[7]++; |
| 61 |
#pragma omp section |
| 62 |
a[8]++; |
| 63 |
{ a[3]++; } |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
int |
| 68 |
bar (int a, int *c, int *d, int *e, int *f) |
| 69 |
{ |
| 70 |
int i; |
| 71 |
#pragma omp simd reduction (inscan, +: a) |
| 72 |
for (i = 0; i < 64; i++) |
| 73 |
{ |
| 74 |
d[i] = a; |
| 75 |
[[omp::directive (scan, exclusive (a))]] |
| 76 |
a += c[i]; |
| 77 |
} |
| 78 |
[[omp::directive (simd reduction (inscan, +: a))]] |
| 79 |
for (i = 0; i < 64; i++) |
| 80 |
{ |
| 81 |
a += c[i]; |
| 82 |
#pragma omp scan inclusive (a) |
| 83 |
d[i] = a; |
| 84 |
} |
| 85 |
#pragma omp simd reduction (inscan, +: a) |
| 86 |
for (i = 0; i < 64; i++) |
| 87 |
{ |
| 88 |
{ int t = a; |
| 89 |
d[i] = t; } |
| 90 |
[[omp::directive (scan, exclusive (a))]] |
| 91 |
{ int u = c[i]; |
| 92 |
a += u; } |
| 93 |
} |
| 94 |
[[omp::directive (simd reduction (inscan, +: a))]] |
| 95 |
for (i = 0; i < 64; i++) |
| 96 |
{ |
| 97 |
{ int t = c[i]; |
| 98 |
a += t; } |
| 99 |
#pragma omp scan inclusive (a) |
| 100 |
{ int u = a; |
| 101 |
d[i] = u; } |
| 102 |
} |
| 103 |
return a; |
| 104 |
} |