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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [20020426-2.c] - Blame information for rev 154

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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