* Makefile.in (C_COMMON_OBJS): Depend on c-cilkplus.o.
[official-gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / PS / reduction-2.c
blobf5554f6b1aea0fb16e21b8e6f6c2cd4159bbd894
1 /* { dg-do run } */
2 /* { dg-options "-O3 -fcilkplus" } */
4 /* FIXME: This test has been xfailed until reductions are fixed. */
6 #include <stdio.h>
8 #define ARRAY_SIZE (256)
9 int a[ARRAY_SIZE];
11 __attribute__((noinline))
12 int addit (int *arr, int N)
14 int s=0;
15 #pragma simd reduction (+:s)
16 for (int i = 0; i < N; i++)
17 s += arr[i];
18 return s;
21 int main () {
22 int i, s = 0, r = 0;
23 for (i = 0; i < ARRAY_SIZE; i++)
25 a[i] = i;
28 s = addit (a, ARRAY_SIZE);
30 for (i = 0; i < ARRAY_SIZE; i++)
31 r += i;
33 if (s == r)
34 return 0;
35 return 1;