Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-fir-lb.c
blobbdc07f9af76b508e33c817592fc171392a6572be
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 40
7 #define M 64
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 /* Currently not vectorized because the loop-count for the inner-loop
15 has a maybe_zero component. Will be fixed when we incorporate the
16 "cond_expr in rhs" patch. */
17 __attribute__ ((noinline))
18 void foo (){
19 int i,j,k;
20 float diff;
22 for (i = 0; i < N; i++) {
23 out[i] = 0;
26 for (k = 0; k < 4; k++) {
27 for (i = 0; i < N; i++) {
28 diff = 0;
29 j = k;
31 do {
32 diff += in[j+i]*coeff[j];
33 j+=4;
34 } while (j < M);
36 out[i] += diff;
42 /* Vectorized. Changing misalignment in the inner-loop. */
43 __attribute__ ((noinline))
44 void fir (){
45 int i,j,k;
46 float diff;
48 for (i = 0; i < N; i++) {
49 diff = 0;
50 for (j = 0; j < M; j++) {
51 diff += in[j+i]*coeff[j];
53 fir_out[i] = diff;
58 int main (void)
60 check_vect ();
61 int i, j;
62 float diff;
64 for (i = 0; i < M; i++)
65 coeff[i] = i;
66 for (i = 0; i < N+M; i++)
67 in[i] = i;
69 foo ();
70 fir ();
72 for (i = 0; i < N; i++) {
73 if (out[i] != fir_out[i])
74 abort ();
77 return 0;
80 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail *-*-* } } } */
81 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
82 /* { dg-final { cleanup-tree-dump "vect" } } */