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