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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-1.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* { 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
  short sa[N];
23
  short sb[N];
24
  short sc[N];
25
  int i,j;
26
  int diff = 0;
27
  char cb[N];
28
  char cc[N];
29
  char image[N][N];
30
  char block[N][N];
31
 
32
  /* Not vectorizable yet (cross-iteration cycle).  */
33
  diff = 0;
34
  for (i = 0; i < N; i++) {
35
    diff += (cb[i] - cc[i]);
36
  }
37
  ibar (&diff);
38
 
39
 
40
  /* Not vectorizable yet (outer-loop: not attempted.
41
     inner-loop: cross iteration cycle; multi-dimensional arrays).  */
42
  diff = 0;
43
  for (i = 0; i < N; i++) {
44
    for (i = 0; i < N; i++) {
45
      diff += (image[i][j] - block[i][j]);
46
    }
47
  }
48
  ibar (&diff);
49
 
50
 
51
  /* Vectorizable.  */
52
  for (i = 0; i < N; i++){
53
    a[i] = b[i];
54
  }
55
  fbar (a);
56
 
57
 
58
  /* Vectorizable.  */
59
  for (i = 0; i < N; i++){
60
    a[i] = b[i] + c[i] + d[i];
61
  }
62
  fbar (a);
63
 
64
 
65
  /* Not vectorizable yet (access pattern).  */
66
  for (i = 0; i < N/2; i++){
67
    a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
68
    d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
69
  }
70
  fbar (a);
71
 
72
 
73
  /* Vectorizable.  */
74
  for (i = 0; i < N; i++){
75
    a[i] = b[i] + c[i];
76
    d[i] = b[i] + c[i];
77
    ia[i] = ib[i] + ic[i];
78
  }
79
  ibar (ia);
80
  fbar (a);
81
  fbar (d);
82
 
83
 
84
  /* Not vectorizable yet (two types with different nunits in vector).  */
85
  for (i = 0; i < N; i++){
86
    ia[i] = ib[i] + ic[i];
87
    sa[i] = sb[i] + sc[i];
88
  }
89
  ibar (ia);
90
  sbar (sa);
91
 
92
 
93
  /* Not vetorizable yet (too conservative dependence test).  */
94
  for (i = 0; i < N; i++){
95
    a[i] = b[i] + c[i];
96
    a[i+1] = b[i] + c[i];
97
  }
98
  fbar (a);
99
}
100
 
101
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
102
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
103
/* { 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.