2007-11-28 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / iltests.il.in
1 .assembly iltests {}
2 .assembly extern TestDriver {}
3 .assembly extern mscorlib {}
4
5 .class public auto ansi sealed beforefieldinit Tests {
6
7         .method static public int32 Main(string[] args) il managed {
8                 .entrypoint
9                 
10                 ldtoken Tests
11                 call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
12                 ldarg.0
13                 call       int32 [TestDriver]TestDriver::RunTests(class [mscorlib]System.Type, string[])
14                 ret
15         }
16
17         // make sure the register allocator works when the return value of
18         // 'div' is discarded
19         .method static public int32 test_0_div_regalloc () il managed {
20                 .locals init (
21                         int32 i
22                 )
23
24                 ldloc 0
25                 ldc.i4.s 0xa
26                 div
27                 pop
28                 ldc.i4.0
29                 ret
30         }
31         
32         
33         .method static public int32 test_1_ceq_to_i4 () il managed {
34                 .locals init (
35                         int32   foo
36                 )
37                 ldc.i4 500
38                 stloc foo
39                 ldloc foo
40                 ldc.i4 500
41                 ceq
42                 stloc foo
43                 ldloc foo
44                 ret
45         }
46         
47         .method static public int32 test_3_shl_regvars () il managed {
48                 .locals init (
49                         int32   a,
50                         int32   b,
51                         int32   r1,
52                         int32   r2,
53                         int32   r3
54                 )
55                         
56                 ldc.i4.2
57                 stloc      a
58                 ldc.i4.1
59                 stloc      b
60         
61                 ldloc      a
62                 ldloc      b
63                 shl 
64                 stloc      r1
65                 
66                 ldloc      a
67                 ldloc      b
68                 shl 
69                 stloc      r2
70                 
71                 ldloc      a
72                 ldloc      b
73                 shl 
74                 stloc      r3
75                 
76                 ldloc      r1
77                 ldc.i4.4
78                 ceq
79                 
80                 ldloc      r2
81                 ldc.i4.4
82                 ceq
83                 
84                 ldloc      r3
85                 ldc.i4.4
86                 ceq
87                 
88                 add
89                 add
90                 
91                 ret
92         }
93         
94         .method static public int32 test_1_fceq_to_i4 () il managed {
95         
96                 .locals init (
97                         float64 foo,
98                         int32   val
99                 )
100
101                 ldc.r8      2
102                 stloc       foo
103                 
104                 ldloc       foo
105                 ldc.r8      2
106                 ceq
107                 stloc       val
108                 
109                 ldloc       val
110                 ret
111         }
112
113         //
114         // This should be manually checked. Basically under -O=linears,
115         // you should not see tons of register spilling.
116         //
117         .method static public int32 test_1_bytedreg_free () il managed {
118                 .locals init (
119                         int32   foo
120                 )
121                 ldc.i4 500
122                 stloc foo
123                 ldloc foo
124                 ldc.i4 500
125                 ceq
126                 stloc foo
127                 
128                 ldloc foo
129                 ldc.i4 1
130                 ceq
131                 stloc foo
132
133                 ldloc foo
134                 ldc.i4 1
135                 ceq
136                 stloc foo
137
138                 ldloc foo
139                 ldc.i4 1
140                 ceq
141                 stloc foo
142                 
143                 ldloc foo
144                 ldc.i4 1
145                 ceq
146                 stloc foo
147                 
148                 ldloc foo
149                 ret
150         }
151         
152         //
153         // This should be manually checked. Basically under -O=linears,
154         // you should not see tons of register spilling.
155         //
156         .method static public int32 test_0_bytesreg1_free () il managed {
157                 .locals init (
158                         unsigned int8      dest,
159                         int32              src,
160                         unsigned int8&     pdest
161                 )
162
163                 ldloca     dest
164                 stloc      pdest
165                 
166                 ldloc      pdest
167                 ldloc      src
168                 stind.i1
169                 
170                 ldloc      pdest
171                 ldloc      src
172                 stind.i1
173                 
174                 ldloc      pdest
175                 ldloc      src
176                 stind.i1
177                 
178                 ldloc      pdest
179                 ldloc      src
180                 stind.i1
181                 
182                 ldloc      pdest
183                 ldloc      src
184                 stind.i1
185                 
186                 ldloc      pdest
187                 ldloc      src
188                 stind.i1
189                 
190                 ldloc      pdest
191                 ldind.i1
192                 ret
193         }
194         
195         .method static public int32 test_1_shift_regvar () il managed {
196         
197                 .locals init (
198                         int32   v7FFFFFFF,
199                         int32   v1
200                 )
201                 
202                 ldc.i4  0x7FFFFFFF
203                 stloc   v7FFFFFFF
204         
205                 ldc.i4.1
206                 stloc v1
207                 
208                 ldloc   v7FFFFFFF
209                 ldloc   v1
210                 shl
211                 ldc.i4  0xFFFFFFFE
212                 ceq
213                 ret
214         }
215         
216         // this only happens with the managed pointer, not an unmanaged one.
217         .method static public int32 test_0_foo () il managed {
218         
219                 .locals init (
220                         int32&  buf
221                 )
222                 
223                 ldc.i4.5
224                 localloc
225                 
226                 stloc buf
227                 ldloc buf
228                 
229                 ldind.i4
230                 
231                 ret
232         }
233
234         .method static public int32 test_0_localloc () cil managed {
235                 .locals init (native int, native int, native int, native int, int32)
236
237                 ldc.i4 6
238                 localloc
239                 conv.i
240                 stloc.0
241
242                 ldc.i4 6
243                 localloc
244                 conv.i
245                 stloc.1
246
247                 ldc.i4 6
248                 localloc
249                 conv.i
250                 stloc.2
251
252                 // Variable length
253                 ldc.i4 128
254                 stloc.s 4
255                 ldloc.s 4
256                 localloc
257                 conv.i
258                 stloc.3
259
260                 // Check zero initialized
261                 ldloc.0
262                 ldind.i4
263                 ldc.i4.0
264                 beq OK1
265                 ldc.i4.1
266                 br FAIL
267
268 OK1:
269                 ldloc.3
270                 ldind.i4
271                 ldc.i4.0
272                 beq OK2
273                 ldc.i4.2
274                 br FAIL
275
276 OK2:
277                 ldloc.3
278                 ldc.i4.s 124
279                 add
280                 ldind.i4
281                 ldc.i4.0
282                 beq OK3
283                 ldc.i4.3
284                 br FAIL
285
286 OK3:
287                 ldloc.1
288                 ldc.i4 999999
289                 stind.i4
290                 ldloc.1
291                 ldind.i4
292                 ldc.i4 999999
293                 beq OK4
294                 ldc.i4.4
295                 br FAIL
296
297 OK4:
298                 ldloc.0
299                 ldc.i4 999999
300                 stind.i4
301                 ldloc.0
302                 ldind.i4
303                 ldc.i4 999999
304                 beq OK5
305                 ldc.i4.5
306                 br FAIL
307
308 OK5:
309                 // Try allocations bigger than one page
310                 ldc.i4 8196
311                 localloc
312                 conv.i
313                 stloc.3
314                 ldloc.3
315                 ldc.i4 8192
316                 add
317                 ldc.i4 99
318                 stind.i4
319                 ldloc.3
320                 ldc.i4 8192
321                 add
322                 ldind.i4
323                 ldc.i4 99
324                 beq PASS
325                 ldc.i4.6
326                 br FAIL
327
328 FAIL:
329                 ret
330
331 PASS:   ldc.i4.0
332                 ret
333         }
334
335     .method private static void do_localloc () cil managed {
336         .maxstack 3
337         .locals init (
338                 unsigned int8*  V_0)
339         IL_0000:  ldc.i4.1
340         IL_0001:  ldc.i4 131072
341         IL_0006:  mul
342         IL_0007:  localloc
343         IL_0009:  stloc.0
344         IL_000a:  ret
345     }
346
347         // Check that localloc can't be inlined
348         .method static public int32 test_0_localloc_inline () cil managed {
349                 .maxstack 16
350                 .locals init (
351                         int32 i
352                 )
353
354                 ldc.i4.0
355         stloc.0
356         br COND
357
358 START:  call void class Tests::do_localloc()
359         ldloc.0
360         ldc.i4.1
361         add
362         stloc.0
363 COND:   ldloc.0
364         ldc.i4 1000
365         blt START
366
367                 ldc.i4.0
368                 ret
369         }       
370         
371         .method static public int32 test_3_copy_used_bug () il managed {
372
373                 .locals init (
374                         int32 size,
375                         int32 res
376                 )
377
378                 ldc.i4 0
379                 stloc res
380
381                 ldc.i4 1
382                 stloc size
383
384                 ldloc size
385                 ldloc size
386                 ldloc size
387                 add
388                 stloc size
389                 ldloc size
390                 add
391                 stloc res
392
393                 ldloc res
394                 ret
395         }
396
397         // demonstrate that the copy_used_var is not a fix for the above bug
398         .method static public int32 test_3_copy_used_indir_bug () il managed {
399
400                 .locals init (
401                         int32 size,
402                         int32 res
403                 )
404
405                 ldc.i4 0
406                 stloc res
407
408                 ldc.i4 1
409                 stloc size
410
411                 ldloc size
412                 ldloca size
413                 ldloc size
414                 ldloc size
415                 add
416                 stind.i4
417                 ldloc size
418                 add
419                 stloc res
420
421                 ldloc res
422                 ret
423         }
424
425         .method static public void do_nothing (int32 a) il managed {
426                 ret
427         }
428         
429         // demonstrate the block_split failure: needs -O=inline
430         // mini -O=inline --compile Tests:test_0_split_block_bug iltests.exe
431         .method static public int32 test_0_split_block_bug () il managed {
432
433                 .locals init (
434                         int32 i1
435                 )
436
437                 ldc.i4 1
438                 stloc i1
439  test_label:
440                 ldloc i1
441                 call void class Tests::do_nothing (int32)
442                 ldc.i4 0
443                 brtrue test_label
444                 
445                 ldc.i4 0
446                 ret
447         }
448
449         .method public void inline_do_nothing () il managed {
450                 ret
451         }
452         .method static public int32 test_1_checkthis_inlining () il managed {
453                 ldnull
454                 call instance void class Tests::inline_do_nothing ()
455                 ldc.i4 1
456                 ret
457         }
458
459         .class nested private auto ansi sealed beforefieldinit TailCallStruct 
460                 extends [mscorlib]System.ValueType {
461                 .field public int32 a
462                 .field public int32 b
463         }
464
465         .method static valuetype Tests/TailCallStruct tail1 (valuetype Tests/TailCallStruct arg) {
466                 ldarga 0
467                 ldarga 0
468                 ldfld int32 Tests/TailCallStruct::a
469                 ldc.i4.1
470                 add
471                 stfld int32 Tests/TailCallStruct::a
472                 ldarga 0
473                 ldarga 0
474                 ldfld int32 Tests/TailCallStruct::a
475                 ldc.i4.2
476                 add
477                 stfld int32 Tests/TailCallStruct::a
478                 ldarg.0
479                 ret
480         }
481
482         .method static valuetype Tests/TailCallStruct tail2 (valuetype Tests/TailCallStruct arg) {
483                 ldarg.0
484                 tail.
485                 call valuetype Tests/TailCallStruct Tests::tail1 (valuetype Tests/TailCallStruct)
486                 ret
487         }
488
489 #if arch != __ppc__
490         //
491         // Tail calls are not supported on PowerPC.
492         // 
493         .method static public int32 test_0_tail_calls () il managed {
494                 .maxstack 16
495                 .locals init (
496                         valuetype Tests/TailCallStruct arg
497                 )
498                 ldloca 0
499                 ldc.i4.2
500                 stfld int32 Tests/TailCallStruct::a
501                 ldloca 0
502                 ldc.i4.4
503                 stfld int32 Tests/TailCallStruct::b
504                 ldloc.0
505                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
506                 stloc.0
507                 ldloca 0
508                 ldfld int32 Tests/TailCallStruct::a
509                 ldloca 0
510                 ldfld int32 Tests/TailCallStruct::b
511                 add
512                 ldc.i4 9
513                 sub
514                 ret
515         }
516
517         .method static public int32 tail3 (int32 i, int32 j) il managed {
518                 ldarg.0
519                 ldarg.1
520                 add
521                 ret
522         }
523
524         .method static public int32 tail4 (int32 i, int32 j) il managed {
525                 .maxstack 16
526                 .locals init (
527                         int32 k)
528
529                 // Test arg0 allocated to a register
530                 ldarg.0
531                 ldarg.0
532                 ldarg.0
533                 ldarg.0
534                 add
535                 add
536                 add
537                 starg 0
538
539                 // Test switched up argument variables as the actual arguments
540                 ldarg.1
541                 ldarg.0
542                 tail.
543                 call int32 Tests::tail3 (int32, int32)
544                 ret
545         }
546
547         .method static public int32 test_24_tail_calls2 () il managed {
548                 .maxstack 16
549                 .locals init (
550                         int32 i,
551                         int32 j)
552
553                 ldc.i4.4
554                 stloc.0
555                 ldc.i4.8
556                 stloc.1
557
558                 ldloc.0 
559                 ldloc.1
560                 call int32 Tests::tail4 (int32, int32)
561                 ret
562         }
563 #endif
564
565         .method public static int32 test_5_jmp () cil managed {
566                 jmp int32 Tests::jmp2 ()
567                 ldc.i4.0
568                 ret
569         }
570
571         .method public static int32 jmp2 () cil managed {
572                 ldc.i4.5
573                 ret
574         }               
575
576         .method static public int32 test_11_switch_with_nonempty_stack () il managed {
577                 .maxstack 16
578
579                 ldc.i4.5
580                 ldc.i4.6
581                 ldc.i4.1
582                 switch (L0, L1)
583         L0: 
584                 add
585                 ret
586         L1:
587                 add
588                 ret
589         }
590  
591     .method public static int32 test_5_endfinally_with_nonempty_stack () il managed {
592                 .maxstack 16
593
594         .try {
595           leave IL_0
596         }
597         finally  {
598           ldc.i4.0
599           endfinally
600         }
601         IL_0:  ldc.i4.5
602                 ret
603     }
604
605         .method public static int32 test_0_conv_ovf_i8_neg () il managed {
606                 .maxstack 16
607
608                 ldc.i4.m1
609                 conv.ovf.i8
610                 conv.i4
611                 ldc.i4.m1
612                 beq L_OK
613                 ldc.i4.1
614                 ret
615         L_OK:
616                 ldc.i4.0
617                 ret
618         }               
619
620         .method public static int32 test_1234_conv_u4 () cil managed {
621                 .maxstack 16
622
623                 ldc.i4 1234
624                 conv.u4
625                 conv.i4
626                 ret
627         }
628
629         .method public static int32 test_2_lconv_to_ovf_i4_un () cil managed {
630                 .maxstack 16
631                 .locals init (int32 res)
632
633                 ldc.i4 0x7fffffff
634                 conv.u8
635                 conv.ovf.i4.un
636                 pop
637
638                 ldc.i4.2
639                 stloc res
640
641         .try {
642                         ldc.i8 0x80000000
643                         conv.ovf.i4.un
644                         pop
645                         ldc.i4.0
646                         stloc res
647                         leave RET
648                 } catch [mscorlib]System.OverflowException {
649                         pop
650                         leave IL_0
651                 }
652
653         IL_0:
654
655         .try {
656                         ldc.i8 0xffffffff80000000
657                         conv.ovf.i4.un
658                         pop
659                         ldc.i4.1
660                         stloc res
661                         leave RET
662                 } catch [mscorlib]System.OverflowException {
663                         pop
664                         leave RET
665                 }
666
667         RET:
668                 ldloc res
669                 ret
670         }
671
672     .method public static int32 test_1_lconv_to_ovf_i_un () cil managed {
673                 .maxstack 16
674                 .locals init (int32 res)
675
676                 ldc.i4 0x7fffffff
677                 conv.u8
678                 conv.ovf.i.un
679                 conv.i4
680                 pop
681
682                 ldc.i4.1
683                 ret
684         }
685
686         .method public static int32 test_32_lconv_to_u8 () cil managed
687         {
688                 .maxstack 16
689
690                 ldc.i4 32
691                 conv.i8
692                 conv.u8
693                 conv.i4
694                 ret
695         }                               
696
697         .method public static int32 test_32_lconv_to_i8 () cil managed
698         {
699                 .maxstack 16
700
701                 ldc.i4 32
702                 conv.i8
703                 conv.i8
704                 conv.i4
705                 ret
706         }                               
707
708         .method public static int32 test_15_lconv_to_u () cil managed
709         {
710         ldc.i8 0x10000000f
711                 conv.u
712                 conv.i4
713                 ret
714         }
715
716         .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
717         {
718                 .maxstack 16
719         
720                 ldc.i4.1
721                 brfalse OBJECT
722         
723                 ldtoken [mscorlib]System.String
724                 br AFTER
725         OBJECT:
726                 ldtoken [mscorlib]System.Object
727         AFTER:
728                 call class [mscorlib]'System.Type' class [mscorlib]'System.Type'::'GetTypeFromHandle'(valuetype [mscorlib]'System.RuntimeTypeHandle')
729                 callvirt instance string class [mscorlib]System.Type::get_FullName ()
730                 ldstr "System.String"
731                 callvirt instance bool class [mscorlib]System.Object::Equals(object)
732                 ldc.i4.0
733                 ceq
734                 ret 
735         }
736                 
737         .method public static int32 test_0_bug59580  ()
738         {
739                 ldc.r4          float32(0x7FC00000)
740                 ldc.r4          float32(0x7FC00000)
741                 bge.un          pass
742                 br              fail
743         pass:
744                 ldc.i4.0
745                 ret
746         fail:
747                 ldc.i4.1
748                 ret
749         }
750         
751         .method public static int32 test_1_bug60056  () {
752                 .locals init (int32 m5)
753                         
754                 ldc.i4.m1
755                 stloc.0
756                 
757                 ldc.i4.1
758                 conv.u8
759                 
760                 ldloc.0
761                 conv.i8
762                 mul
763                 
764                 ldc.i4.m1
765                 conv.i8
766                 ceq
767                 ret
768         }
769         
770         .method public static int32 test_1_conv_u8_cfold  () {
771                 ldc.i4.m1
772                 conv.u8
773                 
774                 ldc.i8 0x00000000ffffffff
775                 
776                 ceq
777                 ret
778         }
779         
780         .method public static int32 test_1_array_type_mismatch_ldelema  () {
781                 .locals init (int32 r)
782                 
783                         ldc.i4.1
784                         newarr string
785                         ldc.i4.0 
786                         ldelema string
787                         pop
788                 
789                 .try {
790                         ldc.i4.1
791                         newarr string
792                         ldc.i4.0 
793                         ldelema object
794                         pop
795                         
796                         leave end
797                 } catch [mscorlib]System.ArrayTypeMismatchException {
798                         pop
799                         ldc.i4.1
800                         stloc.0
801                         leave end
802                 }
803         end:
804                 ldloc.0
805                 ret
806         }
807
808         .method public static int32 test_1_conv_ovf_i8_with_i4 () {
809                         ldc.i4.m1 
810                         conv.ovf.i8
811                         conv.ovf.i4
812                         neg
813                         ret
814         }
815
816         // bug #72148
817     .method public static int32 test_0_initlocals_float_ptr () {
818         .maxstack 3
819         .locals init (
820                 float32[]       V_0,
821                 float32& pinned V_1,
822                 unsigned int32  V_2)
823                         ldc.i4.s 0x0f
824                         newarr [mscorlib]System.Single
825                         stloc.0 
826                         ldloc.0 
827                         ldc.i4.0 
828                         ldc.r4 1.13
829                         stelem.r4 
830                         ldloc.0 
831                         ldc.i4.0 
832                         ldelema [mscorlib]System.Single
833                         stloc.1 
834                         ldloc.1 
835                         conv.i 
836                         ldind.u4 
837                         stloc.2 
838                         ldc.i4.0
839                         ret
840         }
841
842         .method public static int32 test_7_conv_ovf_u8_un () {
843         .maxstack  2
844         .locals    init (unsigned int64)
845
846         ldc.i4.7
847         conv.ovf.u8.un
848         stloc.0
849                 ldloc.0
850                 conv.i4
851         ret
852         }
853
854         .method public static int32 test_1_bug_74591 () {
855                 .maxstack 16
856                 .locals init (int32)
857
858                 ldc.i4.m1
859                 stloc.0
860                 ldloc.0
861                 conv.ovf.i8
862                 ldc.i4.m1
863                 conv.ovf.i8
864                 mul.ovf
865                 conv.i4
866                 ret
867         }
868
869         .class nested public auto ansi Integer
870                 extends [mscorlib]System.Object {
871
872                 .field public bool n
873
874             .method public hidebysig  specialname  rtspecialname 
875            instance default void .ctor (unsigned int64 i, bool n)  cil managed 
876             {
877                         .maxstack 8
878                         ldarg.0
879                         call instance void class [mscorlib]System.Object::.ctor()
880                         ldarg.0
881                         ldarg.2
882                         stfld bool Tests/Integer::n
883                         ret
884                 }
885         }
886
887         .method public static int32 test_1_bug_74726 () {
888                 .maxstack 16
889
890                 ldc.i4.2
891                 conv.ovf.u8
892                 ldc.i4.1
893                 conv.ovf.u8
894                 mul.ovf.un
895                 ldc.i4.1
896                 newobj instance void class Tests/Integer::.ctor(unsigned int64, bool)
897                 ldfld bool Tests/Integer::n
898                 ldc.i4.1
899                 ceq
900                 ret
901         }
902
903         .class nested private auto ansi sealed xxx
904         extends [mscorlib]System.ValueType
905    {
906      .field  public   object a
907
908      .method public hidebysig  specialname  rtspecialname 
909             instance default void .ctor ()  cil managed 
910      {
911                  .maxstack 8
912                  ret 
913      }
914    } // end of class xxx
915
916         .method public static int32 test_0_newobj_vtype () {
917                 .maxstack 6
918                 .locals init (
919                         valuetype Tests/xxx V_0
920                 )
921
922                 newobj instance void valuetype Tests/xxx::.ctor ()
923                 stloc.0
924                 ldloca.s 0
925                 ldfld object Tests/xxx::a
926                 brfalse OK
927                 ldc.i4.s 1
928                 ret
929         OK:
930                 ldc.i4.s 0
931                 ret
932         }
933
934         .method public static int32 test_1_filters () {
935                 .maxstack 16
936                 .locals init (
937                         int32 res
938                 )
939
940                 .try { // 0
941                         .try {
942                                 ldstr "OnErrorSub test Exception"
943                                 newobj instance void class [mscorlib]System.Exception::.ctor(string)
944                                 throw 
945                                 leave.s IL_0033
946                         }
947                         filter {
948                                 pop
949                                 ldc.i4.0
950                                 endfilter
951                         } {
952                                 pop
953                                 // Should not be called
954                                 ldc.i4.2
955                                 stloc res
956                                 leave.s IL_0033
957                         }
958                 }
959                 filter {
960                         pop
961                         ldc.i4.1
962                         endfilter 
963                 } {
964                   pop
965                   ldc.i4.1
966                   stloc res       
967                   leave.s IL_0033
968
969                 }
970                 IL_0033:
971                 ldloc res
972                 ret
973         }
974
975         .class nested private auto ansi sealed beforefieldinit TheStruct
976                 extends [mscorlib]System.ValueType {
977                 .field public int32 a
978                 .field public int32 b
979         }
980
981         .method public static int32 test_5_cpobj () {
982                 .maxstack 8
983                 .locals init (  
984                                 valuetype Tests/TheStruct v_0, 
985                                 valuetype Tests/TheStruct v_1
986                                          )
987
988                 ldloca v_0
989                 ldc.i4.2
990                 stfld int32 Tests/TheStruct::a
991
992                 ldloca v_0
993                 ldc.i4.3
994                 stfld int32 Tests/TheStruct::b
995
996                 ldloca v_1
997                 ldloca v_0
998                 cpobj Tests/TheStruct
999
1000                 ldloca v_1
1001                 ldfld int32 Tests/TheStruct::a
1002                 ldloca v_1
1003                 ldfld int32 Tests/TheStruct::b
1004                 add
1005
1006                 ret
1007         }
1008
1009         .method public static int32 test_5_ldobj_stloc_optimization () {
1010                 .maxstack 8
1011                 .locals init (  
1012                                 valuetype Tests/TheStruct v_0, 
1013                                 valuetype Tests/TheStruct v_1
1014                                          )
1015
1016                 ldloca v_0
1017                 ldc.i4.2
1018                 stfld int32 Tests/TheStruct::a
1019
1020                 ldloca v_0
1021                 ldc.i4.3
1022                 stfld int32 Tests/TheStruct::b
1023
1024                 ldloca v_0
1025                 ldobj valuetype Tests/TheStruct
1026                 stloc.s v_1
1027
1028                 ldloca v_1
1029                 ldfld int32 Tests/TheStruct::a
1030                 ldloca v_1
1031                 ldfld int32 Tests/TheStruct::b
1032                 add
1033
1034                 ret
1035         }
1036
1037         .method public static int32 test_1_cpobj_reference () {
1038                 .maxstack 8
1039                 .locals init (  
1040                                 object v_0, 
1041                                 object v_1
1042                                          )
1043
1044                 newobj instance void object::.ctor()
1045                 stloc v_0
1046
1047                 ldloca v_1
1048                 ldloca v_0
1049                 cpobj object
1050
1051                 ldloc v_0
1052                 ldloc v_1
1053                 ceq
1054                 ret
1055         }
1056
1057         .method public static int32 test_1_initobj_reference () {
1058                 .maxstack 8
1059                 .locals init (  
1060                                 object v_0
1061                                          )
1062
1063                 newobj instance void object::.ctor()
1064                 stloc v_0
1065
1066                 ldloca v_0
1067                 initobj object
1068
1069                 ldloc v_0
1070                 ldnull
1071                 ceq
1072                 ret
1073         }
1074
1075         .method public static int32 test_1_ldobj_reference () {
1076                 .maxstack 8
1077                 .locals init (  
1078                                 object v_0
1079                                          )
1080
1081                 newobj instance void object::.ctor()
1082                 stloc v_0
1083
1084                 ldloc v_0
1085                 ldloca v_0
1086                 ldobj object
1087                 ceq
1088                 ret
1089         }
1090
1091         .method public static int32 test_5_vtype_on_bb_boundary () {
1092                 .maxstack 8
1093                 .locals init (  
1094                                 valuetype Tests/TheStruct v_0, 
1095                                 valuetype Tests/TheStruct v_1
1096                                          )
1097
1098                 ldloca v_0
1099                 ldc.i4.2
1100                 stfld int32 Tests/TheStruct::a
1101
1102                 ldloca v_0
1103                 ldc.i4.3
1104                 stfld int32 Tests/TheStruct::b
1105
1106                 ldloc v_0
1107                 br L_0
1108         L_0: stloc v_1
1109
1110                 ldloca v_1
1111                 ldfld int32 Tests/TheStruct::a
1112                 ldloca v_1
1113                 ldfld int32 Tests/TheStruct::b
1114                 add
1115                 ret
1116         }
1117
1118         .method public static int32 test_5_different_in_stacks () cil managed {
1119                 .maxstack 16
1120
1121                         ldc.i4.1
1122                         ldc.i4.1
1123                         beq L_0
1124
1125                         ldc.i4.3
1126                         ldc.i4.3
1127                         br L_1
1128                         ldc.i4.3
1129                         ldc.i4.3
1130                         br L_2
1131          L_0:   ldc.i4.2
1132                         ldc.i4.3
1133                         ldc.i4.1
1134                         ldc.i4.1
1135                         beq L_2
1136          L_1:   add
1137                         ret
1138          L_2:   add
1139                         ret
1140         }
1141
1142         .method public static int32 test_3_larray_get_set () {
1143                 .locals init (
1144                         int32[2]        V_0)
1145                           
1146                         ldc.i4.2 
1147                         newobj instance void int32[0...]::.ctor(int32)
1148                         stloc.0 
1149                         ldloc.0 
1150                         ldc.i4.0 
1151                         ldc.i4 1
1152                         call instance void int32[0...]::Set(int32, int32)
1153                     ldloc.0 
1154                     ldc.i4.1 
1155                         ldc.i4 2
1156                         call instance void int32[0...]::Set(int32, int32)
1157
1158                         ldloc.0
1159                         ldc.i4.0
1160                         call instance int32 int32[0...]::Get(int32)
1161                         ldloc.0
1162                         ldc.i4.1
1163                         call instance int32 int32[0...]::Get(int32)
1164                         add
1165                         ret
1166         }
1167
1168         .method public static int32 test_0_pop_side_effects () {
1169                 .try {
1170                         ldc.r8 1
1171                         ldc.r8 0
1172                         div
1173                         ckfinite
1174                         pop
1175                         leave FAIL
1176                 }
1177                 catch [mscorlib]System.ArithmeticException {
1178                         pop
1179                         leave L_0
1180                 }
1181                 L_0:
1182                 ldc.i4.0
1183                 ret
1184                 FAIL:
1185                 ldc.i4.1
1186                 ret
1187         }
1188
1189         .method public static void regalloc_regress_78314_helper (object o) cil managed
1190         {
1191                 ret
1192         }
1193
1194         .method public static int32 test_1_regalloc_regress_78314 () cil managed
1195         {
1196     // Code size       68 (0x44)
1197     .maxstack  6
1198     .locals init (int32 V_0, bool V_1)
1199     IL_0000:  ldc.i4.0
1200     IL_0001:  stloc.0
1201     IL_0002:  br.s       IL_003b
1202
1203     IL_0004:
1204     IL_001e:  ldc.i4.s   10
1205     IL_0020:  ldloc.0
1206     IL_0021:  shl
1207     IL_0022:  ldc.i4.s   10
1208     IL_0024:  ldloc.0
1209     IL_0025:  shl
1210     IL_0026:  ceq
1211     IL_0028:  box        [mscorlib]System.Boolean
1212     IL_0032:  call       void Tests::regalloc_regress_78314_helper(object)
1213     IL_0037:  ldloc.0
1214     IL_0038:  ldc.i4.1
1215     IL_0039:  add
1216     IL_003a:  stloc.0
1217     IL_003b:  ldloc.0
1218     IL_003c:  ldc.i4.8
1219     IL_003f:  blt.s      IL_0004
1220
1221         ldloc.0
1222         ldc.i4.8
1223         ceq
1224         conv.i4
1225         ret     
1226   }
1227
1228         .method public static void try_block_end_remove_if_useless () cil managed {
1229             .maxstack  8
1230
1231             T_START:
1232                 ldstr   "Start"
1233                         pop
1234                 leave.s COMPLETE
1235             T1_END:
1236
1237             COMPLETE:
1238                 ret
1239
1240             F1_START:
1241                 ldstr   "Finally1"
1242                         pop
1243                 endfinally
1244             F1_END:
1245
1246             .try T_START to T1_END finally handler F1_START to F1_END
1247         }
1248
1249         .method public static int32 test_0_try_block_end_remove_if_useless () cil managed {
1250                 call void class Tests::try_block_end_remove_if_useless ()
1251                 ldc.i4.0
1252                 ret
1253         }
1254
1255    .method private static int32 test_0_regress_78629_switch_next_ins_target ()  cil managed
1256     {
1257         ldc.i4.0
1258         switch (target)
1259         target: ldstr "bar"
1260                 pop
1261                 ldc.i4.0
1262         ret
1263     }
1264
1265         // This belongs to basic-float.cs, but its hard to tell mcs/csc to
1266         // generate the non .un version of the opcodes
1267     .method private static  hidebysig 
1268            default int32 test_4_float_branch_nan ()  cil managed 
1269     {
1270         // Method begins at RVA 0x27a4
1271         // Code size 74 (0x4a)
1272         .maxstack 2
1273         .locals init (
1274                 float64 V_0,
1275                 float64 V_1,
1276                 int32   V_2)
1277         IL_0000:  ldc.r8 (00 00 00 00 00 00 f8 ff)
1278         IL_0009:  stloc.0 
1279         IL_000a:  ldc.r8 1.
1280         IL_0013:  stloc.1 
1281         IL_0014:  ldc.i4.0 
1282         IL_0015:  stloc.2 
1283         IL_0016:  ldloc.0 
1284         IL_0017:  ldloc.1 
1285         IL_0018:  bge.s IL_001a
1286
1287                                 br L1
1288         IL_001a:  ldloc.2 
1289         IL_001b:  ret 
1290         L1:
1291         IL_001c:  ldloc.2 
1292         IL_001d:  ldc.i4.1 
1293         IL_001e:  add 
1294         IL_001f:  stloc.2 
1295         IL_0020:  ldloc.0 
1296         IL_0021:  ldloc.1 
1297         IL_0022:  ble.s IL_002e
1298                                 br L2
1299         IL_002e:  ldloc.2 
1300         IL_002f:  ret 
1301         L2:
1302         IL_0030:  ldloc.2 
1303         IL_0031:  ldc.i4.1 
1304         IL_0032:  add 
1305         IL_0033:  stloc.2 
1306         IL_0034:  ldloc.0 
1307         IL_0035:  ldloc.1 
1308         IL_0036:  blt.s IL_0038
1309                                 br L3           
1310         IL_0038:  ldloc.2 
1311         IL_0039:  ret 
1312         L3:
1313         IL_003a:  ldloc.2 
1314         IL_003b:  ldc.i4.1 
1315         IL_003c:  add 
1316         IL_003d:  stloc.2 
1317         IL_003e:  ldloc.0 
1318         IL_003f:  ldloc.1 
1319         IL_0040:  bgt.s IL_0042
1320                                 br L4
1321         IL_0042:  ldloc.2 
1322         IL_0043:  ret 
1323         L4:
1324         IL_0044:  ldloc.2 
1325         IL_0045:  ldc.i4.1 
1326         IL_0046:  add 
1327         IL_0047:  stloc.2 
1328         IL_0048:  ldloc.2 
1329         IL_0049:  ret 
1330     } // end of method Tests::test_5_float_branch_nan
1331
1332     .method private static  hidebysig
1333            default void regress_80622_inner (object x)  cil managed
1334     {
1335                 .locals (unsigned int8 i)
1336         // Method begins at RVA 0x2050
1337         // Code size 14 (0xe)
1338         .maxstack 8
1339         IL_1000:  ldarg.0
1340         IL_1001:  unbox unsigned int8
1341         IL_1006:  ldobj unsigned int8
1342         IL_000b:  conv.ovf.i4.un
1343         IL_000c:  pop
1344         IL_000d:  ret
1345     }
1346
1347     // method line 2
1348     .method private static  hidebysig
1349            default int32 test_0_regress_80622 ()  cil managed
1350     {
1351         .maxstack 8
1352         IL_0000:  ldc.i4 255
1353         IL_0005:  box unsigned int8
1354         IL_000a:  call void class Tests::regress_80622_inner (object)
1355                 ldc.i4.0
1356         IL_000f:  ret
1357     }
1358
1359         .method private static default int32 test_0_regresss_80190 () cil managed
1360         {
1361             .maxstack  2
1362             .locals init (int32 V_0,
1363                      int32* V_1)
1364             IL_0000:  nop
1365             IL_0001:  nop
1366             IL_0002:  ldloca.s   V_0
1367             IL_0004:  conv.u
1368             IL_0005:  stloc.1
1369             IL_0006:  ldloc.1
1370             IL_0007:  ldc.i4.3
1371             IL_0008:  stind.i4
1372             IL_0009:  nop
1373                                   ldc.i4.0
1374                                   ret
1375         }
1376
1377 }