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