SVE Intrinsics: Change return type of redirect_call to gcall.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-5.c
blob67be075278847ea09e309c5d2ae2b4cf8c51b736
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
7 #define MAX 42
9 extern void abort(void);
11 __attribute__ ((noinline))
12 int main1 ()
14 float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
15 float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
16 float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
17 float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
18 float E[4] = {0,480,960,1440};
19 float s;
21 int i, j;
23 for (i = 0; i < N; i++)
25 A[i] = i;
26 B[i] = i;
27 C[i] = i;
28 D[i] = i;
31 /* Outer-loop 1: Vectorizable with respect to dependence distance. */
32 for (i = 0; i < N-20; i++)
34 s = 0;
35 for (j=0; j<N; j+=4)
36 s += C[j];
37 A[i] = A[i+20] + s;
40 /* check results: */
41 #pragma GCC novector
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 #pragma GCC novector
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 "zero step in outer loop." "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */