2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-pattern-1a.c
blobb06b234072b84b04182d52f1470f6568c71598dd
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #if VECTOR_BITS > 128
7 #define N (VECTOR_BITS * 2 / 16)
8 #else
9 #define N 16
10 #endif
12 unsigned short udata_sh[N] =
13 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
14 #define SUM 210
16 __attribute__ ((noinline)) int
17 foo ()
19 int i;
20 unsigned int intsum = 0;
22 /* widenning sum: sum shorts into int. */
23 for (i = 0; i < N; i++)
25 intsum += udata_sh[i];
28 /* check results: */
29 if (intsum != SUM)
30 abort ();
32 return 0;
35 int
36 main (void)
38 check_vect ();
39 return foo ();
42 /* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
43 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_hi_to_si } } } */
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_hi_to_si } } } } */