New test.
[mono.git] / mono / mini / basic.cs
1 using System;
2 using System.Reflection;
3
4 /*
5  * Regression tests for the mono JIT.
6  *
7  * Each test needs to be of the form:
8  *
9  * static int test_<result>_<name> ();
10  *
11  * where <result> is an integer (the value that needs to be returned by
12  * the method to make it pass.
13  * <name> is a user-displayed name used to identify the test.
14  *
15  * The tests can be driven in two ways:
16  * *) running the program directly: Main() uses reflection to find and invoke
17  *      the test methods (this is useful mostly to check that the tests are correct)
18  * *) with the --regression switch of the jit (this is the preferred way since
19  *      all the tests will be run with optimizations on and off)
20  *
21  * The reflection logic could be moved to a .dll since we need at least another
22  * regression test file written in IL code to have better control on how
23  * the IL code looks.
24  */
25
26 class Tests {
27
28         static int Main () {
29                 return TestDriver.RunTests (typeof (Tests));
30         }
31         
32         public static int test_0_return () {
33                 return 0;
34         }
35
36         public static int test_100000_return_large () {
37                 return 100000;
38         }
39
40         public static int test_1_load_bool () {
41                 bool a = true;
42                 return a? 1: 0;
43         }
44
45         public static int test_0_load_bool_false () {
46                 bool a = false;
47                 return a? 1: 0;
48         }
49
50         public static int test_200_load_byte () {
51                 byte a = 200;
52                 return a;
53         }
54
55         public static int test_100_load_sbyte () {
56                 sbyte a = 100;
57                 return a;
58         }
59
60         public static int test_200_load_short () {
61                 short a = 200;
62                 return a;
63         }
64
65         public static int test_100_load_ushort () {
66                 ushort a = 100;
67                 return a;
68         }
69
70         public static int test_3_add_simple () {
71                 int a = 1; 
72                 int b = 2;
73                 return a + b;
74         }
75
76         public static int test_3_add_imm () {
77                 int a = 1; 
78                 return a + 2;
79         }
80
81         public static int test_13407573_add_largeimm () {
82                 int a = 1; 
83                 return a + 13407572;
84         }
85
86         public static int test_1_sub_simple () {
87                 int a = 1; 
88                 int b = 2;
89                 return b - a;
90         }
91
92         public static int test_1_sub_simple_un () {
93                 uint a = 1; 
94                 uint b = 2;
95                 return (int)(b - a);
96         }
97
98         public static int test_1_sub_imm () {
99                 int b = 2;
100                 return b - 1;
101         }
102
103         public static int test_2_sub_large_imm () {
104                 int b = 0xff0f0f;
105                 return b - 0xff0f0d;
106         }
107
108         public static int test_0_sub_inv_imm () {
109                 int b = 2;
110                 return 2 - b;
111         }
112
113         public static int test_2_and () {
114                 int b = 2;
115                 int a = 3;
116                 return b & a;
117         }
118
119         public static int test_0_and_imm () {
120                 int b = 2;
121                 return b & 0x10;
122         }
123
124         public static int test_0_and_large_imm () {
125                 int b = 2;
126                 return b & 0x10000000;
127         }
128
129         public static int test_0_and_large_imm2 () {
130                 int b = 2;
131                 return b & 0x100000f0;
132         }
133
134         public static int test_2_div () {
135                 int b = 6;
136                 int a = 3;
137                 return b / a;
138         }
139
140         public static int test_4_div_imm () {
141                 int b = 12;
142                 return b / 3;
143         }
144
145         public static int test_4_divun_imm () {
146                 uint b = 12;
147                 return (int)(b / 3);
148         }
149
150         public static int test_0_div_fold () {
151                 int b = -1;
152                 return b / 2;
153         }
154
155         public static int test_2_div_fold4 () {
156                 int b = -8;
157                 return -(b / 4);
158         }
159
160         public static int test_2_div_fold16 () {
161                 int b = 32;
162                 return b / 16;
163         }
164
165         public static int test_719177_div_destreg () {
166                 int year = 1970;
167                 return ((365* (year-1)) + ((year-1)/4));
168         }
169
170         public static int test_1_remun_imm () {
171                 uint b = 13;
172                 return (int)(b % 3);
173         }
174
175         public static int test_2_bigremun_imm () {
176                 unchecked {
177                         uint b = (uint)-2;
178                         return (int)(b % 3);
179                 }
180         }
181
182         public static int test_2_rem () {
183                 int b = 5;
184                 int a = 3;
185                 return b % a;
186         }
187
188         public static int test_4_rem_imm () {
189                 int b = 12;
190                 return b % 8;
191         }
192
193         public static int test_4_rem_big_imm () {
194                 int b = 10004;
195                 return b % 10000;
196         }
197
198         public static int test_9_mul () {
199                 int b = 3;
200                 int a = 3;
201                 return b * a;
202         }
203
204         public static int test_15_mul_imm () {
205                 int b = 3;
206                 return b * 5;
207         }
208
209         public static int test_24_mul () {
210                 int a = 3;
211                 int b = 8;
212                 int res;
213
214                 res = a * b;
215                 
216                 return res;
217         }
218
219         public static int test_24_mul_ovf () {
220                 int a = 3;
221                 int b = 8;
222                 int res;
223
224                 checked {
225                         res = a * b;
226                 }
227                 
228                 return res;
229         }
230
231         public static int test_24_mul_un () {
232                 uint a = 3;
233                 uint b = 8;
234                 uint res;
235
236                 res = a * b;
237                 
238                 return (int)res;
239         }
240
241         public static int test_24_mul_ovf_un () {
242                 uint a = 3;
243                 uint b = 8;
244                 uint res;
245
246                 checked {
247                         res = a * b;
248                 }
249                 
250                 return (int)res;
251         }
252
253         public static int test_0_add_ovf () {
254                 int i, j, k;
255
256                 checked {
257                         i = System.Int32.MinValue;
258                         j = 0;
259                         k = i + j;
260                 }
261
262                 if (k != System.Int32.MinValue)
263                         return 1;
264
265                 checked {
266                         i = System.Int32.MaxValue;
267                         j = 0;
268                         k = i + j;
269                 }
270
271                 if (k != System.Int32.MaxValue)
272                         return 2;
273
274                 checked {
275                         i = System.Int32.MinValue;
276                         j = System.Int32.MaxValue;
277                         k = i + j;
278                 }
279
280                 if (k != -1)
281                         return 3;
282
283                 checked {
284                         i = System.Int32.MaxValue;
285                         j = System.Int32.MinValue;
286                         k = i + j;
287                 }
288
289                 if (k != -1)
290                         return 4;
291
292                 checked {
293                         i = System.Int32.MinValue + 1234;
294                         j = -1234;
295                         k = i + j;
296                 }
297
298                 if (k != System.Int32.MinValue)
299                         return 5;
300
301                 checked {
302                         i = System.Int32.MaxValue - 1234;
303                         j = 1234;
304                         k = i + j;
305                 }
306
307                 if (k != System.Int32.MaxValue)
308                         return 6;
309
310                 return 0;
311         }
312
313         public static int test_0_add_un_ovf () {
314                 uint n = (uint)134217728 * 16;
315                 uint number = checked (n + (uint)0);
316
317                 return number == n ? 0 : 1;
318         }
319
320         public static int test_0_sub_ovf () {
321                 int i, j, k;
322
323                 checked {
324                         i = System.Int32.MinValue;
325                         j = 0;
326                         k = i - j;
327                 }
328
329                 if (k != System.Int32.MinValue)
330                         return 1;
331
332                 checked {
333                         i = System.Int32.MaxValue;
334                         j = 0;
335                         k = i - j;
336                 }
337
338                 if (k != System.Int32.MaxValue)
339                         return 2;
340
341                 checked {
342                         i = System.Int32.MinValue;
343                         j = System.Int32.MinValue + 1234;
344                         k = i - j;
345                 }
346
347                 if (k != -1234)
348                         return 3;
349
350                 checked {
351                         i = System.Int32.MaxValue;
352                         j = 1234;
353                         k = i - j;
354                 }
355
356                 if (k != System.Int32.MaxValue - 1234)
357                         return 4;
358
359                 checked {
360                         i = System.Int32.MaxValue - 1234;
361                         j = -1234;
362                         k = i - j;
363                 }
364
365                 if (k != System.Int32.MaxValue)
366                         return 5;
367
368                 checked {
369                         i = System.Int32.MinValue + 1234;
370                         j = 1234;
371                         k = i - j;
372                 }
373
374                 if (k != System.Int32.MinValue)
375                         return 6;
376
377                 return 0;
378         }
379
380         public static int test_0_sub_ovf_un () {
381                 uint i, j, k;
382
383                 checked {
384                         i = System.UInt32.MaxValue;
385                         j = 0;
386                         k = i - j;
387                 }
388
389                 if (k != System.UInt32.MaxValue)
390                         return 1;
391
392                 checked {
393                         i = System.UInt32.MaxValue;
394                         j = System.UInt32.MaxValue;
395                         k = i - j;
396                 }
397
398                 if (k != 0)
399                         return 2;
400
401                 return 0;
402         }
403
404         public static int test_3_or () {
405                 int b = 2;
406                 int a = 3;
407                 return b | a;
408         }
409
410         public static int test_3_or_un () {
411                 uint b = 2;
412                 uint a = 3;
413                 return (int)(b | a);
414         }
415
416         public static int test_3_or_short_un () {
417                 ushort b = 2;
418                 ushort a = 3;
419                 return (int)(b | a);
420         }
421
422         public static int test_18_or_imm () {
423                 int b = 2;
424                 return b | 0x10;
425         }
426
427         public static int test_268435458_or_large_imm () {
428                 int b = 2;
429                 return b | 0x10000000;
430         }
431
432         public static int test_268435459_or_large_imm2 () {
433                 int b = 2;
434                 return b | 0x10000001;
435         }
436
437         public static int test_1_xor () {
438                 int b = 2;
439                 int a = 3;
440                 return b ^ a;
441         }
442
443         public static int test_1_xor_imm () {
444                 int b = 2;
445                 return b ^ 3;
446         }
447
448         public static int test_983041_xor_imm_large () {
449                 int b = 2;
450                 return b ^ 0xf0003;
451         }
452
453         public static int test_1_neg () {
454                 int b = -2;
455                 b++;
456                 return -b;
457         }
458
459         public static int test_2_not () {
460                 int b = ~2;
461                 b = ~b;
462                 return b;
463         }
464
465         public static int test_16_shift () {
466                 int b = 2;
467                 int a = 3;
468                 return b << a;
469         }
470         
471         public static int test_16_shift_add () {
472                 int b = 2;
473                 int a = 3;
474                 int c = 0;
475                 return b << (a + c);
476         }
477         
478         public static int test_16_shift_add2 () {
479                 int b = 2;
480                 int a = 3;
481                 int c = 0;
482                 return (b + c) << a;
483         }
484         
485         public static int test_16_shift_imm () {
486                 int b = 2;
487                 return b << 3;
488         }
489         
490         public static int test_524288_shift_imm_large () {
491                 int b = 2;
492                 return b << 18;
493         }
494         
495         public static int test_12_shift_imm_inv () {
496                 int b = 2;
497                 return 3 << 2;
498         }
499
500         public static int test_12_shift_imm_inv_sbyte () {
501                 sbyte b = 2;
502                 return 3 << 2;
503         }
504
505         public static int test_1_rshift_imm () {
506                 int b = 8;
507                 return b >> 3;
508         }
509         
510         public static int test_2_unrshift_imm () {
511                 uint b = 16;
512                 return (int)(b >> 3);
513         }
514         
515         public static int test_0_bigunrshift_imm () {
516                 unchecked {
517                         uint b = (uint)-1;
518                         b = b >> 1;
519                         if (b != 0x7fffffff)
520                                 return 1;
521                         return 0;
522                 }
523         }
524         
525         public static int test_0_bigrshift_imm () {
526                 int b = -1;
527                 b = b >> 1;
528                 if (b != -1)
529                         return 1;
530                 return 0;
531         }
532         
533         public static int test_1_rshift () {
534                 int b = 8;
535                 int a = 3;
536                 return b >> a;
537         }
538         
539         public static int test_2_unrshift () {
540                 uint b = 16;
541                 int a = 3;
542                 return (int)(b >> a);
543         }
544         
545         public static int test_0_bigunrshift () {
546                 unchecked {
547                         uint b = (uint)-1;
548                         int a = 1;
549                         b = b >> a;
550                         if (b != 0x7fffffff)
551                                 return 1;
552                         return 0;
553                 }
554         }
555         
556         public static int test_0_bigrshift () {
557                 int b = -1;
558                 int a = 1;
559                 b = b >> a;
560                 if (b != -1)
561                         return 1;
562                 return 0;
563         }
564         
565         public static int test_2_cond () {
566                 int b = 2, a = 3, c;
567                 if (a == b)
568                         return 0;
569                 return 2;
570         }
571         
572         public static int test_2_cond_short () {
573                 short b = 2, a = 3, c;
574                 if (a == b)
575                         return 0;
576                 return 2;
577         }
578         
579         public static int test_2_cond_sbyte () {
580                 sbyte b = 2, a = 3, c;
581                 if (a == b)
582                         return 0;
583                 return 2;
584         }
585         
586         public static int test_6_cascade_cond () {
587                 int b = 2, a = 3, c;
588                 if (a == b)
589                         return 0;
590                 else if (b > a)
591                         return 1;
592                 else if (b != b)
593                         return 2;
594                 else {
595                         c = 1;
596                 }
597                 return a + b + c;
598         }
599         
600         public static int test_6_cascade_short () {
601                 short b = 2, a = 3, c;
602                 if (a == b)
603                         return 0;
604                 else if (b > a)
605                         return 1;
606                 else if (b != b)
607                         return 2;
608                 else {
609                         c = 1;
610                 }
611                 return a + b + c;
612         }
613
614         public static int test_0_short_sign_extend () {
615                 int t1 = 0xffeedd;
616                 short s1 = (short)t1;
617                 int t2 = s1;
618
619                 if ((uint)t2 != 0xffffeedd) 
620                         return 1;
621                 else
622                         return 0;
623         }               
624         
625         public static int test_15_for_loop () {
626                 int i;
627                 for (i = 0; i < 15; ++i) {
628                 }
629                 return i;
630         }
631         
632         public static int test_11_nested_for_loop () {
633                 int i, j = 0; /* mcs bug here if j not set */
634                 for (i = 0; i < 15; ++i) {
635                         for (j = 200; j >= 5; --j) ;
636                 }
637                 return i - j;
638         }
639
640         public static int test_11_several_nested_for_loops () {
641                 int i, j = 0; /* mcs bug here if j not set */
642                 for (i = 0; i < 15; ++i) {
643                         for (j = 200; j >= 5; --j) ;
644                 }
645                 i = j = 0;
646                 for (i = 0; i < 15; ++i) {
647                         for (j = 200; j >= 5; --j) ;
648                 }
649                 return i - j;
650         }
651
652         public static int test_0_conv_ovf_i1 () {
653                 int c;
654
655                 //for (int j = 0; j < 10000000; j++)
656                 checked {
657                         c = 127;
658                         sbyte b = (sbyte)c;
659                         c = -128;
660                         b = (sbyte)c;
661                 }
662
663                 return 0;
664         }
665         
666         public static int test_0_conv_ovf_i1_un () {
667                 uint c;
668
669                 checked {
670                         c = 127;
671                         sbyte b = (sbyte)c;
672                 }
673                 
674                 return 0;
675         }
676         
677         public static int test_0_conv_ovf_i2 () {
678                 int c;
679
680                 checked {
681                         c = 32767;
682                         Int16 b = (Int16)c;
683                         c = -32768;
684                         b = (Int16)c;
685                         unchecked {
686                                 uint u = 0xfffffffd;
687                                 c = (int)u;
688                         }
689                         b = (Int16)c;
690                 }
691                 
692                 return 0;
693         }
694         
695         public static int test_0_conv_ovf_i2_un () {
696                 uint c;
697
698                 checked {
699                         c = 32767;
700                         Int16 b = (Int16)c;
701                 }
702                 
703                 return 0;
704         }
705         
706         public static int test_0_conv_ovf_u2 () {
707                 int c;
708
709                 checked {
710                         c = 65535;
711                         UInt16 b = (UInt16)c;
712                 }
713                 
714                 return 0;
715         }
716         
717         public static int test_0_conv_ovf_u2_un () {
718                 uint c;
719
720                 checked {
721                         c = 65535;
722                         UInt16 b = (UInt16)c;
723                 }
724                 
725                 return 0;
726         }
727         
728         public static int test_0_conv_ovf_u4 () {
729                 int c;
730
731                 checked {
732                         c = 0x7fffffff;
733                         uint b = (uint)c;
734                 }
735                 
736                 return 0;
737         }
738
739         public static int test_0_conv_ovf_i4_un () {
740                 uint c;
741
742                 checked {
743                         c = 0x7fffffff;
744                         int b = (int)c;
745                 }
746
747                 return 0;
748         }
749         
750         public static int test_0_bool () {
751                 bool val = true;
752                 if (val)
753                         return 0;
754                 return 1;
755         }
756         
757         public static int test_1_bool_inverted () {
758                 bool val = true;
759                 if (!val)
760                         return 0;
761                 return 1;
762         }
763
764         public static int test_1_bool_assign () {
765                 bool val = true;
766                 val = !val; // this should produce a ceq
767                 if (val)
768                         return 0;
769                 return 1;
770         }
771
772         public static int test_1_bool_multi () {
773                 bool val = true;
774                 bool val2 = true;
775                 val = !val;
776                 if ((val && !val2) && (!val2 && val))
777                         return 0;
778                 return 1;
779         }
780
781         public static int test_16_spill () {
782                 int a = 1;
783                 int b = 2;
784                 int c = 3;
785                 int d = 4;
786                 int e = 5;
787
788                 return (1 + (a + (b + (c + (d + e)))));
789         }
790
791         public static int test_1_switch () {
792                 int n = 0;
793
794                 switch (n) {
795                 case 0: return 1;
796                 case 1: return 2;
797                 case -1: return 3;
798                 default:
799                         return 4;
800                 }
801                 return 1;
802         }
803
804         public static int test_0_switch_constprop () {
805                 int n = -1;
806
807                 switch (n) {
808                 case 0: return 2;
809                 case 1: return 3;
810                 case 2: return 3;                       
811                 default:
812                         return 0;
813                 }
814                 return 3;
815         }
816
817         public static int test_0_switch_constprop2 () {
818                 int n = 3;
819
820                 switch (n) {
821                 case 0: return 2;
822                 case 1: return 3;
823                 case 2: return 3;                       
824                 default:
825                         return 0;
826                 }
827                 return 3;
828         }
829
830         public static int test_0_while_loop_1 () {
831
832                 int value = 255;
833                 
834                 do {
835                         value = value >> 4;
836                 } while (value != 0);
837                 
838                 return 0;
839         }
840
841         public static int test_0_while_loop_2 () {
842                 int value = 255;
843                 int position = 5;
844                 
845                 do {
846                         value = value >> 4;
847                 } while (value != 0 && position > 1);
848         
849                 return 0;
850         }
851
852         public static int test_0_char_conv () {
853                 int i = 1;
854                 
855                 char tc = (char) ('0' + i);
856
857                 if (tc != '1')
858                         return 1;
859                 
860                 return 0;
861         }
862
863         public static int test_3_shift_regalloc () {
864                 int shift = 8;
865                 int orig = 1;
866                 byte value = 0xfe;
867
868                 orig &= ~(0xff << shift);
869                 orig |= value << shift;
870
871                 if (orig == 0xfe01)
872                         return 3;
873                 return 0;
874         }
875
876         enum E {A, B};
877         
878         public static int test_2_optimize_branches () {
879                 switch (E.A) {
880                 case E.A:
881                         if (E.A == E.B) {
882                         }
883                         break;
884                 }
885                 return 2;
886         }
887
888         public static int test_0_checked_byte_cast () {
889                 int v = 250;
890                 int b = checked ((byte) (v));
891
892                 if (b != 250)
893                         return 1;
894                 return 0;
895         }
896
897         public static int test_0_checked_byte_cast_un () {
898                 uint v = 250;
899                 uint b = checked ((byte) (v));
900
901                 if (b != 250)
902                         return 1;
903                 return 0;
904         }
905
906         public static int test_0_checked_short_cast () {
907                 int v = 250;
908                 int b = checked ((ushort) (v));
909
910                 if (b != 250)
911                         return 1;
912                 return 0;
913         }
914
915         public static int test_0_checked_short_cast_un () {
916                 uint v = 250;
917                 uint b = checked ((ushort) (v));
918
919                 if (b != 250)
920                         return 1;
921                 return 0;
922         }
923         
924         public static int test_1_a_eq_b_plus_a () {
925                 int a = 0, b = 1;
926                 a = b + a;
927                 return a;
928         }
929
930         public static int test_0_comp () {
931                 int a = 0;
932                 int b = -1;
933                 int error = 1;
934                 bool val;
935
936                 val = a < b;
937                 if (val)
938                         return error;
939                 error++;
940
941                 val = a > b;
942                 if (!val)
943                         return error;
944                 error ++;
945
946                 val = a == b;
947                 if (val)
948                         return error;
949                 error ++;
950
951                 val = a == a;
952                 if (!val)
953                         return error;
954                 error ++;
955
956                 return 0;
957         }
958
959         public static int test_0_comp_unsigned () {
960                 uint a = 1;
961                 uint b = 0xffffffff;
962                 int error = 1;
963                 bool val;
964
965                 val = a < b;
966                 if (!val)
967                         return error;
968                 error++;
969
970                 val = a <= b;
971                 if (!val)
972                         return error;
973                 error++;
974
975                 val = a == b;
976                 if (val)
977                         return error;
978                 error++;
979
980                 val = a >= b;
981                 if (val)
982                         return error;
983                 error++;
984
985                 val = a > b;
986                 if (val)
987                         return error;
988                 error++;
989
990                 val = b < a;
991                 if (val)
992                         return error;
993                 error++;
994
995                 val = b <= a;
996                 if (val)
997                         return error;
998                 error++;
999
1000                 val = b == a;
1001                 if (val)
1002                         return error;
1003                 error++;
1004
1005                 val = b > a;
1006                 if (!val)
1007                         return error;
1008                 error++;
1009
1010                 val = b >= a;
1011                 if (!val)
1012                         return error;
1013                 error++;
1014
1015                 return 0;
1016         }
1017         
1018         public static int test_16_cmov () 
1019         {
1020                 int n = 0;
1021                 if (n == 0)
1022                         n = 16;
1023                 
1024                 return n;
1025         }
1026
1027         public static int test_0_and_cmp ()
1028         {
1029                 /* test esi, imm */
1030                 int local = 0x01020304;
1031                 
1032                 if ((local & 0x01020304) == 0)
1033                         return 7;
1034                 
1035                 if ((local & 0x00000304) == 0)
1036                         return 8;
1037                 
1038                 if ((local & 0x00000004) == 0)
1039                         return 9;
1040                 
1041                 if ((local & 0x00000300) == 0)
1042                         return 10;
1043                 
1044                 if ((local & 0x00020000) == 0)
1045                         return 11;
1046                 
1047                 if ((local & 0x01000000) == 0)
1048                         return 12;
1049
1050                 return 0;
1051         }
1052
1053         public static int test_0_mul_imm_opt ()
1054         {
1055                 int i;
1056
1057                 i = 1;
1058                 if ((i * 2) != 2)
1059                         return 1;
1060                 i = -1;
1061                 if ((i * 2) != -2)
1062                         return 2;
1063                 i = 1;
1064                 if ((i * 3) != 3)
1065                         return 3;
1066                 i = -1;
1067                 if ((i * 3) != -3)
1068                         return 4;
1069                 i = 1;
1070                 if ((i * 5) != 5)
1071                         return 5;
1072                 i = -1;
1073                 if ((i * 5) != -5)
1074                         return 6;
1075                 i = 1;
1076                 if ((i * 6) != 6)
1077                         return 7;
1078                 i = -1;
1079                 if ((i * 6) != -6)
1080                         return 8;
1081                 i = 1;
1082                 if ((i * 9) != 9)
1083                         return 9;
1084                 i = -1;
1085                 if ((i * 9) != -9)
1086                         return 10;
1087                 i = 1;
1088                 if ((i * 10) != 10)
1089                         return 11;
1090                 i = -1;
1091                 if ((i * 10) != -10)
1092                         return 12;
1093                 i = 1;
1094                 if ((i * 12) != 12)
1095                         return 13;
1096                 i = -1;
1097                 if ((i * 12) != -12)
1098                         return 14;
1099                 i = 1;
1100                 if ((i * 25) != 25)
1101                         return 15;
1102                 i = -1;
1103                 if ((i * 25) != -25)
1104                         return 16;
1105                 i = 1;
1106                 if ((i * 100) != 100)
1107                         return 17;
1108                 i = -1;
1109                 if ((i * 100) != -100)
1110                         return 18;
1111                 
1112                 return 0;
1113         }
1114         
1115         public static int test_0_cne ()
1116         {
1117                 int x = 0;
1118                 int y = 1;
1119                 
1120                 bool b = x != y;
1121                 bool bb = x != x;
1122                 
1123                 if (!b)
1124                         return 1;
1125                 if (bb)
1126                         return 2;
1127                 
1128                 return 0;
1129         }
1130
1131         public static int test_0_cmp_regvar_zero ()
1132         {
1133                 int n = 10;
1134                 
1135                 if (!(n > 0 && n >= 0 && n != 0))
1136                         return 1;
1137                 if (n < 0 || n <= 0 || n == 0)
1138                         return 1;
1139                 
1140                 return 0;
1141         }
1142
1143         public static int test_5_div_un_cfold ()
1144         {
1145                 uint i = 10;
1146                 uint j = 2;
1147
1148                 return (int)(i / j);
1149         }
1150
1151         public static int test_1_rem_un_cfold ()
1152         {
1153                 uint i = 11;
1154                 uint j = 2;
1155
1156                 return (int)(i % j);
1157         }
1158 }