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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ashldi-1.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 297 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 data[64] = {
10
  0x123456789abcdefULL,
11
  0x2468acf13579bdeULL,
12
  0x48d159e26af37bcULL,
13
  0x91a2b3c4d5e6f78ULL,
14
  0x123456789abcdef0ULL,
15
  0x2468acf13579bde0ULL,
16
  0x48d159e26af37bc0ULL,
17
  0x91a2b3c4d5e6f780ULL,
18
  0x23456789abcdef00ULL,
19
  0x468acf13579bde00ULL,
20
  0x8d159e26af37bc00ULL,
21
  0x1a2b3c4d5e6f7800ULL,
22
  0x3456789abcdef000ULL,
23
  0x68acf13579bde000ULL,
24
  0xd159e26af37bc000ULL,
25
  0xa2b3c4d5e6f78000ULL,
26
  0x456789abcdef0000ULL,
27
  0x8acf13579bde0000ULL,
28
  0x159e26af37bc0000ULL,
29
  0x2b3c4d5e6f780000ULL,
30
  0x56789abcdef00000ULL,
31
  0xacf13579bde00000ULL,
32
  0x59e26af37bc00000ULL,
33
  0xb3c4d5e6f7800000ULL,
34
  0x6789abcdef000000ULL,
35
  0xcf13579bde000000ULL,
36
  0x9e26af37bc000000ULL,
37
  0x3c4d5e6f78000000ULL,
38
  0x789abcdef0000000ULL,
39
  0xf13579bde0000000ULL,
40
  0xe26af37bc0000000ULL,
41
  0xc4d5e6f780000000ULL,
42
  0x89abcdef00000000ULL,
43
  0x13579bde00000000ULL,
44
  0x26af37bc00000000ULL,
45
  0x4d5e6f7800000000ULL,
46
  0x9abcdef000000000ULL,
47
  0x3579bde000000000ULL,
48
  0x6af37bc000000000ULL,
49
  0xd5e6f78000000000ULL,
50
  0xabcdef0000000000ULL,
51
  0x579bde0000000000ULL,
52
  0xaf37bc0000000000ULL,
53
  0x5e6f780000000000ULL,
54
  0xbcdef00000000000ULL,
55
  0x79bde00000000000ULL,
56
  0xf37bc00000000000ULL,
57
  0xe6f7800000000000ULL,
58
  0xcdef000000000000ULL,
59
  0x9bde000000000000ULL,
60
  0x37bc000000000000ULL,
61
  0x6f78000000000000ULL,
62
  0xdef0000000000000ULL,
63
  0xbde0000000000000ULL,
64
  0x7bc0000000000000ULL,
65
  0xf780000000000000ULL,
66
  0xef00000000000000ULL,
67
  0xde00000000000000ULL,
68
  0xbc00000000000000ULL,
69
  0x7800000000000000ULL,
70
  0xf000000000000000ULL,
71
  0xe000000000000000ULL,
72
  0xc000000000000000ULL,
73
  0x8000000000000000ULL
74
};
75
 
76
#elif __LONG_LONG_MAX__ == 2147483647LL
77
#define BITS 32
78
 
79
static unsigned long long const data[32] = {
80
  0x1234567fULL,
81
  0x2468acfeULL,
82
  0x48d159fcULL,
83
  0x91a2b3f8ULL,
84
  0x234567f0ULL,
85
  0x468acfe0ULL,
86
  0x8d159fc0ULL,
87
  0x1a2b3f80ULL,
88
  0x34567f00ULL,
89
  0x68acfe00ULL,
90
  0xd159fc00ULL,
91
  0xa2b3f800ULL,
92
  0x4567f000ULL,
93
  0x8acfe000ULL,
94
  0x159fc000ULL,
95
  0x2b3f8000ULL,
96
  0x567f0000ULL,
97
  0xacfe0000ULL,
98
  0x59fc0000ULL,
99
  0xb3f80000ULL,
100
  0x67f00000ULL,
101
  0xcfe00000ULL,
102
  0x9fc00000ULL,
103
  0x3f800000ULL,
104
  0x7f000000ULL,
105
  0xfe000000ULL,
106
  0xfc000000ULL,
107
  0xf8000000ULL,
108
  0xf0000000ULL,
109
  0xe0000000ULL,
110
  0xc0000000ULL,
111
  0x80000000ULL
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 (data[0], i);
210
      if (y != data[i])
211
        abort ();
212
    }
213
  for (i = 0; i < BITS; ++i)
214
    {
215
      unsigned long long y = constant_shift (data[0], i);
216
      if (y != data[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.