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-4.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
 
12
/* Outer-loop vectorization.  */
13
 
14
__attribute__ ((noinline)) void
15
foo (){
16
  int i,j;
17
  float diff;
18
 
19
  for (i = 0; i < N; i++) {
20
    diff = 0;
21
    for (j = 0; j < M; j+=4) {
22
      diff += in[j+i]*coeff[j];
23
    }
24
    out[i]=diff;
25
  }
26
}
27
 
28
int main (void)
29
{
30
  check_vect ();
31
  int i, j;
32
  float diff;
33
 
34
  for (i = 0; i < M; i++)
35
    coeff[i] = i;
36
  for (i = 0; i < N+M; i++)
37
    in[i] = i;
38
 
39
  foo ();
40
 
41
  for (i = 0; i < N; i++) {
42
    diff = 0;
43
    for (j = 0; j < M; j+=4) {
44
      diff += in[j+i]*coeff[j];
45
    }
46
    if (out[i] != diff)
47
      abort ();
48
  }
49
 
50
  return 0;
51
}
52
 
53
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
54
/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
55
/* { 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.