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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [20020426-2.c] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR optimization/6475
2
   Distilled from zlib sources.  */
3
/* { dg-do run } */
4
/* { dg-options "-O2" } */
5
/* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mtune=i686" { target { { i?86-*-* x86_64-*-* } && { ilp32 && fpic } } } } */
6
 
7
extern void exit (int);
8
 
9
typedef struct
10
{
11
  union
12
  {
13
    struct
14
    {
15
      unsigned char a3;
16
      unsigned char a4;
17
    } a2;
18
    unsigned int a5;
19
  } a0;
20
  unsigned int a1;
21
} A;
22
 
23
static int
24
foo (unsigned int *b, unsigned int n, unsigned int s, const unsigned int *d,
25
     const unsigned int *e, A **t, unsigned int *m, A *hp, unsigned int *hn,
26
     unsigned int *v)
27
{
28
  unsigned int a, c[15 + 1], f;
29
  int g, h;
30
  unsigned int i, j, k;
31
  int l;
32
  unsigned int ee;
33
  unsigned int *p;
34
  A *q, r, *u[15];
35
  int w;
36
  unsigned int x[15 + 1], *xx;
37
  int y;
38
  unsigned int z;
39
  p = c;
40
  *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
41
  *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
42
  *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
43
  *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
44
  p = b;
45
  i = n;
46
  do
47
    c[*p++]++;
48
  while (--i);
49
  if (c[0] == n)
50
    {
51
      *t = (A *) 0;
52
      *m = 0;
53
      return 0;
54
    }
55
  l = *m;
56
  for (j = 1; j <= 15; j++)
57
    if (c[j])
58
      break;
59
  k = j;
60
  if ((unsigned int) l < j)
61
    l = j;
62
  for (i = 15; i; i--)
63
    if (c[i])
64
      break;
65
  g = i;
66
  if ((unsigned int) l > i)
67
    l = i;
68
  *m = l;
69
  for (y = 1 << j; j < i; j++, y <<= 1)
70
    if ((y -= c[j]) < 0)
71
      return -3;
72
  if ((y -= c[i]) < 0)
73
    return -3;
74
  c[i] += y;
75
  x[1] = j = 0;
76
  p = c + 1;
77
  xx = x + 2;
78
  while (--i)
79
    *xx++ = (j += *p++);
80
  p = b;
81
  i = 0;
82
  do
83
    if ((j = *p++) != 0)
84
      v[x[j]++] = i;
85
  while (++i < n);
86
  n = x[g];
87
  x[0] = i = 0;
88
  p = v;
89
  h = -1;
90
  w = -l;
91
  u[0] = (A *) 0;
92
  q = (A *) 0;
93
  z = 0;
94
  for (; k <= g; k++)
95
    {
96
      a = c[k];
97
      while (a--)
98
        {
99
          while (k > w + l)
100
            {
101
              h++;
102
              w += l;
103
              z = g - w;
104
              z = z > (unsigned int) l ? l : z;
105
              if ((f = 1 << (j = k - w)) > a + 1)
106
                {
107
                  f -= a + 1;
108
                  xx = c + k;
109
                  if (j < z)
110
                    while (++j < z)
111
                      {
112
                        if ((f <<= 1) <= *++xx)
113
                          break;
114
                        f -= *xx;
115
                      }
116
                }
117
              z = 1 << j;
118
              if (*hn + z > 1440)
119
                return -3;
120
              u[h] = q = hp + *hn;
121
              *hn += z;
122
              if (h)
123
                {
124
                  x[h] = i;
125
                  r.a0.a2.a4 = (unsigned char) l;
126
                  r.a0.a2.a3 = (unsigned char) j;
127
                  j = i >> (w - l);
128
                  r.a1 = (unsigned int) (q - u[h - 1] - j);
129
                  u[h - 1][j] = r;
130
                }
131
              else
132
                *t = q;
133
            }
134
          r.a0.a2.a4 = (unsigned char) (k - w);
135
          if (p >= v + n)
136
            r.a0.a2.a3 = 128 + 64;
137
          else if (*p < s)
138
            {
139
              r.a0.a2.a3 = (unsigned char) (*p < 256 ? 0 : 32 + 64);
140
              r.a1 = *p++;
141
            }
142
          else
143
            {
144
              r.a0.a2.a3 = (unsigned char) (e[*p - s] + 16 + 64);
145
              r.a1 = d[*p++ - s];
146
            }
147
          f = 1 << (k - w);
148
          for (j = i >> w; j < z; j += f)
149
            q[j] = r;
150
          for (j = 1 << (k - 1); i & j; j >>= 1)
151
            i ^= j;
152
          i ^= j;
153
          ee = (1 << w) - 1;
154
          while ((i & ee) != x[h])
155
            {
156
              h--;
157
              w -= l;
158
              ee = (1 << w) - 1;
159
            }
160
        }
161
    }
162
  return y != 0 && g != 1 ? (-5) : 0;
163
}
164
 
165
unsigned int a[19] = { 3, 4, 0, 2, 2, [17] = 3, 3 };
166
unsigned int d[19];
167
A h[1440];
168
 
169
int
170
main (void)
171
{
172
  unsigned int b = 0, c = 0;
173
  A *e = 0;
174
  foo (a, 19, 19, 0, 0, &e, &b, h, &c, d);
175
  exit (0);
176
}

powered by: WebSVN 2.1.0

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