| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 16 |
| 7 |
signed char data_ch[N] = |
| 8 |
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 }; |
| 9 |
#define SUM 210 |
| 10 |
|
| 11 |
__attribute__ ((noinline)) int |
| 12 |
foo () |
| 13 |
{ |
| 14 |
int i; |
| 15 |
signed short shortsum = 0; |
| 16 |
|
| 17 |
/* widenning sum: sum chars into short. |
| 18 |
The widening-summation pattern is currently not detected because of this |
| 19 |
patch: |
| 20 |
|
| 21 |
2005-12-26 Kazu Hirata <[email protected]> |
| 22 |
|
| 23 |
PR tree-optimization/25125 |
| 24 |
|
| 25 |
but we still handle the reduction. |
| 26 |
*/ |
| 27 |
|
| 28 |
for (i = 0; i < N; i++) |
| 29 |
{ |
| 30 |
shortsum += data_ch[i]; |
| 31 |
} |
| 32 |
|
| 33 |
/* check results: */ |
| 34 |
if (shortsum != SUM) |
| 35 |
abort (); |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |
| 39 |
|
| 40 |
int |
| 41 |
main (void) |
| 42 |
{ |
| 43 |
check_vect (); |
| 44 |
return foo (); |
| 45 |
} |
| 46 |
|
| 47 |
/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" { xfail *-*-* } } } */ |
| 48 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_hi } } } } */ |