Merge from mainline
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-pattern-2c.c
blob7444ac737e521fdefb8456d836d035b4bff986c3
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
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
11 int
12 foo ()
14 int i;
15 signed short shortsum = 0;
17 /* widenning sum: sum chars into short.
18 The widening-summation pattern is currently not detected because of this
19 patch:
21 2005-12-26 Kazu Hirata <kazu@codesourcery.com>
23 PR tree-optimization/25125
26 for (i = 0; i < N; i++)
28 shortsum += data_ch[i];
31 /* check results: */
32 if (shortsum != SUM)
33 abort ();
35 return 0;
38 int
39 main (void)
41 check_vect ();
42 return foo ();
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 /* { dg-final { cleanup-tree-dump "vect" } } */