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-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 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
  /* Not vectorizable yet (cross-iteration cycle).  */
30
  diff = 0;
31
  for (i = 0; i < N; i++) {
32
    diff += (cb[i] - cc[i]);
33
  }
34
  ibar (&diff);
35
 
36
 
37
  /* Not vectorizable yet (outer-loop: not attempted.
38
     inner-loop: cross iteration cycle; multi-dimensional arrays).  */
39
  diff = 0;
40
  for (i = 0; i < N; i++) {
41
    for (i = 0; i < N; i++) {
42
      diff += (image[i][j] - block[i][j]);
43
    }
44
  }
45
  ibar (&diff);
46
 
47
 
48
  /* Vectorizable.  */
49
  for (i = 0; i < N; i++){
50
    a[i] = b[i];
51
  }
52
  fbar (a);
53
 
54
 
55
  /* Vectorizable.  */
56
  for (i = 0; i < N; i++){
57
    a[i] = b[i] + c[i] + d[i];
58
  }
59
  fbar (a);
60
 
61
 
62
  /* Strided access. Vectorizable on platforms that support load of strided
63
     accesses (extract of even/odd vector elements).  */
64
  for (i = 0; i < N/2; i++){
65
    a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
66
    d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
67
  }
68
  fbar (a);
69
 
70
 
71
  /* Vectorizable.  */
72
  for (i = 0; i < N; i++){
73
    a[i] = b[i] + c[i];
74
    d[i] = b[i] + c[i];
75
    ia[i] = ib[i] + ic[i];
76
  }
77
  ibar (ia);
78
  fbar (a);
79
  fbar (d);
80
 
81
  /* Not vetorizable yet (too conservative dependence test).  */
82
  for (i = 0; i < N; i++){
83
    a[i] = b[i] + c[i];
84
    a[i+1] = b[i] + c[i];
85
  }
86
  fbar (a);
87
}
88
 
89
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_extract_even_odd_wide } } } */
90
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_extract_even_odd_wide } } } */
91
/* { 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.