cfgexpand: Expand comment on when non-var clobbers can show up
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-vfa-vect-43.c
blob6b4542f5948bc32ca736ad92328a0fd37e44334c
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 256
8 __attribute__ ((noinline))
9 void bar (float *pa, float *pb, float *pc)
11 int i;
13 /* check results: */
14 #pragma GCC novector
15 for (i = 0; i < N; i++)
17 if (pa[i] != (pb[i] * pc[i]))
18 abort ();
21 return;
25 __attribute__ ((noinline)) int
26 main1 (float *pa, float *pb, float *pc)
28 int i;
29 float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
30 float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
32 for (i = 0; i < N; i++)
34 b[i] = pb[i];
35 c[i] = pc[i];
38 /* Vectorizable: pa may not alias pb and/or pc, even though their
39 addresses escape. &pa would need to escape to point to escaped memory. */
40 for (i = 0; i < N; i++)
42 pa[i] = b[i] * c[i];
45 bar (pa,b,c);
47 return 0;
50 __attribute__ ((noinline)) int
51 main2 (float *pa, float *pb, float *pc)
53 int i;
54 float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
55 float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
57 for (i = 0; i < N; i++)
59 b[i] = pb[i];
60 c[i] = pc[i];
63 /* Vectorizable: pb and pc addresses do not escape. */
64 for (i = 0; i < N; i++)
66 pa[i] = b[i] * c[i];
69 /* check results: */
70 #pragma GCC novector
71 for (i = 0; i < N; i++)
73 if (pa[i] != (b[i] * c[i]))
74 abort ();
77 return 0;
80 int main (void)
82 int i;
83 float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
84 float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
85 float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
87 check_vect ();
89 main1 (a,b,c);
90 main2 (a,b,c);
91 return 0;
94 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" } } */
95 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */