PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-5.c
blob2d37d6d148e2faa70f771e5e1250d5702dbac862
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include <signal.h>
5 #include "tree-vect.h"
7 #define N 64
8 #define MAX 42
10 extern void abort(void);
12 __attribute__ ((noinline))
13 int main1 ()
15 float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
16 float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
17 float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
18 float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
19 float E[4] = {0,480,960,1440};
20 float s;
22 int i, j;
24 for (i = 0; i < N; i++)
26 A[i] = i;
27 B[i] = i;
28 C[i] = i;
29 D[i] = i;
32 /* Outer-loop 1: Vectorizable with respect to dependence distance. */
33 for (i = 0; i < N-20; i++)
35 s = 0;
36 for (j=0; j<N; j+=4)
37 s += C[j];
38 A[i] = A[i+20] + s;
41 /* check results: */
42 for (i = 0; i < N-20; i++)
44 s = 0;
45 for (j=0; j<N; j+=4)
46 s += C[j];
47 if (A[i] != D[i+20] + s)
48 abort ();
51 /* Outer-loop 2: Not vectorizable because of dependence distance. */
52 for (i = 0; i < 4; i++)
54 s = 0;
55 for (j=0; j<N; j+=4)
56 s += C[j];
57 B[i+1] = B[i] + s;
60 /* check results: */
61 for (i = 0; i < 4; i++)
63 if (B[i] != E[i])
64 abort ();
67 return 0;
70 int main ()
72 check_vect ();
73 return main1();
76 /* NOTE: We temporarily xfail the following check until versioning for
77 aliasing is fixed to avoid versioning when the dependence distance
78 is known. */
79 /* { dg-final { scan-tree-dump-times "not vectorized: possible dependence between data-refs" 1 "vect" { xfail *-*-* } } } */
80 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
81 /* { dg-final { scan-tree-dump "zero step in outer loop." "vect" { xfail vect_no_align } } } */
82 /* { dg-final { cleanup-tree-dump "vect" } } */