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
foo()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  <kazu@codesourcery.com>
22 
23         PR tree-optimization/25125
24    */
25 
26   for (i = 0; i < N; i++)
27     {
28       shortsum += data_ch[i];
29     }
30 
31   /* check results:  */
32   if (shortsum != SUM)
33     abort ();
34 
35   return 0;
36 }
37 
38 int
main(void)39 main (void)
40 {
41   check_vect ();
42   return foo ();
43 }
44 
45 /* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" { xfail *-*-* } } } */
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */
48