PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-fir-big-array.c
blob6299e9fed4233b3ec2c0b9892afdca42edf0bee0
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 80
7 #define M 256
8 float in[N+M];
9 float coeff[M];
10 float out[N];
11 float fir_out[N];
13 /* Should be vectorized. Fixed misaligment in the inner-loop. */
14 __attribute__ ((noinline))
15 void foo (){
16 int i,j,k;
17 float diff;
19 for (i = 0; i < N; i++) {
20 out[i] = 0;
23 for (k = 0; k < 4; k++) {
24 for (i = 0; i < N; i++) {
25 diff = 0;
26 for (j = k; j < M; j+=4) {
27 diff += in[j+i]*coeff[j];
29 out[i] += diff;
35 /* Vectorized. Changing misalignment in the inner-loop. */
36 __attribute__ ((noinline))
37 void fir (){
38 int i,j,k;
39 float diff;
41 for (i = 0; i < N; i++) {
42 diff = 0;
43 for (j = 0; j < M; j++) {
44 diff += in[j+i]*coeff[j];
46 fir_out[i] = diff;
51 int main (void)
53 check_vect ();
54 int i, j;
55 float diff;
57 for (i = 0; i < M; i++)
58 coeff[i] = i;
59 for (i = 0; i < N+M; i++)
60 in[i] = i;
62 foo ();
63 fir ();
65 for (i = 0; i < N; i++) {
66 if (out[i] != fir_out[i])
67 abort ();
70 return 0;
73 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */