]>
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 | int argc = 1; | |
7 | ||
8 | /* This is a simple vectorization test. It tests if reduction works | |
9 | and if it can vectorize the loop in func correctly. */ | |
10 | #define N 1000 | |
11 | ||
12 | int func (int *p, int *q) { | |
13 | int x = 0; | |
14 | #pragma simd reduction (+:x) | |
15 | for (int ii = 0; ii < N; ii++) { | |
16 | x += (q[ii] + p[ii]); | |
17 | } | |
18 | return x; | |
19 | ||
20 | } | |
21 | ||
22 | int main () | |
23 | { | |
24 | int ii = 0, x; | |
25 | int Array[N], Array2[N]; | |
26 | ||
27 | for (ii = 0; ii < N; ii++) | |
28 | { | |
29 | Array[ii] = 5 + argc; | |
30 | Array2[ii] = argc; | |
31 | } | |
32 | x = func (Array, Array2); | |
33 | ||
34 | if (x != N * 7) | |
35 | return 1; | |
36 | return 0; | |
37 | } | |
38 |