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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-require-effective-target vect_int } */
3
/* { dg-require-effective-target vect_float } */
4
 
5
#define N 16
6
 
7
void fbar (float *);
8
void ibar (int *);
9
void sbar (short *);
10
 
11
/* multiple loops */
12
 
13
foo (int n)
14
{
15
  float a[N+1];
16
  float b[N];
17
  float c[N];
18
  float d[N];
19
  int ia[N];
20
  int ib[N];
21
  int ic[N];
22
  int i,j;
23
  int diff = 0;
24
  char cb[N];
25
  char cc[N];
26
  char image[N][N];
27
  char block[N][N];
28
 
29
  /* Vectorizable.  */
30
  diff = 0;
31
  for (i = 0; i < N; i++) {
32
    diff += (cb[i] - cc[i]);
33
  }
34
  ibar (&diff);
35
 
36
 
37
  /* Vectorizable.  */
38
  diff = 0;
39
  for (i = 0; i < N; i++) {
40
    for (j = 0; j < N; j++) {
41
      diff += (image[i][j] - block[i][j]);
42
    }
43
  }
44
  ibar (&diff);
45
 
46
 
47
  /* Vectorizable.  */
48
  for (i = 0; i < N; i++){
49
    a[i] = b[i];
50
  }
51
  fbar (a);
52
 
53
 
54
  /* Vectorizable.  */
55
  for (i = 0; i < N; i++){
56
    a[i] = b[i] + c[i] + d[i];
57
  }
58
  fbar (a);
59
 
60
 
61
  /* Strided access. Vectorizable on platforms that support load of strided
62
     accesses (extract of even/odd vector elements).  */
63
  for (i = 0; i < N/2; i++){
64
    a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
65
    d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
66
  }
67
  fbar (a);
68
 
69
 
70
  /* Vectorizable.  */
71
  for (i = 0; i < N; i++){
72
    a[i] = b[i] + c[i];
73
    d[i] = b[i] + c[i];
74
    ia[i] = ib[i] + ic[i];
75
  }
76
  ibar (ia);
77
  fbar (a);
78
  fbar (d);
79
 
80
  /* Not vetorizable yet (too conservative dependence test).  */
81
  for (i = 0; i < N; i++){
82
    a[i] = b[i] + c[i];
83
    a[i+1] = b[i] + c[i];
84
  }
85
  fbar (a);
86
}
87
 
88
/* { dg-final { scan-tree-dump-times "vectorized 6 loops" 1 "vect" { target vect_strided2 } } } */
89
/* { dg-final { scan-tree-dump-times "vectorized 5 loops" 1 "vect" { xfail vect_strided2 } } } */
90
/* { 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.