]>
Commit | Line | Data |
---|---|---|
3c6d4197 | 1 | /* { dg-do run } */ |
bc24d01d | 2 | /* { dg-options "-fcilkplus -fdump-tree-original" } */ |
3c6d4197 | 3 | |
4 | #if HAVE_IO | |
5 | #include <stdio.h> | |
6 | #endif | |
7 | #include <assert.h> | |
8 | ||
9 | const int n = 8; | |
10 | ||
11 | float x[8], y[8], z[8]; | |
12 | ||
13 | int main() { | |
14 | int i = 0; | |
15 | float x_sum =0; | |
16 | for(i=1; i<=5; i+=4 ) { | |
17 | x[0:n] = 3; | |
18 | y[0:n] = i; | |
19 | z[0:n] = 0; | |
20 | #if HAVE_IO | |
21 | printf("x\ty\tz\n"); | |
22 | for( size_t k=0; k<n; ++k ) { | |
23 | printf("%g\t%g\t%g\n",x[k],y[k],z[k]); | |
24 | } | |
25 | x_sum = __sec_reduce_add (x[0:n]); | |
26 | printf("sec_reduce_add (x[0:n]) = %6.3f\n", x_sum); | |
27 | #endif | |
28 | assert( __sec_reduce_add(x[0:n])==3*n ); | |
29 | assert( __sec_reduce_add(y[0:n])==i*n ); | |
30 | assert( __sec_reduce_add(z[0:n])==0 ); | |
31 | ||
32 | if (x[0:n] >= y[0:n]) { | |
33 | z[0:n] = x[0:n] - y[0:n]; | |
34 | } else { | |
35 | z[0:n] = x[0:n] + y[0:n]; | |
36 | } | |
37 | #if HAVE_IO | |
38 | printf("x\ty\tz\n"); | |
39 | for( size_t k=0; k<n; ++k ) { | |
40 | printf("%g\t%g\t%g\n",x[k],y[k],z[k]); | |
41 | } | |
42 | #endif | |
43 | assert( __sec_reduce_add(x[0:n])==3*n ); | |
44 | assert( __sec_reduce_add(y[0:n])==i*n ); | |
45 | assert( __sec_reduce_add(z[0:n])==(3>=i?3-i:3+i)*n ); | |
46 | } | |
47 | return 0; | |
48 | } | |
bc24d01d | 49 | |
50 | /* The C++ FE once emitted a bogus error_mark_node for this test case. */ | |
51 | /* { dg-final { scan-tree-dump-not "<<< error >>>" "original" } } */ |