* Makefile.in (C_COMMON_OBJS): Depend on c-cilkplus.o.
[official-gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / PS / reduction-3.c
blob26822d633ffa4e8bd2b5e965a214db5346f5a4e3
1 /* { dg-do run } */
2 /* { dg-options "-O3 -fcilkplus" } */
4 /* FIXME: This test has been xfailed until reductions are fixed. */
6 #define N 256
7 #if HAVE_IO
8 #include <stdio.h>
9 #endif
10 #include <malloc.h>
12 int
13 reduction_simd (int *a)
15 int s = 0;
17 #pragma simd reduction (+:s)
18 for (int i = 0; i < N; i++)
20 s += a[i];
23 return s;
26 int
27 main ()
29 int *a = (int *) malloc (N * sizeof (int));
30 int i, s = (N - 1) * N / 2;
32 for (i = 0; i < N; i++)
34 a[i] = i;
36 #if HAVE_IO
37 printf ("%d, %d\n", s, reduction_simd (a));
38 #endif
39 if (s == reduction_simd (a))
40 return 0;
41 else
42 return 1;