Debian Codegraph @

gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c

raw
1 /* { dg-additional-options "-fwrapv" } */
2 /* { dg-require-effective-target vect_int } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
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
11
12 __attribute__ ((noinline)) int
13 foo ()
14 {
15 int i;
16 signed short shortsum = 0;
17
18 /* widenning sum: sum chars into short. */
19
20 for (i = 0; i < N; i++)
21 {
22 shortsum += data_ch[i];
23 }
24
25 /* check results: */
26 if (shortsum != SUM)
27 abort ();
28
29 return 0;
30 }
31
32 int
33 main (void)
34 {
35 check_vect ();
36 return foo ();
37 }
38
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 } } } } */