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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [lshrdi-1.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 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 unsigned long long const zext[64] = {
10
  0x87654321fedcba90ULL,
11
  0x43b2a190ff6e5d48ULL,
12
  0x21d950c87fb72ea4ULL,
13
  0x10eca8643fdb9752ULL,
14
  0x87654321fedcba9ULL,
15
  0x43b2a190ff6e5d4ULL,
16
  0x21d950c87fb72eaULL,
17
  0x10eca8643fdb975ULL,
18
  0x87654321fedcbaULL,
19
  0x43b2a190ff6e5dULL,
20
  0x21d950c87fb72eULL,
21
  0x10eca8643fdb97ULL,
22
  0x87654321fedcbULL,
23
  0x43b2a190ff6e5ULL,
24
  0x21d950c87fb72ULL,
25
  0x10eca8643fdb9ULL,
26
  0x87654321fedcULL,
27
  0x43b2a190ff6eULL,
28
  0x21d950c87fb7ULL,
29
  0x10eca8643fdbULL,
30
  0x87654321fedULL,
31
  0x43b2a190ff6ULL,
32
  0x21d950c87fbULL,
33
  0x10eca8643fdULL,
34
  0x87654321feULL,
35
  0x43b2a190ffULL,
36
  0x21d950c87fULL,
37
  0x10eca8643fULL,
38
  0x87654321fULL,
39
  0x43b2a190fULL,
40
  0x21d950c87ULL,
41
  0x10eca8643ULL,
42
  0x87654321ULL,
43
  0x43b2a190ULL,
44
  0x21d950c8ULL,
45
  0x10eca864ULL,
46
  0x8765432ULL,
47
  0x43b2a19ULL,
48
  0x21d950cULL,
49
  0x10eca86ULL,
50
  0x876543ULL,
51
  0x43b2a1ULL,
52
  0x21d950ULL,
53
  0x10eca8ULL,
54
  0x87654ULL,
55
  0x43b2aULL,
56
  0x21d95ULL,
57
  0x10ecaULL,
58
  0x8765ULL,
59
  0x43b2ULL,
60
  0x21d9ULL,
61
  0x10ecULL,
62
  0x876ULL,
63
  0x43bULL,
64
  0x21dULL,
65
  0x10eULL,
66
  0x87ULL,
67
  0x43ULL,
68
  0x21ULL,
69
  0x10ULL,
70
  0x8ULL,
71
  0x4ULL,
72
  0x2ULL,
73
  0x1ULL
74
};
75
 
76
#elif __LONG_LONG_MAX__ == 2147483647LL
77
#define BITS 32
78
 
79
static unsigned long long const zext[32] = {
80
  0x87654321ULL,
81
  0x43b2a190ULL,
82
  0x21d950c8ULL,
83
  0x10eca864ULL,
84
  0x8765432ULL,
85
  0x43b2a19ULL,
86
  0x21d950cULL,
87
  0x10eca86ULL,
88
  0x876543ULL,
89
  0x43b2a1ULL,
90
  0x21d950ULL,
91
  0x10eca8ULL,
92
  0x87654ULL,
93
  0x43b2aULL,
94
  0x21d95ULL,
95
  0x10ecaULL,
96
  0x8765ULL,
97
  0x43b2ULL,
98
  0x21d9ULL,
99
  0x10ecULL,
100
  0x876ULL,
101
  0x43bULL,
102
  0x21dULL,
103
  0x10eULL,
104
  0x87ULL,
105
  0x43ULL,
106
  0x21ULL,
107
  0x10ULL,
108
  0x8ULL,
109
  0x4ULL,
110
  0x2ULL,
111
  0x1ULL,
112
};
113
 
114
#else
115
#error "Update the test case."
116
#endif
117
 
118
static unsigned long long
119
variable_shift(unsigned long long x, int i)
120
{
121
  return x >> i;
122
}
123
 
124
static unsigned long long
125
constant_shift(unsigned long long x, int i)
126
{
127
  switch (i)
128
    {
129
    case 0: x = x >> 0; break;
130
    case 1: x = x >> 1; break;
131
    case 2: x = x >> 2; break;
132
    case 3: x = x >> 3; break;
133
    case 4: x = x >> 4; break;
134
    case 5: x = x >> 5; break;
135
    case 6: x = x >> 6; break;
136
    case 7: x = x >> 7; break;
137
    case 8: x = x >> 8; break;
138
    case 9: x = x >> 9; break;
139
    case 10: x = x >> 10; break;
140
    case 11: x = x >> 11; break;
141
    case 12: x = x >> 12; break;
142
    case 13: x = x >> 13; break;
143
    case 14: x = x >> 14; break;
144
    case 15: x = x >> 15; break;
145
    case 16: x = x >> 16; break;
146
    case 17: x = x >> 17; break;
147
    case 18: x = x >> 18; break;
148
    case 19: x = x >> 19; break;
149
    case 20: x = x >> 20; break;
150
    case 21: x = x >> 21; break;
151
    case 22: x = x >> 22; break;
152
    case 23: x = x >> 23; break;
153
    case 24: x = x >> 24; break;
154
    case 25: x = x >> 25; break;
155
    case 26: x = x >> 26; break;
156
    case 27: x = x >> 27; break;
157
    case 28: x = x >> 28; break;
158
    case 29: x = x >> 29; break;
159
    case 30: x = x >> 30; break;
160
    case 31: x = x >> 31; break;
161
#if BITS > 32
162
    case 32: x = x >> 32; break;
163
    case 33: x = x >> 33; break;
164
    case 34: x = x >> 34; break;
165
    case 35: x = x >> 35; break;
166
    case 36: x = x >> 36; break;
167
    case 37: x = x >> 37; break;
168
    case 38: x = x >> 38; break;
169
    case 39: x = x >> 39; break;
170
    case 40: x = x >> 40; break;
171
    case 41: x = x >> 41; break;
172
    case 42: x = x >> 42; break;
173
    case 43: x = x >> 43; break;
174
    case 44: x = x >> 44; break;
175
    case 45: x = x >> 45; break;
176
    case 46: x = x >> 46; break;
177
    case 47: x = x >> 47; break;
178
    case 48: x = x >> 48; break;
179
    case 49: x = x >> 49; break;
180
    case 50: x = x >> 50; break;
181
    case 51: x = x >> 51; break;
182
    case 52: x = x >> 52; break;
183
    case 53: x = x >> 53; break;
184
    case 54: x = x >> 54; break;
185
    case 55: x = x >> 55; break;
186
    case 56: x = x >> 56; break;
187
    case 57: x = x >> 57; break;
188
    case 58: x = x >> 58; break;
189
    case 59: x = x >> 59; break;
190
    case 60: x = x >> 60; break;
191
    case 61: x = x >> 61; break;
192
    case 62: x = x >> 62; break;
193
    case 63: x = x >> 63; break;
194
#endif
195
 
196
    default:
197
      abort ();
198
    }
199
  return x;
200
}
201
 
202
int
203
main()
204
{
205
  int i;
206
 
207
  for (i = 0; i < BITS; ++i)
208
    {
209
      unsigned long long y = variable_shift (zext[0], i);
210
      if (y != zext[i])
211
        abort ();
212
    }
213
  for (i = 0; i < BITS; ++i)
214
    {
215
      unsigned long long y = constant_shift (zext[0], i);
216
      if (y != zext[i])
217
        abort ();
218
    }
219
 
220
  exit (0);
221
}

powered by: WebSVN 2.1.0

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