Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-vfa-02.c

raw
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 int resultY[N] = {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
8 int resultZ[N] = {13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
9 int X[N] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
10 int Y[N] = {};
11 int Z[N] = {};
12
13 __attribute__ ((noinline)) void
14 foo (int *in, int *out1, int *out2)
15 {
16 int i;
17
18 for (i = 0; i < N; i++)
19 {
20 out1[i] = in[i] + 2;
21 out2[i] = in[i] + 3;
22 }
23 }
24
25 int
26 main (void)
27 {
28 int i;
29
30 check_vect ();
31
32 foo (X, Y, Z);
33
34 /* check results: */
35 #pragma GCC novector
36 for (i = 0; i < N; i++)
37 {
38 if (Y[i] != resultY[i])
39 abort ();
40
41 if (Z[i] != resultZ[i])
42 abort ();
43 }
44 return 0;
45 }
46
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */