OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [matrix/] [matrix-4.c] - Blame information for rev 300

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O3 -fipa-matrix-reorg -fdump-ipa-matrix-reorg -c -fwhole-program -combine"  } */
3
 
4
 
5
#include <stdio.h>
6
#include <stdlib.h>
7
#include <math.h>
8
#include <string.h>
9
 
10
void mem_init (void);
11
int ARCHnodes, ARCHnodes1;
12
int ***vel;
13
void just_a_call (int ****);
14
 
15
/* Address of VEL is taken.
16
   It is not flattened.  */
17
 
18
 
19
/*--------------------------------------------------------------------------*/
20
 
21
int
22
main (int argc, char **argv)
23
{
24
  int i, j, k;
25
 
26
  ARCHnodes = 2;
27
  ARCHnodes1 = 4;
28
 
29
/* Dynamic memory allocations and initializations */
30
 
31
  mem_init ();
32
 
33
  for (i = 0; i < ARCHnodes; i++)
34
    {
35
      for (j = 0; j < 3; j++)
36
        {
37
          for (k = 0; k < ARCHnodes1; k++)
38
            printf ("[%d][%d][%d]=%d ", i, j, k, vel[i][j][k]);
39
          printf ("\n");
40
        }
41
      printf ("\n");
42
    }
43
  for (i = 0; i < ARCHnodes; i++)
44
    for (j = 0; j < 3; j++)
45
      free (vel[i][j]);
46
 
47
  for (i = 0; i < ARCHnodes; i++)
48
    free (vel[i]);
49
 
50
  free (vel);
51
  return 0;
52
}
53
 
54
/*--------------------------------------------------------------------------*/
55
/* Dynamic memory allocations and initializations                           */
56
 
57
void
58
mem_init (void)
59
{
60
 
61
  int i, j, k,d;
62
 
63
  d = 0;
64
  vel = (int ***) malloc (ARCHnodes * sizeof (int **));
65
 
66
  for (i = 0; i < ARCHnodes; i++)
67
    {
68
      vel[i] = (int **) malloc (3 * sizeof (int *));
69
      if (vel[i] == (int **) NULL)
70
        {
71
          fprintf (stderr, "malloc failed for vel[%d]\n", i);
72
          fflush (stderr);
73
          exit (0);
74
        }
75
    }
76
  for (i = 0; i < ARCHnodes; i++)
77
    {
78
      for (j = 0; j < 3; j++)
79
        {
80
          vel[i][j] = (int *) malloc (ARCHnodes1 * sizeof (int));
81
        }
82
    }
83
  for (i = 0; i < ARCHnodes; i++)
84
    {
85
      for (j = 0; j < 3; j++)
86
        {
87
          for (k = 0; k < ARCHnodes1; k++)
88
            {
89
              vel[i][j][k] = d;
90
              d++;
91
            }
92
        }
93
    }
94
  just_a_call (&vel);
95
}
96
 
97
/*--------------------------------------------------------------------------*/
98
/* { dg-final { scan-ipa-dump-times "Flattened" 0 "matrix-reorg"  } } */
99
/* { dg-final { cleanup-ipa-dump "matrix-reorg" } } */

powered by: WebSVN 2.1.0

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