Debian Codegraph @

gcc/testsuite/gcc.dg/vect/pr97558-2.c

raw
1 /* { dg-additional-options "-O3 -fno-tree-forwprop -fno-tree-scev-cprop" } */
2
3 #include "tree-vect.h"
4
5 #define N 40
6
7 int a[N];
8 int b[N];
9
10 __attribute__ ((noinline)) int
11 foo (int n){
12 int i,j;
13 int sum,x,y;
14
15 if (n<=0)
16 return 0;
17
18 for (i = 0; i < N/2; i++) {
19 sum = 0;
20 x = b[2*i];
21 y = b[2*i+1];
22 for (j = 0; j < n; j++) {
23 sum += j;
24 }
25 a[2*i] = sum + x;
26 a[2*i+1] = sum + y;
27 }
28 }
29
30 int main (void)
31 {
32 int i,j;
33 int sum;
34
35 check_vect ();
36
37 for (i=0; i<N; i++)
38 b[i] = i;
39
40 foo (N-1);
41
42 /* check results: */
43 #pragma GCC novector
44 for (i=0; i<N/2; i++)
45 {
46 sum = 0;
47 for (j = 0; j < N-1; j++)
48 sum += j;
49 if (a[2*i] != sum + b[2*i] || a[2*i+1] != sum + b[2*i+1])
50 abort();
51 }
52
53 return 0;
54 }