New test.
[mono.git] / mono / mini / basic-long.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  * public 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         public static int Main () {
29                 return TestDriver.RunTests (typeof (Tests));
30         }
31
32         public static int test_10_simple_cast () {
33                 long a = 10;
34                 return (int)a;
35         }
36
37         public static int test_1_bigmul1 () {
38                 int a;
39                 int b;
40                 long c;
41                 a = 10;
42                 b = 10;
43                 c = (long)a * (long)b;
44                 if (c == 100)
45                         return 1;
46                 return 0;
47         }
48
49         public static int test_1_bigmul2 () {
50                 int a = System.Int32.MaxValue, b = System.Int32.MaxValue;
51                 long s = System.Int64.MinValue;
52                 long c;
53                 c = s + (long) a * (long) b;
54                 if (c == -4611686022722355199)
55                         return 1;
56                 return 0;
57         }
58         
59         public static int test_1_bigmul3 () {
60                 int a = 10, b = 10;
61                 ulong c;
62                 c = (ulong) a * (ulong) b;
63                 if (c == 100)
64                         return 1;
65                 return 0;
66         }
67
68         public static int test_1_bigmul4 () {
69                 int a = System.Int32.MaxValue, b = System.Int32.MaxValue;
70                 ulong c;
71                 c = (ulong) a * (ulong) b;
72                 if (c == 4611686014132420609)
73                         return 1;
74                 return 0;
75         }
76         
77         public static int test_1_bigmul5 () {
78                 int a = System.Int32.MaxValue, b = System.Int32.MinValue;
79                 long c;
80                 c = (long) a * (long) b;
81                 if (c == -4611686016279904256)
82                         return 1;
83                 return 0;
84         }
85         
86         public static int test_1_bigmul6 () {
87                 uint a = System.UInt32.MaxValue, b = System.UInt32.MaxValue/(uint)2;
88                 ulong c;
89                 c = (ulong) a * (ulong) b;
90                 if (c == 9223372030412324865)
91                         return 1;
92                 return 0;
93         }
94         
95         public static int test_0_beq () {
96                 long a = 0xffffffffff;
97                 if (a != 0xffffffffff)
98                         return 1;
99                 return 0;
100         }
101
102         public static int test_0_bne_un () {
103                 long a = 0xffffffffff;
104                 if (a == 0xfffffffffe)
105                         return 1;
106                 return 0;
107         }
108
109         public static int test_0_ble () {
110                 long a = 0xffffffffff;
111                 if (a > 0xffffffffff)
112                         return 1;
113                 return 0;
114         }
115
116         public static int test_0_ble_un () {
117                 ulong a = 0xffffffffff;
118                 if (a > 0xffffffffff)
119                         return 1;
120                 return 0;
121         }
122
123         public static int test_0_bge () {
124                 long a = 0xffffffffff;
125                 if (a < 0xffffffffff)
126                         return 1;
127                 return 0;
128         }
129
130         public static int test_0_bge_un () {
131                 ulong a = 0xffffffffff;
132                 if (a < 0xffffffffff)
133                         return 1;
134                 return 0;
135         }
136
137         public static int test_0_blt () {
138                 long a = 0xfffffffffe;
139                 if (a >= 0xffffffffff)
140                         return 1;
141                 return 0;
142         }
143
144         public static int test_0_blt_un () {
145                 ulong a = 0xfffffffffe;
146                 if (a >= 0xffffffffff)
147                         return 1;
148                 return 0;
149         }
150
151         public static int test_0_bgt () {
152                 long a = 0xffffffffff;
153                 if (a <= 0xfffffffffe)
154                         return 1;
155                 return 0;
156         }
157
158         public static int test_0_conv_to_i4 () {
159                 long a = 0;
160
161                 return (int)a;
162         }
163
164         public static int test_32_conv_to_u4 () {
165                 long a = 32;
166
167                 return (int)(uint)a;
168         }
169
170         public static int test_15_conv_to_u4_2 () {
171                 long a = 0x10000000f;
172
173                 return (int)(uint)a;
174         }
175
176         public static int test_0_conv_from_i4 () {
177                 long a = 2;
178                 if (a != 2)
179                         return 1;
180
181                 int b = 2;
182
183                 if (a != b)
184                     return 2;
185                 return 0;
186         }
187
188         public static int test_0_conv_from_i4_negative () {
189                 long a = -2;
190                 if (a != -2)
191                         return 1;
192
193                 int b = -2;
194
195                 if (a != b)
196                     return 2;
197                 return 0;
198         }
199
200         public static int test_0_conv_to_r8 () {
201                 long a = 150;
202                 double b = (double) a;
203
204                 if (b != 150.0)
205                         return 1;
206                 return 0;
207         }
208
209         public static int test_0_conv_to_r4 () {
210                 long a = 3000;
211                 float b = (float) a;
212
213                 if (b != 3000.0F)
214                         return 1;
215                 return 0;
216         }
217         /*
218         public static int test_0_conv_from_r8 () {
219                 double b = 2.0;
220                 long a = (long)b;
221
222                 if (a != 2)
223                         return 1;
224                 return 0;
225         }
226
227         public static int test_0_conv_from_r4 () {
228                 float b = 2.0F;
229                 long a = (long)b;
230
231                 if (a != 2)
232                         return 1;
233                 return 0;
234         }
235         */
236         
237         public static int test_8_and () {
238                 long a = 0xffffffffff;
239                 long b = 8;             
240                 return (int)(a & b);
241         }
242
243         public static int test_8_and_imm () {
244                 long a = 0xffffffffff;
245                 return (int)(a & 8);
246         }
247
248         public static int test_10_or () {
249                 long a = 8;
250                 long b = 2;             
251                 return (int)(a | b);
252         }
253
254         public static int test_10_or_imm () {
255                 long a = 8;
256                 return (int)(a | 2);
257         }
258
259         public static int test_5_xor () {
260                 long a = 7;
261                 long b = 2;             
262                 return (int)(a ^ b);
263         }
264
265         public static int test_5_xor_imm () {
266                 long a = 7;
267                 return (int)(a ^ 2);
268         }
269
270         public static int test_5_add () {
271                 long a = 2;
272                 long b = 3;             
273                 return (int)(a + b);
274         }
275
276         public static int test_5_add_imm () {
277                 long a = 2;
278                 return (int)(a + 3);
279         }
280
281         public static int test_0_add_imm_carry () {
282                 long a = -1;
283                 return (int)(a + 1);
284         }
285
286         public static int test_0_add_imm_no_inc () {
287                 // we can't blindly convert an add x, 1 to an inc x
288                 long a = 0x1ffffffff;
289                 long c;
290                 c = a + 2;
291                 if (c == ((a + 1) + 1))
292                         return 0;
293                 return 1;
294         }
295
296         public static int test_4_addcc_imm () {
297                 long a = 3;
298                 long b = 0;
299                 return (int)(a - b + 1);
300         }
301
302         public static int test_5_sub () {
303                 long a = 8;
304                 long b = 3;             
305                 return (int)(a - b);
306         }
307
308         public static int test_5_sub_imm () {
309                 long a = 8;
310                 return (int)(a - 3);
311         }
312
313         public static int test_0_sub_imm_carry () {
314                 long a = 0;
315                 return (int)((a - 1) + 1);
316         }
317
318         public static int test_0_add_ovf () {
319                 long i, j, k;
320
321                 checked {
322                         i = System.Int64.MinValue;
323                         j = 0;
324                         k = i + j;
325                 }
326
327                 if (k != System.Int64.MinValue)
328                         return 1;
329
330                 checked {
331                         i = System.Int64.MaxValue;
332                         j = 0;
333                         k = i + j;
334                 }
335
336                 if (k != System.Int64.MaxValue)
337                         return 2;
338
339                 checked {
340                         i = System.Int64.MinValue;
341                         j = System.Int64.MaxValue;
342                         k = i + j;
343                 }
344
345                 if (k != -1)
346                         return 3;
347
348                 checked {
349                         i = System.Int64.MaxValue;
350                         j = System.Int64.MinValue;
351                         k = i + j;
352                 }
353
354                 if (k != -1)
355                         return 4;
356
357                 checked {
358                         i = System.Int64.MinValue + 1234;
359                         j = -1234;
360                         k = i + j;
361                 }
362
363                 if (k != System.Int64.MinValue)
364                         return 5;
365
366                 checked {
367                         i = System.Int64.MaxValue - 1234;
368                         j = 1234;
369                         k = i + j;
370                 }
371
372                 if (k != System.Int64.MaxValue)
373                         return 6;
374
375                 return 0;
376         }
377
378         public static int test_0_add_un_ovf () {
379                 ulong n = (ulong)134217728 * 16;
380                 ulong number = checked (n + (uint)0);
381
382                 return number == n ? 0 : 1;
383         }
384
385         public static int test_0_sub_ovf () {
386                 long i, j, k;
387
388                 checked {
389                         i = System.Int64.MinValue;
390                         j = 0;
391                         k = i - j;
392                 }
393
394                 if (k != System.Int64.MinValue)
395                         return 1;
396
397                 checked {
398                         i = System.Int64.MaxValue;
399                         j = 0;
400                         k = i - j;
401                 }
402
403                 if (k != System.Int64.MaxValue)
404                         return 2;
405
406                 checked {
407                         i = System.Int64.MinValue;
408                         j = System.Int64.MinValue + 1234;
409                         k = i - j;
410                 }
411
412                 if (k != -1234)
413                         return 3;
414
415                 checked {
416                         i = System.Int64.MaxValue;
417                         j = 1234;
418                         k = i - j;
419                 }
420
421                 if (k != System.Int64.MaxValue - 1234)
422                         return 4;
423
424                 checked {
425                         i = System.Int64.MaxValue - 1234;
426                         j = -1234;
427                         k = i - j;
428                 }
429
430                 if (k != System.Int64.MaxValue)
431                         return 5;
432
433                 checked {
434                         i = System.Int64.MinValue + 1234;
435                         j = 1234;
436                         k = i - j;
437                 }
438
439                 if (k != System.Int64.MinValue)
440                         return 6;
441
442                 return 0;
443         }
444
445         public static int test_0_sub_ovf_un () {
446                 ulong i, j, k;
447
448                 checked {
449                         i = System.UInt64.MaxValue;
450                         j = 0;
451                         k = i - j;
452                 }
453
454                 if (k != System.UInt64.MaxValue)
455                         return 1;
456
457                 checked {
458                         i = System.UInt64.MaxValue;
459                         j = System.UInt64.MaxValue;
460                         k = i - j;
461                 }
462
463                 if (k != 0)
464                         return 2;
465
466                 return 0;
467         }
468
469         public static int test_2_neg () {
470                 long a = -2;            
471                 return (int)(-a);
472         }       
473
474         public static int test_0_neg_large () {
475                 long min = -9223372036854775808;
476                 unchecked {
477                         ulong ul = (ulong)min;
478                         return (min == -(long)ul) ? 0 : 1;
479                 }
480         }       
481
482         public static int test_5_shift ()
483         {
484                 long a = 9;
485                 int b = 1;
486                 int count = 0;
487                 
488                 if ((a >> b) != 4)
489                         return count;
490                 count++;
491
492                 if ((a >> 63) != 0)
493                         return count;
494                 count++;
495
496                 if ((a << 1) != 18)
497                         return count;
498                 count++;
499
500                 if ((a << b) != 18)
501                         return count;
502                 count++;
503
504                 a = -9;
505                 if ((a >> b) != -5)
506                         return count;
507                 count++;
508
509                 return count;
510         }
511
512         public static int test_1_shift_u ()
513         {
514                 ulong a;
515                 int count = 0;
516
517                 // The JIT optimizes this
518                 a = 8589934592UL;
519                 if ((a >> 32) != 2)
520                         return 0;
521                 count ++;
522
523                 return count;
524         }
525
526         public static int test_1_shift_u_32 ()
527         {
528                 ulong a;
529                 int count = 0;
530
531                 a = UInt64.MaxValue;
532                 // Avoid constant folding
533                 for (int i = 0; i < 32; ++i)
534                         count ++;
535
536                 if ((a >> count) != 0xFFFFFFFFUL)
537                         return 0;
538                 else
539                         return 1;
540         }
541
542         public static int test_1_simple_neg () {
543                 long a = 9;
544                 
545                 if (-a != -9)
546                         return 0;
547                 return 1;
548         }
549
550         public static int test_2_compare () {
551                 long a = 1;
552                 long b = 1;
553                 
554                 if (a != b)
555                         return 0;
556                 return 2;
557         }
558
559         public static int test_9_alu ()
560         {
561                 long a = 9, b = 6;
562                 int count = 0;
563                 
564                 if ((a + b) != 15)
565                         return count;
566                 count++;
567                 
568                 if ((a - b) != 3)
569                         return count;
570                 count++;
571
572                 if ((a & 8) != 8)
573                         return count;
574                 count++;
575
576                 if ((a | 2) != 11)
577                         return count;
578                 count++;
579
580                 if ((a * b) != 54)
581                         return count;
582                 count++;
583                 
584                 if ((a / 4) != 2)
585                         return count;
586                 count++;
587                 
588                 if ((a % 4) != 1)
589                         return count;
590                 count++;
591
592                 if (-a != -9)
593                         return count;
594                 count++;
595
596                 b = -1;
597                 if (~b != 0)
598                         return count;
599                 count++;
600
601                 return count;
602         }
603         
604         public static int test_24_mul () {
605                 long a = 8;
606                 long b = 3;             
607                 return (int)(a * b);
608         }       
609         
610         public static int test_24_mul_ovf () {
611                 long a = 8;
612                 long b = 3;
613                 long res;
614                 
615                 checked {
616                         res = a * b;
617                 }
618                 return (int)res;
619         }       
620
621         public static int test_24_mul_un () {
622                 ulong a = 8;
623                 ulong b = 3;            
624                 return (int)(a * b);
625         }       
626         
627         public static int test_24_mul_ovf_un () {
628                 ulong a = 8;
629                 ulong b = 3;
630                 ulong res;
631                 
632                 checked {
633                         res = a * b;
634                 }
635                 return (int)res;
636         }       
637
638         public static int test_0_mul_imm () {
639             long i = 4;
640
641                 if ((i * 0) != 0)
642                         return 1;
643                 if ((i * 1) != 4)
644                         return 2;
645                 if ((i * 2) != 8)
646                         return 3;
647                 if ((i * 3) != 12)
648                         return 4;
649                 if ((i * 1234) != 4936)
650                         return 5;
651                 if ((i * -1) != -4)
652                         return 6;
653                 if ((i * -2) != -8)
654                         return 7;
655                 if ((i * -3) != -12)
656                         return 8;
657                 if ((i * -1234) != -4936)
658                         return 9;
659
660                 return 0;
661         }
662
663         public static int test_0_mul_imm_opt ()
664         {
665                 long i;
666
667                 i = 1;
668                 if ((i * 2) != 2)
669                         return 1;
670                 i = -1;
671                 if ((i * 2) != -2)
672                         return 2;
673                 i = 1;
674                 if ((i * 3) != 3)
675                         return 3;
676                 i = -1;
677                 if ((i * 3) != -3)
678                         return 4;
679                 i = 1;
680                 if ((i * 5) != 5)
681                         return 5;
682                 i = -1;
683                 if ((i * 5) != -5)
684                         return 6;
685                 i = 1;
686                 if ((i * 6) != 6)
687                         return 7;
688                 i = -1;
689                 if ((i * 6) != -6)
690                         return 8;
691                 i = 1;
692                 if ((i * 9) != 9)
693                         return 9;
694                 i = -1;
695                 if ((i * 9) != -9)
696                         return 10;
697                 i = 1;
698                 if ((i * 10) != 10)
699                         return 11;
700                 i = -1;
701                 if ((i * 10) != -10)
702                         return 12;
703                 i = 1;
704                 if ((i * 12) != 12)
705                         return 13;
706                 i = -1;
707                 if ((i * 12) != -12)
708                         return 14;
709                 i = 1;
710                 if ((i * 25) != 25)
711                         return 15;
712                 i = -1;
713                 if ((i * 25) != -25)
714                         return 16;
715                 i = 1;
716                 if ((i * 100) != 100)
717                         return 17;
718                 i = -1;
719                 if ((i * 100) != -100)
720                         return 18;
721                 
722                 return 0;
723         }
724         
725         public static int test_4_divun () {
726                 uint b = 12;
727                 int a = 3;
728                 return (int)(b / a);
729         }
730
731         public static int test_1431655764_bigdivun_imm () {
732                 unchecked {
733                         uint b = (uint)-2;
734                         return (int)(b / 3);
735                 }
736         }
737
738         public static int test_1431655764_bigdivun () {
739                 unchecked {
740                         uint b = (uint)-2;
741                         int a = 3;
742                         return (int)(b / a);
743                 }
744         }
745
746         public static int test_1_remun () {
747                 uint b = 13;
748                 int a = 3;
749                 return (int)(b % a);
750         }
751
752         public static int test_2_bigremun () {
753                 unchecked {
754                         uint b = (uint)-2;
755                         int a = 3;
756                         return (int)(b % a);
757                 }
758         }
759
760         public static int test_0_ceq () {
761                 long a = 2;
762                 long b = 2;
763                 long c = 3;
764                 long d = 0xff00000002;
765                 
766                 bool val = (a == b); // this should produce a ceq
767                 if (!val)
768                         return 1;
769                 
770                 val = (a == c); // this should produce a ceq
771                 if (val)
772                         return 2;
773                 
774                 val = (a == d); // this should produce a ceq
775                 if (val)
776                         return 3;
777                 
778                 return 0;
779         }
780
781         public static int test_0_ceq_complex () {
782                 long l = 1, ll = 2;
783
784                 if (l < 0 != ll < 0)
785                         return 1;
786
787                 return 0;
788         }
789         
790         public static int test_0_clt () {
791                 long a = 2;
792                 long b = 2;
793                 long c = 3;
794                 long d = 0xff00000002L;
795                 long e = -1;
796                 
797                 bool val = (a < b); // this should produce a clt
798                 if (val)
799                         return 1;
800                 
801                 val = (a < c); // this should produce a clt
802                 if (!val)
803                         return 2;
804                 
805                 val = (c < a); // this should produce a clt
806                 if (val)
807                         return 3;
808                 
809                 val = (e < d); // this should produce a clt
810                 if (!val)
811                         return 4;
812                 
813                 val = (d < e); // this should produce a clt
814                 if (val)
815                         return 5;
816                 
817                 return 0;
818         }
819         
820         public static int test_0_clt_un () {
821                 ulong a = 2;
822                 ulong b = 2;
823                 ulong c = 3;
824                 ulong d = 0xff00000002;
825                 ulong e = 0xffffffffffffffff;
826                 
827                 bool val = (a < b); // this should produce a clt_un
828                 if (val)
829                         return 1;
830                 
831                 val = (a < c); // this should produce a clt_un
832                 if (!val)
833                         return 1;
834                 
835                 val = (d < e); // this should produce a clt_un
836                 if (!val)
837                         return 1;
838                 
839                 val = (e < d); // this should produce a clt_un
840                 if (val)
841                         return 1;
842                 
843                 return 0;
844         }
845
846         public static int test_0_cgt () {
847                 long a = 2;
848                 long b = 2;
849                 long c = 3;
850                 long d = 0xff00000002L;
851                 long e = -1;
852                 
853                 bool val = (a > b); // this should produce a cgt
854                 if (val)
855                         return 1;
856                 
857                 val = (a > c); // this should produce a cgt
858                 if (val)
859                         return 2;
860                 
861                 val = (c > a); // this should produce a cgt
862                 if (!val)
863                         return 3;
864                 
865                 val = (e > d); // this should produce a cgt
866                 if (val)
867                         return 4;
868                 
869                 val = (d > e); // this should produce a cgt
870                 if (!val)
871                         return 5;
872                 
873                 return 0;
874         }
875
876         public static int test_0_cgt_un () {
877                 ulong a = 2;
878                 ulong b = 2;
879                 ulong c = 3;
880                 ulong d = 0xff00000002;
881                 ulong e = 0xffffffffffffffff;
882                 
883                 bool val = (a > b); // this should produce a cgt_un
884                 if (val)
885                         return 1;
886                 
887                 val = (a > c); // this should produce a cgt_un
888                 if (val)
889                         return 1;
890                 
891                 val = (d > e); // this should produce a cgt_un
892                 if (val)
893                         return 1;
894                 
895                 val = (e > d); // this should produce a cgt_un
896                 if (!val)
897                         return 1;
898                 
899                 return 0;
900         }
901
902         static long return_5low () {
903                 return 5;
904         }
905         
906         static long return_5high () {
907                 return 0x500000000;
908         }
909
910         public static int test_3_long_ret () {
911                 long val = return_5low ();
912                 return (int) (val - 2);
913         }
914
915         public static int test_1_long_ret2 () {
916                 long val = return_5high ();
917                 if (val > 0xffffffff)
918                         return 1;
919                 return 0;
920         }
921
922         public static int test_3_byte_cast () {
923                 ulong val = 0xff00ff00f0f0f0f0;
924                 byte b;
925                 b = (byte) (val & 0xFF);
926                 if (b != 0xf0)
927                         return 1;
928
929                 return 3;
930         }
931
932         public static int test_4_ushort_cast () {
933                 ulong val = 0xff00ff00f0f0f0f0;
934                 ushort b;
935                 b = (ushort) (val & 0xFFFF);
936                 if (b != 0xf0f0)
937                         return 1;
938                 return 4;
939         }
940
941         public static int test_500_mul_div () {
942                 long val = 1000;
943                 long exp = 10;
944                 long maxexp = 20;
945                 long res = val * exp / maxexp;
946
947                 return (int)res;
948         }
949         
950         static void doit (double value, out long m) {
951                 m = (long) value;
952         }
953         
954         public static int test_3_checked_cast_un () {
955                 ulong i = 2;
956                 long j;
957
958                 checked { j = (long)i; }
959
960                 if (j != 2)
961                         return 0;
962                 return 3;
963         }
964         
965         public static int test_4_checked_cast () {
966                 long i = 3;
967                 ulong j;
968
969                 checked { j = (ulong)i; }
970
971                 if (j != 3)
972                         return 0;
973                 return 4;
974         }
975
976         public static int test_12_checked_i1_cast () {
977                 long l = 12;
978
979                 checked {
980                         return (sbyte)l;
981                 }
982         }
983
984         public static int test_127_checked_i1_cast_un () {
985                 ulong l = 127;
986
987                 checked {
988                         return (sbyte)l;
989                 }
990         }
991
992         public static int test_1234_checked_i2_cast () {
993                 long l = 1234;
994
995                 checked {
996                         return (short)l;
997                 }
998         }
999
1000         public static int test_32767_checked_i2_cast_un () {
1001                 ulong l = 32767;
1002
1003                 checked {
1004                         return (ushort)l;
1005                 }
1006         }
1007
1008         public static int test_1234_checked_i4_cast () {
1009                 ulong ul = 1234;
1010
1011                 checked {
1012                         return (int)ul;
1013                 }
1014         }
1015
1016         public static int test_10_int_uint_compare () {
1017                 uint size = 10;
1018                 int j = 0;
1019                 for (int i = 0; i < size; ++i) {
1020                         j++;
1021                 }
1022                 return j;
1023         }
1024
1025         public static int test_0_ftol_clobber () {
1026                 long m;
1027                 doit (1.3, out m);
1028                 if (m != 1)
1029                         return 2;
1030                 return 0;
1031         }
1032
1033         public static int test_0_ulong_regress () {
1034                 ulong u = 4257145737;
1035                 u --;
1036                 return (u == 4257145736) ? 0 : 1;
1037         }
1038         
1039         public static int test_0_assemble_long ()
1040         {
1041                 uint a = 5;
1042                 ulong x = 0x12345678;
1043                 ulong y = 1;
1044                 
1045                 
1046                 ulong z = ((x - y) << 32) | a;
1047                 
1048                 if (z != 0x1234567700000005)
1049                         return 1;
1050                 
1051                 return 0;
1052         }
1053         
1054         public static int test_0_hash ()
1055         {
1056                 ulong x = 0x1234567887654321;
1057                 int h = (int)(x & 0xffffffff) ^ (int)(x >> 32);
1058                 if (h != unchecked ((int)(0x87654321 ^ 0x12345678)))
1059                         return h;
1060                 return 0;
1061                                 
1062         }
1063
1064         public static int test_0_shift_regress () {
1065                 long a = 0; 
1066                 int b = 6; 
1067                 UInt16 c = 3;
1068
1069                 return ((a >> (b - c)) == 0) ? 0 : 1;
1070         }
1071
1072         public static int test_1234_conv_ovf_u8 () {
1073                 int i = 1234;
1074
1075                 checked {
1076                         ulong l = (ulong)i;
1077                         return (int)l;
1078                 }
1079         }
1080 }
1081