| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#if VECTOR_BITS > 128 |
| 7 |
#define N (VECTOR_BITS * 2 / 16) |
| 8 |
#else |
| 9 |
#define N 16 |
| 10 |
#endif |
| 11 |
|
| 12 |
unsigned char udata_ch[N] = |
| 13 |
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 }; |
| 14 |
#define SUM 210 |
| 15 |
|
| 16 |
__attribute__ ((noinline)) int |
| 17 |
foo () |
| 18 |
{ |
| 19 |
int i; |
| 20 |
unsigned int intsum = 0; |
| 21 |
|
| 22 |
/* widenning sum: sum chars into int. */ |
| 23 |
for (i = 0; i < N; i++) |
| 24 |
{ |
| 25 |
intsum += udata_ch[i]; |
| 26 |
} |
| 27 |
|
| 28 |
/* check results: */ |
| 29 |
if (intsum != SUM) |
| 30 |
abort (); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
main (void) |
| 37 |
{ |
| 38 |
check_vect (); |
| 39 |
return foo (); |
| 40 |
} |
| 41 |
|
| 42 |
/* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect"} } */ |
| 43 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si || vect_unpack } } } } */ |
| 44 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */ |