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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20090113-1.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
typedef struct descriptor_dimension
2
{
3
  int stride;
4
  int lbound;
5
  int ubound;
6
} descriptor_dimension;
7
typedef struct {
8
    int *data;
9
    int dtype;
10
    descriptor_dimension dim[7];
11
} gfc_array_i4;
12
 
13
void
14
msum_i4 (gfc_array_i4 * const retarray,
15
         gfc_array_i4 * const array,
16
         const int * const pdim)
17
{
18
  int count[7];
19
  int extent[7];
20
  int * dest;
21
  const int * base;
22
  int dim;
23
  int n;
24
  int len;
25
 
26
  dim = (*pdim) - 1;
27
  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
28
 
29
  for (n = 0; n < dim; n++)
30
    {
31
      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
32
      count[n] = 0;
33
    }
34
 
35
  dest = retarray->data;
36
  base = array->data;
37
 
38
  do
39
    {
40
      int result = 0;
41
 
42
      for (n = 0; n < len; n++, base++)
43
        result += *base;
44
      *dest = result;
45
 
46
      count[0]++;
47
      dest += 1;
48
    }
49
  while (count[0] != extent[0]);
50
}
51
 
52
int main()
53
{
54
  int rdata[3];
55
  int adata[9];
56
  gfc_array_i4 retarray = { rdata, 265, { { 1, 1, 3 } } };
57
  gfc_array_i4 array = { adata, 266, { { 1, 1, 3 }, { 3, 1, 3 } } };
58
  int dim = 2;
59
  msum_i4 (&retarray, &array, &dim);
60
  return 0;
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.