]>
Commit | Line | Data |
---|---|---|
c02065fc AH |
1 | /* { dg-do run } */ |
2 | /* { dg-options "-O3 -fcilkplus" } */ | |
3 | ||
4 | /* FIXME: This test has been xfailed until reductions are fixed. */ | |
5 | ||
6 | #include <stdio.h> | |
7 | ||
8 | #define ARRAY_SIZE (256) | |
9 | int a[ARRAY_SIZE]; | |
10 | ||
11 | __attribute__((noinline)) | |
12 | int addit (int *arr, int N) | |
13 | { | |
14 | int s=0; | |
15 | #pragma simd reduction (+:s) | |
16 | for (int i = 0; i < N; i++) | |
17 | s += arr[i]; | |
18 | return s; | |
19 | } | |
20 | ||
21 | int main () { | |
22 | int i, s = 0, r = 0; | |
23 | for (i = 0; i < ARRAY_SIZE; i++) | |
24 | { | |
25 | a[i] = i; | |
26 | } | |
27 | ||
28 | s = addit (a, ARRAY_SIZE); | |
29 | ||
30 | for (i = 0; i < ARRAY_SIZE; i++) | |
31 | r += i; | |
32 | ||
33 | if (s == r) | |
34 | return 0; | |
35 | return 1; | |
36 | } |