IVOPT performance tuning patch. The main problem is a variant of maximal weight
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-fir-lb.c
blob3c1a362c003e741eeb686c1f84ca8d80797c860c
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 /* 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 j = k;
28 do {
29 diff += in[j+i]*coeff[j];
30 j+=4;
31 } while (j < M);
33 out[i] += diff;
39 /* Vectorized. Changing misalignment in the inner-loop. */
40 __attribute__ ((noinline))
41 void fir (){
42 int i,j,k;
43 float diff;
45 for (i = 0; i < N; i++) {
46 diff = 0;
47 for (j = 0; j < M; j++) {
48 diff += in[j+i]*coeff[j];
50 fir_out[i] = diff;
55 int main (void)
57 check_vect ();
58 int i, j;
59 float diff;
61 for (i = 0; i < M; i++)
62 coeff[i] = i;
63 for (i = 0; i < N+M; i++)
64 in[i] = i;
66 foo ();
67 fir ();
69 for (i = 0; i < N; i++) {
70 if (out[i] != fir_out[i])
71 abort ();
74 return 0;
77 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail vect_no_align } } } */
78 /* { dg-final { cleanup-tree-dump "vect" } } */