Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / taskloop-reduction-3.c
blob30a832490465eaf3f941512d1ac72fbf394fad47
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-std=c99" { target c } } */
4 /* { dg-additional-options "-msse2" { target sse2_runtime } } */
5 /* { dg-additional-options "-mavx" { target avx_runtime } } */
7 #define N 1024
8 long int u[N], m, n;
10 __attribute__((noipa)) void
11 foo (void)
13 int i;
14 #pragma omp taskloop simd reduction (+:m) grainsize (64)
15 for (i = 0; i < N; ++i)
16 m += u[i];
19 __attribute__((noipa)) void
20 bar (int x)
22 #pragma omp taskloop simd in_reduction (+:n) grainsize (64) nogroup
23 for (int i = (x & 1) * (N / 2); i < (x & 1) * (N / 2) + (N / 2); i++)
24 n += 2 * u[i];
27 int
28 main ()
30 int i;
31 for (i = 0; i < N; ++i)
32 u[i] = i;
33 #pragma omp parallel master
35 foo ();
36 #pragma omp taskgroup task_reduction (+:n)
38 bar (0);
39 bar (1);
42 if (m != (long)(N - 1) * (N / 2) || n != (long)(N - 1) * N)
43 __builtin_abort ();
44 return 0;