Debian Codegraph @

gcc/testsuite/gcc.dg/vect/no-scevccp-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 int a[N];
9
10 /* induction variable k advances through inner and outer loops. */
11
12 __attribute__ ((noinline)) int
13 foo (int n){
14 int i,j,k=0;
15 int sum;
16
17 if (n<=0)
18 return 0;
19
20 for (i = 0; i < N; i++) {
21 sum = 0;
22 for (j = 0; j < n; j+=2) {
23 sum += k++;
24 }
25 a[i] = sum + j;
26 }
27 }
28
29 int main (void)
30 {
31 int i,j,k=0;
32 int sum;
33
34 check_vect ();
35
36 for (i=0; i<N; i++)
37 a[i] = i;
38
39 foo (N);
40
41 /* check results: */
42 #pragma GCC novector
43 for (i=0; i<N; i++)
44 {
45 sum = 0;
46 for (j = 0; j < N; j+=2)
47 sum += k++;
48 if (a[i] != sum + j)
49 abort();
50 }
51
52 return 0;
53 }
54
55 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail *-*-* } } } */