aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
blob: db38b30b5f3124b7b0f27d6b944d07a969e21294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { dg-do run } */
/* { dg-options "-fcilkplus" } */

const int n = 8;
float x[8], y[8], z[8];
int main() {
    int i = 0;
    float x_sum =0;
    for(i=1; i<=5; i+=4 ) {
        x[0:n] = 3;
        y[0:n] = i;
        z[0:n] = 0;
        (void)((__sec_reduce_add(x[0:n])==3*n) || (__builtin_abort (), 0));
        (void)((__sec_reduce_add(y[0:n])==i*n) || (__builtin_abort (), 0));
        (void)((__sec_reduce_add(z[0:n])==0) || (__builtin_abort (), 0));

        if (x[0:n] >= y[0:n]) {
            z[0:n] = x[0:n] - y[0:n];
        } else {
            z[0:n] = x[0:n] + y[0:n];
        }
        (void)((__sec_reduce_add(x[0:n])==3*n) || (__builtin_abort (), 0));
        (void)((__sec_reduce_add(y[0:n])==i*n) || (__builtin_abort (), 0));
        (void)((__sec_reduce_add(z[0:n])==(3>=i?3-i:3+i)*n) 
	       || (__builtin_abort (), 0));
    }
    return 0;
}