1 /* { dg-do run } */
2 /* { dg-options "-O3 -fcilkplus" } */
3 
4 #define N 256
5 #if HAVE_IO
6 #include <stdio.h>
7 #endif
8 #include <stdlib.h>
9 
10 int
reduction_simd(int * a)11 reduction_simd (int *a)
12 {
13   int s = 0;
14 
15 #pragma simd reduction (+:s)
16   for (int i = 0; i < N; i++)
17     {
18       s += a[i];
19     }
20 
21   return s;
22 }
23 
24 int
main()25 main ()
26 {
27   int *a = (int *) malloc (N * sizeof (int));
28   int i, s = (N - 1) * N / 2;
29 
30   for (i = 0; i < N; i++)
31     {
32       a[i] = i;
33     }
34 #if HAVE_IO
35   printf ("%d, %d\n", s, reduction_simd (a));
36 #endif
37   if (s == reduction_simd (a))
38     return 0;
39   else
40     return 1;
41 }
42