Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-outer-6.c

raw
1 /* { dg-require-effective-target vect_float } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 64
7 #define MAX 42
8
9 float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12 float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 extern void abort(void);
14
15 __attribute__ ((noinline))
16 int main1 ()
17 {
18 float s;
19
20 int i, j;
21
22 for (i = 0; i < N; i++)
23 {
24 s = 0;
25 for (j = 0; j < N; j += 4)
26 s += C[j];
27 A[i] = s;
28 }
29
30 return 0;
31 }
32
33 int main ()
34 {
35 int i,j;
36 float s;
37
38 check_vect ();
39
40 for (i = 0; i < N; i++)
41 {
42 A[i] = i;
43 B[i] = i;
44 C[i] = i;
45 D[i] = i;
46 }
47
48 main1();
49
50 /* check results: */
51 #pragma GCC novector
52 for (i = 0; i < N; i++)
53 {
54 s = 0;
55 for (j = 0; j < N; j += 4)
56 s += C[j];
57 if (A[i] != s)
58 abort ();
59 }
60
61 return 0;
62 }
63
64 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
65 /* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */