openmp: Add testcases for omp_max_vf
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / wrapv-vect-reduc-pattern-2c.c
blobbe0447c7b1038378a96e0549939d8ed3f030999a
1 /* { dg-additional-options "-fwrapv" } */
2 /* { dg-require-effective-target vect_int } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 16
8 signed char data_ch[N] =
9 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
10 #define SUM 210
12 __attribute__ ((noinline)) int
13 foo ()
15 int i;
16 signed short shortsum = 0;
18 /* widenning sum: sum chars into short. */
20 for (i = 0; i < N; i++)
22 shortsum += data_ch[i];
25 /* check results: */
26 if (shortsum != SUM)
27 abort ();
29 return 0;
32 int
33 main (void)
35 check_vect ();
36 return foo ();
39 /* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect" } } */
40 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_hi } } } */
41 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */