PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-vfa-vect-dv-2.c
blob4513c40b34fdddcb2ff92caa65fa7323d14d6d3b
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
7 #define MAX 42
9 extern void abort(void);
11 int main ()
13 int A[N];
14 int B[N];
15 int C[N];
16 int D[N];
17 int E[N] = {0,1,2,0};
19 int i, j;
21 check_vect ();
23 for (i = 0; i < N; i++)
25 A[i] = i;
26 B[i] = i;
27 C[i] = i;
28 D[i] = i;
31 /* Vectorizable */
32 for (i = 0; i < N-20; i++)
34 A[i] = A[i+20];
37 /* check results: */
38 for (i = 0; i < N-20; i++)
40 if (A[i] != D[i+20])
41 abort ();
44 /* Vectorizable */
45 for (i = 0; i < 16; i++)
47 B[i] = B[i] + 5;
50 /* check results: */
51 for (i = 0; i < 16; i++)
53 if (B[i] != C[i] + 5)
54 abort ();
57 /* Not vectorizable */
58 for (i = 0; i < 4; i++)
60 C[i+3] = C[i];
63 /* check results: */
64 for (i = 0; i < 4; i++)
66 if (C[i] != E[i])
67 abort ();
70 return 0;
74 /* The initialization induction loop (with aligned access) is also vectorized. */
75 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
76 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
77 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */