1 // Signed comparisons of the form: (variable>=LIT)
3 // This regression test exercises all of the boundary
4 // conditions in literal less than comparisons. There
5 // are numerous opportunities to optimize these comparison
6 // and each one has an astonishing capability of failing
7 // a boundary condition.
9 unsigned char success = 0;
10 unsigned char failures = 0;
11 unsigned char dummy = 0;
12 unsigned char result = 0;
17 unsigned char uchar0 = 0;
18 unsigned char uchar1 = 0;
19 signed char char0 = 0;
20 signed char char1 = 0;
31 void c_char_gte_lit1(unsigned char expected_result)
54 if(result != expected_result)
59 void char_compare(void)
62 c_char_gte_lit1(0x3f);
65 c_char_gte_lit1(0x1f);
68 c_char_gte_lit1(0x0f);
71 c_char_gte_lit1(0x0f);
74 c_char_gte_lit1(0x0f);
77 c_char_gte_lit1(0x07);
80 c_char_gte_lit1(0x03);
83 c_char_gte_lit1(0x01);
86 c_char_gte_lit1(0x01);
89 c_char_gte_lit1(0x01);
92 c_char_gte_lit1(0x01);
95 c_char_gte_lit1(0x00);
98 /* Now test entire range */
100 for(char0=1; char0 != 0x7e; char0++)
101 c_char_gte_lit1(0x0f);
103 for(char0=-0x7f; char0 != -1; char0++)
104 c_char_gte_lit1(0x01);
109 void c_int_gte_lit1(unsigned char expected_result)
138 if(result != expected_result)
144 void int_compare1(void)
147 c_int_gte_lit1(0x00);
150 c_int_gte_lit1(0x01);
153 c_int_gte_lit1(0x03);
156 c_int_gte_lit1(0x03);
159 c_int_gte_lit1(0x03);
162 c_int_gte_lit1(0x07);
165 c_int_gte_lit1(0x0f);
168 c_int_gte_lit1(0x1f);
171 c_int_gte_lit1(0x1f);
174 c_int_gte_lit1(0x1f);
177 c_int_gte_lit1(0x3f);
180 c_int_gte_lit1(0x7f);
183 c_int_gte_lit1(0xff);
186 c_int_gte_lit1(0xff);
188 /* now check contiguous ranges */
190 for(int0 = -0x7fff; int0 != -1; int0++)
191 c_int_gte_lit1(0x00);
193 for(int0 = 1; int0 != 0xff; int0++)
194 c_int_gte_lit1(0x03);
196 for(int0 = 0x201; int0 != 0x7fff; int0++)
197 c_int_gte_lit1(0xff);
202 void c_int_gte_lit2(unsigned char expected_result)
230 if(result != expected_result)
234 void int_compare2(void)
237 c_int_gte_lit2(0x01);
240 c_int_gte_lit2(0x03);
243 c_int_gte_lit2(0x07);
246 c_int_gte_lit2(0x0f);
249 c_int_gte_lit2(0x0f);
252 c_int_gte_lit2(0x0f);
255 c_int_gte_lit2(0x0f);
258 c_int_gte_lit2(0x0f);
261 c_int_gte_lit2(0x1f);
264 c_int_gte_lit2(0x3f);
267 c_int_gte_lit2(0x7f);
270 c_int_gte_lit2(0x7f);
273 c_int_gte_lit2(0xff);
276 c_int_gte_lit2(0xff);
279 c_int_gte_lit2(0xff);
282 c_int_gte_lit2(0xff);
284 /* now check contiguous ranges */
286 for(int0 = -0x7fff; int0 != -0x7f00; int0++)
287 c_int_gte_lit2(0x01);
289 for(int0 = -0x7e00; int0 != -0x101; int0++)
290 c_int_gte_lit2(0x0f);
292 for(int0 = -1; int0 != 0x7fff; int0++)
293 c_int_gte_lit2(0xff);