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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ashrdi-1.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 688 jeremybenn
#include <limits.h>
2
 
3
extern void abort(void);
4
extern void exit(int);
5
 
6
#if __LONG_LONG_MAX__ == 9223372036854775807LL
7
#define BITS 64
8
 
9
static long long const zext[64] = {
10
  0x7654321fedcba980LL,
11
  0x3b2a190ff6e5d4c0LL,
12
  0x1d950c87fb72ea60LL,
13
  0xeca8643fdb97530LL,
14
  0x7654321fedcba98LL,
15
  0x3b2a190ff6e5d4cLL,
16
  0x1d950c87fb72ea6LL,
17
  0xeca8643fdb9753LL,
18
  0x7654321fedcba9LL,
19
  0x3b2a190ff6e5d4LL,
20
  0x1d950c87fb72eaLL,
21
  0xeca8643fdb975LL,
22
  0x7654321fedcbaLL,
23
  0x3b2a190ff6e5dLL,
24
  0x1d950c87fb72eLL,
25
  0xeca8643fdb97LL,
26
  0x7654321fedcbLL,
27
  0x3b2a190ff6e5LL,
28
  0x1d950c87fb72LL,
29
  0xeca8643fdb9LL,
30
  0x7654321fedcLL,
31
  0x3b2a190ff6eLL,
32
  0x1d950c87fb7LL,
33
  0xeca8643fdbLL,
34
  0x7654321fedLL,
35
  0x3b2a190ff6LL,
36
  0x1d950c87fbLL,
37
  0xeca8643fdLL,
38
  0x7654321feLL,
39
  0x3b2a190ffLL,
40
  0x1d950c87fLL,
41
  0xeca8643fLL,
42
  0x7654321fLL,
43
  0x3b2a190fLL,
44
  0x1d950c87LL,
45
  0xeca8643LL,
46
  0x7654321LL,
47
  0x3b2a190LL,
48
  0x1d950c8LL,
49
  0xeca864LL,
50
  0x765432LL,
51
  0x3b2a19LL,
52
  0x1d950cLL,
53
  0xeca86LL,
54
  0x76543LL,
55
  0x3b2a1LL,
56
  0x1d950LL,
57
  0xeca8LL,
58
  0x7654LL,
59
  0x3b2aLL,
60
  0x1d95LL,
61
  0xecaLL,
62
  0x765LL,
63
  0x3b2LL,
64
  0x1d9LL,
65
  0xecLL,
66
  0x76LL,
67
  0x3bLL,
68
  0x1dLL,
69
  0xeLL,
70
  0x7LL,
71
  0x3LL,
72
  0x1LL,
73
  0LL
74
};
75
 
76
static long long const sext[64] = {
77
  0x8edcba9f76543210LL,
78
  0xc76e5d4fbb2a1908LL,
79
  0xe3b72ea7dd950c84LL,
80
  0xf1db9753eeca8642LL,
81
  0xf8edcba9f7654321LL,
82
  0xfc76e5d4fbb2a190LL,
83
  0xfe3b72ea7dd950c8LL,
84
  0xff1db9753eeca864LL,
85
  0xff8edcba9f765432LL,
86
  0xffc76e5d4fbb2a19LL,
87
  0xffe3b72ea7dd950cLL,
88
  0xfff1db9753eeca86LL,
89
  0xfff8edcba9f76543LL,
90
  0xfffc76e5d4fbb2a1LL,
91
  0xfffe3b72ea7dd950LL,
92
  0xffff1db9753eeca8LL,
93
  0xffff8edcba9f7654LL,
94
  0xffffc76e5d4fbb2aLL,
95
  0xffffe3b72ea7dd95LL,
96
  0xfffff1db9753eecaLL,
97
  0xfffff8edcba9f765LL,
98
  0xfffffc76e5d4fbb2LL,
99
  0xfffffe3b72ea7dd9LL,
100
  0xffffff1db9753eecLL,
101
  0xffffff8edcba9f76LL,
102
  0xffffffc76e5d4fbbLL,
103
  0xffffffe3b72ea7ddLL,
104
  0xfffffff1db9753eeLL,
105
  0xfffffff8edcba9f7LL,
106
  0xfffffffc76e5d4fbLL,
107
  0xfffffffe3b72ea7dLL,
108
  0xffffffff1db9753eLL,
109
  0xffffffff8edcba9fLL,
110
  0xffffffffc76e5d4fLL,
111
  0xffffffffe3b72ea7LL,
112
  0xfffffffff1db9753LL,
113
  0xfffffffff8edcba9LL,
114
  0xfffffffffc76e5d4LL,
115
  0xfffffffffe3b72eaLL,
116
  0xffffffffff1db975LL,
117
  0xffffffffff8edcbaLL,
118
  0xffffffffffc76e5dLL,
119
  0xffffffffffe3b72eLL,
120
  0xfffffffffff1db97LL,
121
  0xfffffffffff8edcbLL,
122
  0xfffffffffffc76e5LL,
123
  0xfffffffffffe3b72LL,
124
  0xffffffffffff1db9LL,
125
  0xffffffffffff8edcLL,
126
  0xffffffffffffc76eLL,
127
  0xffffffffffffe3b7LL,
128
  0xfffffffffffff1dbLL,
129
  0xfffffffffffff8edLL,
130
  0xfffffffffffffc76LL,
131
  0xfffffffffffffe3bLL,
132
  0xffffffffffffff1dLL,
133
  0xffffffffffffff8eLL,
134
  0xffffffffffffffc7LL,
135
  0xffffffffffffffe3LL,
136
  0xfffffffffffffff1LL,
137
  0xfffffffffffffff8LL,
138
  0xfffffffffffffffcLL,
139
  0xfffffffffffffffeLL,
140
  0xffffffffffffffffLL
141
};
142
 
143
#elif __LONG_LONG_MAX__ == 2147483647LL
144
#define BITS 32
145
 
146
static long long const zext[32] = {
147
  0x76543218LL,
148
  0x3b2a190cLL,
149
  0x1d950c86LL,
150
  0xeca8643LL,
151
  0x7654321LL,
152
  0x3b2a190LL,
153
  0x1d950c8LL,
154
  0xeca864LL,
155
  0x765432LL,
156
  0x3b2a19LL,
157
  0x1d950cLL,
158
  0xeca86LL,
159
  0x76543LL,
160
  0x3b2a1LL,
161
  0x1d950LL,
162
  0xeca8LL,
163
  0x7654LL,
164
  0x3b2aLL,
165
  0x1d95LL,
166
  0xecaLL,
167
  0x765LL,
168
  0x3b2LL,
169
  0x1d9LL,
170
  0xecLL,
171
  0x76LL,
172
  0x3bLL,
173
  0x1dLL,
174
  0xeLL,
175
  0x7LL,
176
  0x3LL,
177
  0x1LL,
178
  0LL
179
};
180
 
181
static long long const sext[64] = {
182
  0x87654321LL,
183
  0xc3b2a190LL,
184
  0xe1d950c8LL,
185
  0xf0eca864LL,
186
  0xf8765432LL,
187
  0xfc3b2a19LL,
188
  0xfe1d950cLL,
189
  0xff0eca86LL,
190
  0xff876543LL,
191
  0xffc3b2a1LL,
192
  0xffe1d950LL,
193
  0xfff0eca8LL,
194
  0xfff87654LL,
195
  0xfffc3b2aLL,
196
  0xfffe1d95LL,
197
  0xffff0ecaLL,
198
  0xffff8765LL,
199
  0xffffc3b2LL,
200
  0xffffe1d9LL,
201
  0xfffff0ecLL,
202
  0xfffff876LL,
203
  0xfffffc3bLL,
204
  0xfffffe1dLL,
205
  0xffffff0eLL,
206
  0xffffff87LL,
207
  0xffffffc3LL,
208
  0xffffffe1LL,
209
  0xfffffff0LL,
210
  0xfffffff8LL,
211
  0xfffffffcLL,
212
  0xfffffffeLL,
213
  0xffffffffLL
214
};
215
 
216
#else
217
#error "Update the test case."
218
#endif
219
 
220
static long long
221
variable_shift(long long x, int i)
222
{
223
  return x >> i;
224
}
225
 
226
static long long
227
constant_shift(long long x, int i)
228
{
229
  switch (i)
230
    {
231
    case 0: x = x >> 0; break;
232
    case 1: x = x >> 1; break;
233
    case 2: x = x >> 2; break;
234
    case 3: x = x >> 3; break;
235
    case 4: x = x >> 4; break;
236
    case 5: x = x >> 5; break;
237
    case 6: x = x >> 6; break;
238
    case 7: x = x >> 7; break;
239
    case 8: x = x >> 8; break;
240
    case 9: x = x >> 9; break;
241
    case 10: x = x >> 10; break;
242
    case 11: x = x >> 11; break;
243
    case 12: x = x >> 12; break;
244
    case 13: x = x >> 13; break;
245
    case 14: x = x >> 14; break;
246
    case 15: x = x >> 15; break;
247
    case 16: x = x >> 16; break;
248
    case 17: x = x >> 17; break;
249
    case 18: x = x >> 18; break;
250
    case 19: x = x >> 19; break;
251
    case 20: x = x >> 20; break;
252
    case 21: x = x >> 21; break;
253
    case 22: x = x >> 22; break;
254
    case 23: x = x >> 23; break;
255
    case 24: x = x >> 24; break;
256
    case 25: x = x >> 25; break;
257
    case 26: x = x >> 26; break;
258
    case 27: x = x >> 27; break;
259
    case 28: x = x >> 28; break;
260
    case 29: x = x >> 29; break;
261
    case 30: x = x >> 30; break;
262
    case 31: x = x >> 31; break;
263
#if BITS > 32
264
    case 32: x = x >> 32; break;
265
    case 33: x = x >> 33; break;
266
    case 34: x = x >> 34; break;
267
    case 35: x = x >> 35; break;
268
    case 36: x = x >> 36; break;
269
    case 37: x = x >> 37; break;
270
    case 38: x = x >> 38; break;
271
    case 39: x = x >> 39; break;
272
    case 40: x = x >> 40; break;
273
    case 41: x = x >> 41; break;
274
    case 42: x = x >> 42; break;
275
    case 43: x = x >> 43; break;
276
    case 44: x = x >> 44; break;
277
    case 45: x = x >> 45; break;
278
    case 46: x = x >> 46; break;
279
    case 47: x = x >> 47; break;
280
    case 48: x = x >> 48; break;
281
    case 49: x = x >> 49; break;
282
    case 50: x = x >> 50; break;
283
    case 51: x = x >> 51; break;
284
    case 52: x = x >> 52; break;
285
    case 53: x = x >> 53; break;
286
    case 54: x = x >> 54; break;
287
    case 55: x = x >> 55; break;
288
    case 56: x = x >> 56; break;
289
    case 57: x = x >> 57; break;
290
    case 58: x = x >> 58; break;
291
    case 59: x = x >> 59; break;
292
    case 60: x = x >> 60; break;
293
    case 61: x = x >> 61; break;
294
    case 62: x = x >> 62; break;
295
    case 63: x = x >> 63; break;
296
#endif
297
 
298
    default:
299
      abort ();
300
    }
301
  return x;
302
}
303
 
304
int
305
main()
306
{
307
  int i;
308
 
309
  for (i = 0; i < BITS; ++i)
310
    {
311
      long long y = variable_shift (zext[0], i);
312
      if (y != zext[i])
313
        abort ();
314
    }
315
  for (i = 0; i < BITS; ++i)
316
    {
317
      long long y = variable_shift (sext[0], i);
318
      if (y != sext[i])
319
        abort ();
320
    }
321
  for (i = 0; i < BITS; ++i)
322
    {
323
      long long y = constant_shift (zext[0], i);
324
      if (y != zext[i])
325
        abort ();
326
    }
327
  for (i = 0; i < BITS; ++i)
328
    {
329
      long long y = constant_shift (sext[0], i);
330
      if (y != sext[i])
331
        abort ();
332
    }
333
 
334
  exit (0);
335
}

powered by: WebSVN 2.1.0

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