libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-pattern-2a.c
blobf362a055004d3cac16b56edbe2b171e1e5ba9e2f
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #if VECTOR_BITS > 128
9 #define N (VECTOR_BITS * 2 / 16)
10 #else
11 #define N 16
12 #endif
14 signed short data_sh[N] =
15 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
16 #define SUM 210
18 __attribute__ ((noinline)) int
19 foo ()
21 int i;
22 signed int intsum = 0;
24 /* widenning sum: sum shorts into int. */
25 for (i = 0; i < N; i++)
27 intsum += data_sh[i];
30 /* check results: */
31 if (intsum != SUM)
32 abort ();
34 return 0;
37 int
38 main (void)
40 check_vect ();
41 return foo ();
44 /* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target vect_widen_sum_hi_to_si } } } */
45 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_hi_to_si } } } */
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_hi_to_si } } } } */