Imported Upstream version 2.9.0
[debian/cc1111] / src / regression / rotate3.c
1 #include "gpsim_assert.h"
2 // Shift ints left and right
3
4 unsigned char failures=0;
5
6 unsigned int aint0 = 0;
7 unsigned int aint1 = 0;
8 unsigned char achar0 = 0;
9 unsigned char achar1 = 0;
10 unsigned char achar2 = 0;
11 unsigned char achar3 = 0;
12
13 void
14 done()
15 {
16   ASSERT(MANGLE(failures) == 0);
17   PASSED();
18 }
19
20 void shift_int_left_1(void)
21 {
22
23   aint0 <<= 1;
24
25 }
26
27 void shift_int_left_2(void)
28 {
29
30   aint0 <<= 2;
31
32 }
33
34 void shift_int_left_3(void)
35 {
36
37   aint0 <<= 3;
38
39 }
40
41 void shift_int_left_4(void)
42 {
43
44   aint0 <<= 4;
45
46 }
47
48 void shift_int_left_5(void)
49 {
50
51   aint0 <<= 5;
52
53 }
54
55 void shift_int_left_6(void)
56 {
57
58   aint0 <<= 6;
59
60 }
61
62 void shift_int_left_7(void)
63 {
64
65   aint0 <<= 7;
66
67 }
68
69 void shift_int_left_8(void)
70 {
71
72   aint0 <<= 8;
73
74 }
75
76 void shift_int_left_9(void)
77 {
78
79   aint0 <<= 9;
80
81 }
82
83 void shift_int_left_10(void)
84 {
85
86   aint0 <<= 10;
87
88 }
89
90 void shift_int_left_11(void)
91 {
92
93   aint0 <<= 11;
94
95 }
96
97 void shift_int_left_12(void)
98 {
99
100   aint0 <<= 12;
101
102 }
103
104 void shift_int_left_13(void)
105 {
106
107   aint0 <<= 13;
108
109 }
110
111 void shift_int_left_14(void)
112 {
113
114   aint0 <<= 14;
115
116 }
117
118 void shift_int_left_15(void)
119 {
120
121   aint0 <<= 15;
122
123 }
124
125 /*****************************************************/
126 void shift_int_right_1(void)
127 {
128   aint0 >>= 1;
129 }
130
131 void shift_int_right_2(void)
132 {
133   aint0 >>= 2;
134 }
135
136 void shift_int_right_3(void)
137 {
138   aint0 >>= 3;
139 }
140
141 void shift_int_right_4(void)
142 {
143   aint0 >>= 4;
144 }
145
146 void shift_int_right_5(void)
147 {
148   aint0 >>= 5;
149 }
150
151 void shift_int_right_6(void)
152 {
153   aint0 >>= 6;
154 }
155
156 void shift_int_right_7(void)
157 {
158   aint0 >>= 7;
159 }
160
161 void shift_int_right_8(void)
162 {
163   aint0 >>= 8;
164 }
165
166 void shift_int_right_9(void)
167 {
168   aint0 >>= 9;
169 }
170
171 void shift_int_right_10(void)
172 {
173   aint0 >>= 10;
174 }
175
176 void shift_int_right_11(void)
177 {
178   aint0 >>= 11;
179 }
180
181 void shift_int_right_12(void)
182 {
183   aint0 >>= 12;
184 }
185
186 void shift_int_right_13(void)
187 {
188   aint0 >>= 13;
189 }
190
191 void shift_int_right_14(void)
192 {
193   aint0 >>= 14;
194 }
195
196 void shift_int_right_15(void)
197 {
198   aint0 >>= 15;
199 }
200
201 /*****************************************************/
202 void main(void)
203 {
204   //char i;
205
206   aint0 = 0xabcd;
207
208   shift_int_left_1();
209   if(aint0 != 0x579a)
210     failures++;
211
212   aint0 = 0xabcd;
213
214   shift_int_left_2();
215   if(aint0 != 0xaf34)
216     failures++;
217
218   aint0 = 0xabcd;
219
220   shift_int_left_3();
221   if(aint0 != 0x5e68)
222     failures++;
223
224   aint0 = 0xabcd;
225
226   shift_int_left_4();
227   if(aint0 != 0xbcd0)
228     failures++;
229
230   aint0 = 0xabcd;
231
232   shift_int_left_5();
233   if(aint0 != 0x79a0)
234     failures++;
235
236   aint0 = 0xabcd;
237
238   shift_int_left_6();
239   if(aint0 != 0xf340)
240     failures++;
241
242   aint0 = 0xabcd;
243
244   shift_int_left_7();
245   if(aint0 != 0xe680)
246     failures++;
247
248   aint0 = 0xabcd;
249
250   shift_int_left_8();
251   if(aint0 != 0xcd00)
252     failures++;
253
254   aint0 = 0xabcd;
255
256   shift_int_left_9();
257   if(aint0 != 0x9a00)
258     failures++;
259
260   aint0 = 0xabcd;
261
262   shift_int_left_10();
263   if(aint0 != 0x3400)
264     failures++;
265
266   aint0 = 0xabcd;
267
268   shift_int_left_11();
269   if(aint0 != 0x6800)
270     failures++;
271
272   aint0 = 0xabcd;
273
274   shift_int_left_12();
275   if(aint0 != 0xd000)
276     failures++;
277
278   aint0 = 0xabcd;
279
280   shift_int_left_13();
281   if(aint0 != 0xa000)
282     failures++;
283
284   aint0 = 0xabcd;
285
286   shift_int_left_14();
287   if(aint0 != 0x4000)
288     failures++;
289
290   aint0 = 0xabcd;
291
292   shift_int_left_15();
293   if(aint0 != 0x8000)
294     failures++;
295
296   /***********************/
297   aint0 = 0xabcd;
298
299   shift_int_right_1();
300   if(aint0 != 0x55e6)
301     failures++;
302
303   aint0 = 0xabcd;
304
305   shift_int_right_2();
306   if(aint0 != 0x2af3)
307     failures++;
308
309   aint0 = 0xabcd;
310
311   shift_int_right_3();
312   if(aint0 != 0x1579)
313     failures++;
314
315   aint0 = 0xabcd;
316
317   shift_int_right_4();
318   if(aint0 != 0x0abc)
319     failures++;
320
321   aint0 = 0xabcd;
322
323   shift_int_right_5();
324   if(aint0 != 0x055e)
325     failures++;
326
327   aint0 = 0xabcd;
328
329   shift_int_right_6();
330   if(aint0 != 0x02af)
331     failures++;
332
333   aint0 = 0xabcd;
334
335   shift_int_right_7();
336   if(aint0 != 0x0157)
337     failures++;
338
339   aint0 = 0xabcd;
340
341   shift_int_right_8();
342   if(aint0 != 0x00ab)
343     failures++;
344
345   aint0 = 0xabcd;
346
347   shift_int_right_9();
348   if(aint0 != 0x0055)
349     failures++;
350
351   aint0 = 0xabcd;
352
353   shift_int_right_10();
354   if(aint0 != 0x002a)
355     failures++;
356
357   aint0 = 0xabcd;
358
359   shift_int_right_11();
360   if(aint0 != 0x0015)
361     failures++;
362
363   aint0 = 0xabcd;
364
365   shift_int_right_12();
366   if(aint0 != 0x000a)
367     failures++;
368
369   aint0 = 0xabcd;
370
371   shift_int_right_13();
372   if(aint0 != 0x0005)
373     failures++;
374
375   aint0 = 0xabcd;
376
377   shift_int_right_14();
378   if(aint0 != 0x0002)
379     failures++;
380
381   aint0 = 0xabcd;
382
383   shift_int_right_15();
384   if(aint0 != 0x0001)
385     failures++;
386
387   done();
388 }