Added more regression test to the pic port. Added support for <<, >>, ^
[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
131   aint0 >>= 1;
132
133 }
134
135 /*****************************************************/
136 void main(void)
137 {
138   char i;
139
140   aint0 = 0xabcd;
141
142   shift_int_left_1();
143   if(aint0 != 0x579a)
144     failures++;
145
146   aint0 = 0xabcd;
147
148   shift_int_left_2();
149   if(aint0 != 0xaf34)
150     failures++;
151
152   aint0 = 0xabcd;
153
154   shift_int_left_3();
155   if(aint0 != 0x5e68)
156     failures++;
157
158   aint0 = 0xabcd;
159
160   shift_int_left_4();
161   if(aint0 != 0xbcd0)
162     failures++;
163
164   aint0 = 0xabcd;
165
166   shift_int_left_5();
167   if(aint0 != 0x79a0)
168     failures++;
169
170   aint0 = 0xabcd;
171
172   shift_int_left_6();
173   if(aint0 != 0xf340)
174     failures++;
175
176   aint0 = 0xabcd;
177
178   shift_int_left_7();
179   if(aint0 != 0xe680)
180     failures++;
181
182   aint0 = 0xabcd;
183
184   shift_int_left_8();
185   if(aint0 != 0xcd00)
186     failures++;
187
188   aint0 = 0xabcd;
189
190   shift_int_left_9();
191   if(aint0 != 0x9a00)
192     failures++;
193
194   aint0 = 0xabcd;
195
196   shift_int_left_10();
197   if(aint0 != 0x3400)
198     failures++;
199
200   aint0 = 0xabcd;
201
202   shift_int_left_11();
203   if(aint0 != 0x6800)
204     failures++;
205
206   aint0 = 0xabcd;
207
208   shift_int_left_12();
209   if(aint0 != 0xd000)
210     failures++;
211
212   aint0 = 0xabcd;
213
214   shift_int_left_13();
215   if(aint0 != 0xa000)
216     failures++;
217
218   aint0 = 0xabcd;
219
220   shift_int_left_14();
221   if(aint0 != 0x4000)
222     failures++;
223
224   aint0 = 0xabcd;
225
226   shift_int_left_15();
227   if(aint0 != 0x8000)
228     failures++;
229
230   success=failures;
231   done();
232 }