Debian Codegraph @

gcc/testsuite/gcc.dg/vect/no-scevccp-noreassoc-outer-4.c

raw
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 40
7
8 __attribute__ ((noinline)) int
9 foo (){
10 int i,j;
11 int sum,s=0;
12
13 for (i = 0; i < 200*N; i++) {
14 sum = 0;
15 for (j = 0; j < N; j++) {
16 sum += (i + j);
17 i++;
18 }
19 s += sum;
20 }
21 return s;
22 }
23
24 __attribute__ ((noinline))
25 int bar (int i, int j)
26 {
27 return (i + j);
28 }
29
30 int main (void)
31 {
32 int i,j,k=0;
33 int sum,s=0;
34 int res;
35
36 check_vect ();
37
38 res = foo ();
39
40 /* check results: */
41 for (i=0; i<200*N; i++)
42 {
43 sum = 0;
44 for (j = 0; j < N; j++){
45 sum += bar (i, j);
46 i++;
47 }
48 s += sum;
49 }
50 if (res != s)
51 abort ();
52
53 return 0;
54 }
55
56 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" } } */