Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-outer-5.c
blob05ed39a3da2bc5d30bc1961ad486d4c38e204fea
1 /* { dg-require-effective-target vect_float } */
2 /* { dg-add-options quad_vectors } */
4 #include <stdarg.h>
5 #include <signal.h>
6 #include "tree-vect.h"
8 #define N 64
9 #define MAX 42
11 extern void abort(void);
13 __attribute__ ((noinline))
14 int main1 ()
16 float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
17 float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
18 float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
19 float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
20 float E[4] = {0,480,960,1440};
21 float s;
23 int i, j;
25 for (i = 0; i < N; i++)
27 A[i] = i;
28 B[i] = i;
29 C[i] = i;
30 D[i] = i;
33 /* Outer-loop 1: Vectorizable with respect to dependence distance. */
34 for (i = 0; i < N-20; i++)
36 s = 0;
37 for (j=0; j<N; j+=4)
38 s += C[j];
39 A[i] = A[i+20] + s;
42 /* check results: */
43 for (i = 0; i < N-20; i++)
45 s = 0;
46 for (j=0; j<N; j+=4)
47 s += C[j];
48 if (A[i] != D[i+20] + s)
49 abort ();
52 /* Outer-loop 2: Not vectorizable because of dependence distance. */
53 for (i = 0; i < 4; i++)
55 s = 0;
56 for (j=0; j<N; j+=4)
57 s += C[j];
58 B[i+1] = B[i] + s;
61 /* check results: */
62 for (i = 0; i < 4; i++)
64 if (B[i] != E[i])
65 abort ();
68 return 0;
71 int main ()
73 check_vect ();
74 return main1();
77 /* NOTE: We temporarily xfail the following check until versioning for
78 aliasing is fixed to avoid versioning when the dependence distance
79 is known. */
80 /* { dg-final { scan-tree-dump-times "not vectorized: possible dependence between data-refs" 1 "vect" { xfail *-*-* } } } */
81 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
82 /* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" { xfail vect_no_align } } } */
83 /* { dg-final { cleanup-tree-dump "vect" } } */