Debian Codegraph @

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