2010-06-16 Mikael Pettersson <mikpe@it.uu.se>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-pattern-1c.c
blob872e6e82e5b70c1f1b5f2b1f1e9e5488e12415ce
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
7 unsigned char udata_ch[N] =
8 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
9 #define SUM 210
11 __attribute__ ((noinline)) int
12 foo ()
14 int i;
15 unsigned short shortsum = 0;
17 /* widenning sum: sum chars into short. */
18 for (i = 0; i < N; i++)
20 shortsum += udata_ch[i];
23 /* check results: */
24 if (shortsum != SUM)
25 abort ();
27 return 0;
30 int
31 main (void)
33 check_vect ();
34 return foo ();
37 /* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
38 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_hi } } } */
39 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */
40 /* { dg-final { cleanup-tree-dump "vect" } } */