OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-outer-fir-lb.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_float } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
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];
12
 
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;
21
 
22
 for (i = 0; i < N; i++) {
23
  out[i] = 0;
24
 }
25
 
26
 for (k = 0; k < 4; k++) {
27
  for (i = 0; i < N; i++) {
28
    diff = 0;
29
    j = k;
30
 
31
    do {
32
      diff += in[j+i]*coeff[j];
33
      j+=4;
34
    } while (j < M);
35
 
36
    out[i] += diff;
37
  }
38
 }
39
 
40
}
41
 
42
/* Vectorized. Changing misalignment in the inner-loop.  */
43
__attribute__ ((noinline))
44
void fir (){
45
  int i,j,k;
46
  float diff;
47
 
48
  for (i = 0; i < N; i++) {
49
    diff = 0;
50
    for (j = 0; j < M; j++) {
51
      diff += in[j+i]*coeff[j];
52
    }
53
    fir_out[i] = diff;
54
  }
55
}
56
 
57
 
58
int main (void)
59
{
60
  check_vect ();
61
  int i, j;
62
  float diff;
63
 
64
  for (i = 0; i < M; i++)
65
    coeff[i] = i;
66
  for (i = 0; i < N+M; i++)
67
    in[i] = i;
68
 
69
  foo ();
70
  fir ();
71
 
72
  for (i = 0; i < N; i++) {
73
    if (out[i] != fir_out[i])
74
      abort ();
75
  }
76
 
77
  return 0;
78
}
79
 
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" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.