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.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 128
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 we get too many BBs in the inner-loop,
15
   because the compiler doesn't realize that the inner-loop executes at
16
   least once (cause k<4), and so there's no need to create a guard code
17
   to skip the inner-loop in case it doesn't execute.  */
18
__attribute__ ((noinline))
19
void foo (){
20
 int i,j,k;
21
 float diff;
22
 
23
 for (i = 0; i < N; i++) {
24
  out[i] = 0;
25
 }
26
 
27
 for (k = 0; k < 4; k++) {
28
  for (i = 0; i < N; i++) {
29
    diff = 0;
30
    for (j = k; j < M; j+=4) {
31
      diff += in[j+i]*coeff[j];
32
    }
33
    out[i] += diff;
34
  }
35
 }
36
 
37
}
38
 
39
/* Vectorized. Changing misalignment in the inner-loop.  */
40
__attribute__ ((noinline))
41
void fir (){
42
  int i,j,k;
43
  float diff;
44
 
45
  for (i = 0; i < N; i++) {
46
    diff = 0;
47
    for (j = 0; j < M; j++) {
48
      diff += in[j+i]*coeff[j];
49
    }
50
    fir_out[i] = diff;
51
  }
52
}
53
 
54
 
55
int main (void)
56
{
57
  check_vect ();
58
  int i, j;
59
  float diff;
60
 
61
  for (i = 0; i < M; i++)
62
    coeff[i] = i;
63
  for (i = 0; i < N+M; i++)
64
    in[i] = i;
65
 
66
  foo ();
67
  fir ();
68
 
69
  for (i = 0; i < N; i++) {
70
    if (out[i] != fir_out[i])
71
      abort ();
72
  }
73
 
74
  return 0;
75
}
76
 
77
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail *-*-* } } } */
78
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
79
/* { 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.