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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [graphite/] [interchange-8.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
#define DEBUG 0
2
#if DEBUG
3
#include <stdio.h>
4
#endif
5
 
6
int B[4];
7
int A[4][4][4][4];
8
 
9
static int __attribute__((noinline))
10
foo (void)
11
{
12
  int i, j, k, l;
13
 
14
  /* Loops (L, J) are interchanged, and then loops (J and K) are
15
     interchanged.  The result is a nest starting with (K, J, L).  */
16
  for (l = 0; l < 4; l++)
17
    {
18
      for (k = 0; k < 4; k++)
19
        {
20
          for (j = 0; j < 4; j++)
21
            {
22
              for (i = 0; i < 2; i++)
23
                {
24
                  B[i] = A[i][k][j][l] + A[3 - i][k][j][l];
25
                  B[3 - i] = A[i][k][j][l] - A[3 - i][k][j][l];
26
                }
27
              A[0][k][j][l] = B[0] + B[1];
28
              A[2][k][j][l] = B[0] - B[1];
29
              A[1][k][j][l] = B[3] + B[2];
30
              A[3][k][j][l] = B[3] - B[2];
31
            }
32
 
33
          for (i = 0; i < 4; i++)
34
            {
35
              for (j = 0; j < 2; j++)
36
                {
37
                  B[j] = A[i][k][j][l] + A[i][k][3 - j][l];
38
                  B[3 - j] = A[i][k][j][l] - A[i][k][3 - j][l];
39
                }
40
              A[i][k][0][l] = B[0] + B[1];
41
              A[i][k][2][l] = B[0] - B[1];
42
              A[i][k][1][l] = B[3] + B[2];
43
              A[i][k][3][l] = B[3] - B[2];
44
            }
45
        }
46
    }
47
 
48
  return A[0][1][0][2] + A[0][3][0][3] + A[0][2][0][2] + A[0][1][0][1] + A[3][3][0][2];
49
}
50
 
51
extern void abort ();
52
 
53
int
54
main (void)
55
{
56
  int i, j, k, l, res;
57
 
58
  for (i = 0; i < 4; i++)
59
    B[i] = 2;
60
 
61
  for (i = 0; i < 4; i++)
62
    for (j = 0; j < 4; j++)
63
      for (k = 0; k < 4; k++)
64
        for (l = 0; l < 4; l++)
65
          A[i][j][k][l] = i + j + k + l;
66
 
67
  res = foo ();
68
 
69
#if DEBUG
70
  for (i = 0; i < 4; i++)
71
    for (j = 0; j < 4; j++)
72
      for (k = 0; k < 4; k++)
73
        for (l = 0; l < 4; l++)
74
          fprintf (stderr, "A[%d][%d][%d][%d] = %d \n", i, j, k, l, A[i][j][k][l]);
75
 
76
  fprintf (stderr, "res = %d \n", res);
77
#endif
78
 
79
  if (res != 424)
80
    abort ();
81
 
82
  return 0;
83
}
84
 
85
/* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" } } */
86
/* { dg-final { cleanup-tree-dump "graphite" } } */

powered by: WebSVN 2.1.0

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