In corlib/System.Runtime.InteropServices:
[mono.git] / mono / mini / iltests.il
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         .method static public int32 test_0_tail_calls () il managed {
490                 .maxstack 16
491                 .locals init (
492                         valuetype Tests/TailCallStruct arg
493                 )
494                 ldloca 0
495                 ldc.i4.2
496                 stfld int32 Tests/TailCallStruct::a
497                 ldloca 0
498                 ldc.i4.4
499                 stfld int32 Tests/TailCallStruct::b
500                 ldloc.0
501                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
502                 stloc.0
503                 ldloca 0
504                 ldfld int32 Tests/TailCallStruct::a
505                 ldloca 0
506                 ldfld int32 Tests/TailCallStruct::b
507                 add
508                 ldc.i4 9
509                 sub
510                 ret
511         }
512
513         .method static public int32 tail3 (int32 i, int32 j) il managed {
514                 ldarg.0
515                 ldarg.1
516                 add
517                 ret
518         }
519
520         .method static public int32 tail4 (int32 i, int32 j) il managed {
521                 .maxstack 16
522                 .locals init (
523                         int32 k)
524
525                 // Test arg0 allocated to a register
526                 ldarg.0
527                 ldarg.0
528                 ldarg.0
529                 ldarg.0
530                 add
531                 add
532                 add
533                 starg 0
534
535                 // Test switched up argument variables as the actual arguments
536                 ldarg.1
537                 ldarg.0
538                 tail.
539                 call int32 Tests::tail3 (int32, int32)
540                 ret
541         }
542
543         .method static public int32 test_24_tail_calls2 () il managed {
544                 .maxstack 16
545                 .locals init (
546                         int32 i,
547                         int32 j)
548
549                 ldc.i4.4
550                 stloc.0
551                 ldc.i4.8
552                 stloc.1
553
554                 ldloc.0 
555                 ldloc.1
556                 call int32 Tests::tail4 (int32, int32)
557                 ret
558         }
559
560         .method public static int32 test_5_jmp () cil managed {
561                 jmp int32 Tests::jmp2 ()
562                 ldc.i4.0
563                 ret
564         }
565
566         .method public static int32 jmp2 () cil managed {
567                 ldc.i4.5
568                 ret
569         }               
570
571         .method static public int32 test_11_switch_with_nonempty_stack () il managed {
572                 .maxstack 16
573
574                 ldc.i4.5
575                 ldc.i4.6
576                 ldc.i4.1
577                 switch (L0, L1)
578         L0: 
579                 add
580                 ret
581         L1:
582                 add
583                 ret
584         }
585  
586     .method public static int32 test_5_endfinally_with_nonempty_stack () il managed {
587                 .maxstack 16
588
589         .try {
590           leave IL_0
591         }
592         finally  {
593           ldc.i4.0
594           endfinally
595         }
596         IL_0:  ldc.i4.5
597                 ret
598     }
599
600         .method public static int32 test_0_conv_ovf_i8_neg () il managed {
601                 .maxstack 16
602
603                 ldc.i4.m1
604                 conv.ovf.i8
605                 conv.i4
606                 ldc.i4.m1
607                 beq L_OK
608                 ldc.i4.1
609                 ret
610         L_OK:
611                 ldc.i4.0
612                 ret
613         }               
614
615         .method public static int32 test_1234_conv_u4 () cil managed {
616                 .maxstack 16
617
618                 ldc.i4 1234
619                 conv.u4
620                 conv.i4
621                 ret
622         }
623
624         .method public static int32 test_2_lconv_to_ovf_i4_un () cil managed {
625                 .maxstack 16
626                 .locals init (int32 res)
627
628                 ldc.i4 0x7fffffff
629                 conv.u8
630                 conv.ovf.i4.un
631                 pop
632
633                 ldc.i4.2
634                 stloc res
635
636         .try {
637                         ldc.i8 0x80000000
638                         conv.ovf.i4.un
639                         pop
640                         ldc.i4.0
641                         stloc res
642                         leave RET
643                 } catch [mscorlib]System.OverflowException {
644                         pop
645                         leave IL_0
646                 }
647
648         IL_0:
649
650         .try {
651                         ldc.i8 0xffffffff80000000
652                         conv.ovf.i4.un
653                         pop
654                         ldc.i4.1
655                         stloc res
656                         leave RET
657                 } catch [mscorlib]System.OverflowException {
658                         pop
659                         leave RET
660                 }
661
662         RET:
663                 ldloc res
664                 ret
665         }
666
667     .method public static int32 test_1_lconv_to_ovf_i_un () cil managed {
668                 .maxstack 16
669                 .locals init (int32 res)
670
671                 ldc.i4 0x7fffffff
672                 conv.u8
673                 conv.ovf.i.un
674                 conv.i4
675                 pop
676
677                 ldc.i4.1
678                 ret
679         }
680
681         .method public static int32 test_32_lconv_to_u8 () cil managed
682         {
683                 .maxstack 16
684
685                 ldc.i4 32
686                 conv.i8
687                 conv.u8
688                 conv.i4
689                 ret
690         }                               
691
692         .method public static int32 test_32_lconv_to_i8 () cil managed
693         {
694                 .maxstack 16
695
696                 ldc.i4 32
697                 conv.i8
698                 conv.i8
699                 conv.i4
700                 ret
701         }                               
702
703         .method public static int32 test_15_lconv_to_u () cil managed
704         {
705         ldc.i8 0x10000000f
706                 conv.u
707                 conv.i4
708                 ret
709         }
710
711         .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
712         {
713                 .maxstack 16
714         
715                 ldc.i4.1
716                 brfalse OBJECT
717         
718                 ldtoken [mscorlib]System.String
719                 br AFTER
720         OBJECT:
721                 ldtoken [mscorlib]System.Object
722         AFTER:
723                 call class [mscorlib]'System.Type' class [mscorlib]'System.Type'::'GetTypeFromHandle'(valuetype [mscorlib]'System.RuntimeTypeHandle')
724                 callvirt instance string class [mscorlib]System.Type::get_FullName ()
725                 ldstr "System.String"
726                 callvirt instance bool class [mscorlib]System.Object::Equals(object)
727                 ldc.i4.0
728                 ceq
729                 ret 
730         }
731                 
732         .method public static int32 test_0_bug59580  ()
733         {
734                 ldc.r4          float32(0x7FC00000)
735                 ldc.r4          float32(0x7FC00000)
736                 bge.un          pass
737                 br              fail
738         pass:
739                 ldc.i4.0
740                 ret
741         fail:
742                 ldc.i4.1
743                 ret
744         }
745         
746         .method public static int32 test_1_bug60056  () {
747                 .locals init (int32 m5)
748                         
749                 ldc.i4.m1
750                 stloc.0
751                 
752                 ldc.i4.1
753                 conv.u8
754                 
755                 ldloc.0
756                 conv.i8
757                 mul
758                 
759                 ldc.i4.m1
760                 conv.i8
761                 ceq
762                 ret
763         }
764         
765         .method public static int32 test_1_conv_u8_cfold  () {
766                 ldc.i4.m1
767                 conv.u8
768                 
769                 ldc.i8 0x00000000ffffffff
770                 
771                 ceq
772                 ret
773         }
774         
775         .method public static int32 test_1_array_type_mismatch_ldelema  () {
776                 .locals init (int32 r)
777                 
778                         ldc.i4.1
779                         newarr string
780                         ldc.i4.0 
781                         ldelema string
782                         pop
783                 
784                 .try {
785                         ldc.i4.1
786                         newarr string
787                         ldc.i4.0 
788                         ldelema object
789                         pop
790                         
791                         leave end
792                 } catch [mscorlib]System.ArrayTypeMismatchException {
793                         pop
794                         ldc.i4.1
795                         stloc.0
796                         leave end
797                 }
798         end:
799                 ldloc.0
800                 ret
801         }
802
803         .method public static int32 test_1_conv_ovf_i8_with_i4 () {
804                         ldc.i4.m1 
805                         conv.ovf.i8
806                         conv.ovf.i4
807                         neg
808                         ret
809         }
810
811         // bug #72148
812     .method public static int32 test_0_initlocals_float_ptr () {
813         .maxstack 3
814         .locals init (
815                 float32[]       V_0,
816                 float32& pinned V_1,
817                 unsigned int32  V_2)
818                         ldc.i4.s 0x0f
819                         newarr [mscorlib]System.Single
820                         stloc.0 
821                         ldloc.0 
822                         ldc.i4.0 
823                         ldc.r4 1.13
824                         stelem.r4 
825                         ldloc.0 
826                         ldc.i4.0 
827                         ldelema [mscorlib]System.Single
828                         stloc.1 
829                         ldloc.1 
830                         conv.i 
831                         ldind.u4 
832                         stloc.2 
833                         ldc.i4.0
834                         ret
835         }
836
837         .method public static int32 test_7_conv_ovf_u8_un () {
838         .maxstack  2
839         .locals    init (unsigned int64)
840
841         ldc.i4.7
842         conv.ovf.u8.un
843         stloc.0
844                 ldloc.0
845                 conv.i4
846         ret
847         }
848
849         .method public static int32 test_1_bug_74591 () {
850                 .maxstack 16
851                 .locals init (int32)
852
853                 ldc.i4.m1
854                 stloc.0
855                 ldloc.0
856                 conv.ovf.i8
857                 ldc.i4.m1
858                 conv.ovf.i8
859                 mul.ovf
860                 conv.i4
861                 ret
862         }
863
864         .class nested public auto ansi Integer
865                 extends [mscorlib]System.Object {
866
867                 .field public bool n
868
869             .method public hidebysig  specialname  rtspecialname 
870            instance default void .ctor (unsigned int64 i, bool n)  cil managed 
871             {
872                         .maxstack 8
873                         ldarg.0
874                         call instance void class [mscorlib]System.Object::.ctor()
875                         ldarg.0
876                         ldarg.2
877                         stfld bool Tests/Integer::n
878                         ret
879                 }
880         }
881
882         .method public static int32 test_1_bug_74726 () {
883                 .maxstack 16
884
885                 ldc.i4.2
886                 conv.ovf.u8
887                 ldc.i4.1
888                 conv.ovf.u8
889                 mul.ovf.un
890                 ldc.i4.1
891                 newobj instance void class Tests/Integer::.ctor(unsigned int64, bool)
892                 ldfld bool Tests/Integer::n
893                 ldc.i4.1
894                 ceq
895                 ret
896         }
897
898         .class nested private auto ansi sealed xxx
899         extends [mscorlib]System.ValueType
900    {
901      .field  public   object a
902
903      .method public hidebysig  specialname  rtspecialname 
904             instance default void .ctor ()  cil managed 
905      {
906                  .maxstack 8
907                  ret 
908      }
909    } // end of class xxx
910
911         .method public static int32 test_0_newobj_vtype () {
912                 .maxstack 6
913                 .locals init (
914                         valuetype Tests/xxx V_0
915                 )
916
917                 newobj instance void valuetype Tests/xxx::.ctor ()
918                 stloc.0
919                 ldloca.s 0
920                 ldfld object Tests/xxx::a
921                 brfalse OK
922                 ldc.i4.s 1
923                 ret
924         OK:
925                 ldc.i4.s 0
926                 ret
927         }
928
929         .method public static int32 test_1_filters () {
930                 .maxstack 16
931                 .locals init (
932                         int32 res
933                 )
934
935                 .try { // 0
936                         .try {
937                                 ldstr "OnErrorSub test Exception"
938                                 newobj instance void class [mscorlib]System.Exception::.ctor(string)
939                                 throw 
940                                 leave.s IL_0033
941                         }
942                         filter {
943                                 pop
944                                 ldc.i4.0
945                                 endfilter
946                         } {
947                                 pop
948                                 // Should not be called
949                                 ldc.i4.2
950                                 stloc res
951                                 leave.s IL_0033
952                         }
953                 }
954                 filter {
955                         pop
956                         ldc.i4.1
957                         endfilter 
958                 } {
959                   pop
960                   ldc.i4.1
961                   stloc res       
962                   leave.s IL_0033
963
964                 }
965                 IL_0033:
966                 ldloc res
967                 ret
968         }
969
970         .class nested private auto ansi sealed beforefieldinit TheStruct
971                 extends [mscorlib]System.ValueType {
972                 .field public int32 a
973                 .field public int32 b
974         }
975
976         .method public static int32 test_5_cpobj () {
977                 .maxstack 8
978                 .locals init (  
979                                 valuetype Tests/TheStruct v_0, 
980                                 valuetype Tests/TheStruct v_1
981                                          )
982
983                 ldloca v_0
984                 ldc.i4.2
985                 stfld int32 Tests/TheStruct::a
986
987                 ldloca v_0
988                 ldc.i4.3
989                 stfld int32 Tests/TheStruct::b
990
991                 ldloca v_1
992                 ldloca v_0
993                 cpobj Tests/TheStruct
994
995                 ldloca v_1
996                 ldfld int32 Tests/TheStruct::a
997                 ldloca v_1
998                 ldfld int32 Tests/TheStruct::b
999                 add
1000
1001                 ret
1002         }
1003
1004         .method public static int32 test_5_ldobj_stloc_optimization () {
1005                 .maxstack 8
1006                 .locals init (  
1007                                 valuetype Tests/TheStruct v_0, 
1008                                 valuetype Tests/TheStruct v_1
1009                                          )
1010
1011                 ldloca v_0
1012                 ldc.i4.2
1013                 stfld int32 Tests/TheStruct::a
1014
1015                 ldloca v_0
1016                 ldc.i4.3
1017                 stfld int32 Tests/TheStruct::b
1018
1019                 ldloca v_0
1020                 ldobj valuetype Tests/TheStruct
1021                 stloc.s v_1
1022
1023                 ldloca v_1
1024                 ldfld int32 Tests/TheStruct::a
1025                 ldloca v_1
1026                 ldfld int32 Tests/TheStruct::b
1027                 add
1028
1029                 ret
1030         }
1031
1032         .method public static int32 test_1_cpobj_reference () {
1033                 .maxstack 8
1034                 .locals init (  
1035                                 object v_0, 
1036                                 object v_1
1037                                          )
1038
1039                 newobj instance void object::.ctor()
1040                 stloc v_0
1041
1042                 ldloca v_1
1043                 ldloca v_0
1044                 cpobj object
1045
1046                 ldloc v_0
1047                 ldloc v_1
1048                 ceq
1049                 ret
1050         }
1051
1052         .method public static int32 test_1_initobj_reference () {
1053                 .maxstack 8
1054                 .locals init (  
1055                                 object v_0
1056                                          )
1057
1058                 newobj instance void object::.ctor()
1059                 stloc v_0
1060
1061                 ldloca v_0
1062                 initobj object
1063
1064                 ldloc v_0
1065                 ldnull
1066                 ceq
1067                 ret
1068         }
1069
1070         .method public static int32 test_1_ldobj_reference () {
1071                 .maxstack 8
1072                 .locals init (  
1073                                 object v_0
1074                                          )
1075
1076                 newobj instance void object::.ctor()
1077                 stloc v_0
1078
1079                 ldloc v_0
1080                 ldloca v_0
1081                 ldobj object
1082                 ceq
1083                 ret
1084         }
1085
1086         .method public static int32 test_5_vtype_on_bb_boundary () {
1087                 .maxstack 8
1088                 .locals init (  
1089                                 valuetype Tests/TheStruct v_0, 
1090                                 valuetype Tests/TheStruct v_1
1091                                          )
1092
1093                 ldloca v_0
1094                 ldc.i4.2
1095                 stfld int32 Tests/TheStruct::a
1096
1097                 ldloca v_0
1098                 ldc.i4.3
1099                 stfld int32 Tests/TheStruct::b
1100
1101                 ldloc v_0
1102                 br L_0
1103         L_0: stloc v_1
1104
1105                 ldloca v_1
1106                 ldfld int32 Tests/TheStruct::a
1107                 ldloca v_1
1108                 ldfld int32 Tests/TheStruct::b
1109                 add
1110                 ret
1111         }
1112
1113         .method public static int32 test_5_different_in_stacks () cil managed {
1114                 .maxstack 16
1115
1116                         ldc.i4.1
1117                         ldc.i4.1
1118                         beq L_0
1119
1120                         ldc.i4.3
1121                         ldc.i4.3
1122                         br L_1
1123                         ldc.i4.3
1124                         ldc.i4.3
1125                         br L_2
1126          L_0:   ldc.i4.2
1127                         ldc.i4.3
1128                         ldc.i4.1
1129                         ldc.i4.1
1130                         beq L_2
1131          L_1:   add
1132                         ret
1133          L_2:   add
1134                         ret
1135         }
1136
1137         .method public static int32 test_3_larray_get_set () {
1138                 .locals init (
1139                         int32[2]        V_0)
1140                           
1141                         ldc.i4.2 
1142                         newobj instance void int32[0...]::.ctor(int32)
1143                         stloc.0 
1144                         ldloc.0 
1145                         ldc.i4.0 
1146                         ldc.i4 1
1147                         call instance void int32[0...]::Set(int32, int32)
1148                     ldloc.0 
1149                     ldc.i4.1 
1150                         ldc.i4 2
1151                         call instance void int32[0...]::Set(int32, int32)
1152
1153                         ldloc.0
1154                         ldc.i4.0
1155                         call instance int32 int32[0...]::Get(int32)
1156                         ldloc.0
1157                         ldc.i4.1
1158                         call instance int32 int32[0...]::Get(int32)
1159                         add
1160                         ret
1161         }
1162
1163         .method public static int32 test_0_pop_side_effects () {
1164                 .try {
1165                         ldc.r8 1
1166                         ldc.r8 0
1167                         div
1168                         ckfinite
1169                         pop
1170                         leave FAIL
1171                 }
1172                 catch [mscorlib]System.ArithmeticException {
1173                         pop
1174                         leave L_0
1175                 }
1176                 L_0:
1177                 ldc.i4.0
1178                 ret
1179                 FAIL:
1180                 ldc.i4.1
1181                 ret
1182         }
1183
1184         .method public static void regalloc_regress_78314_helper (object o) cil managed
1185         {
1186                 ret
1187         }
1188
1189         .method public static int32 test_1_regalloc_regress_78314 () cil managed
1190         {
1191     // Code size       68 (0x44)
1192     .maxstack  6
1193     .locals init (int32 V_0, bool V_1)
1194     IL_0000:  ldc.i4.0
1195     IL_0001:  stloc.0
1196     IL_0002:  br.s       IL_003b
1197
1198     IL_0004:
1199     IL_001e:  ldc.i4.s   10
1200     IL_0020:  ldloc.0
1201     IL_0021:  shl
1202     IL_0022:  ldc.i4.s   10
1203     IL_0024:  ldloc.0
1204     IL_0025:  shl
1205     IL_0026:  ceq
1206     IL_0028:  box        [mscorlib]System.Boolean
1207     IL_0032:  call       void Tests::regalloc_regress_78314_helper(object)
1208     IL_0037:  ldloc.0
1209     IL_0038:  ldc.i4.1
1210     IL_0039:  add
1211     IL_003a:  stloc.0
1212     IL_003b:  ldloc.0
1213     IL_003c:  ldc.i4.8
1214     IL_003f:  blt.s      IL_0004
1215
1216         ldloc.0
1217         ldc.i4.8
1218         ceq
1219         conv.i4
1220         ret     
1221   }
1222
1223         .method public static void try_block_end_remove_if_useless () cil managed {
1224             .maxstack  8
1225
1226             T_START:
1227                 ldstr   "Start"
1228                         pop
1229                 leave.s COMPLETE
1230             T1_END:
1231
1232             COMPLETE:
1233                 ret
1234
1235             F1_START:
1236                 ldstr   "Finally1"
1237                         pop
1238                 endfinally
1239             F1_END:
1240
1241             .try T_START to T1_END finally handler F1_START to F1_END
1242         }
1243
1244         .method public static int32 test_0_try_block_end_remove_if_useless () cil managed {
1245                 call void class Tests::try_block_end_remove_if_useless ()
1246                 ldc.i4.0
1247                 ret
1248         }
1249
1250    .method private static int32 test_0_regress_78629_switch_next_ins_target ()  cil managed
1251     {
1252         ldc.i4.0
1253         switch (target)
1254         target: ldstr "bar"
1255                 pop
1256                 ldc.i4.0
1257         ret
1258     }
1259
1260         // This belongs to basic-float.cs, but its hard to tell mcs/csc to
1261         // generate the non .un version of the opcodes
1262     .method private static  hidebysig 
1263            default int32 test_4_float_branch_nan ()  cil managed 
1264     {
1265         // Method begins at RVA 0x27a4
1266         // Code size 74 (0x4a)
1267         .maxstack 2
1268         .locals init (
1269                 float64 V_0,
1270                 float64 V_1,
1271                 int32   V_2)
1272         IL_0000:  ldc.r8 (00 00 00 00 00 00 f8 ff)
1273         IL_0009:  stloc.0 
1274         IL_000a:  ldc.r8 1.
1275         IL_0013:  stloc.1 
1276         IL_0014:  ldc.i4.0 
1277         IL_0015:  stloc.2 
1278         IL_0016:  ldloc.0 
1279         IL_0017:  ldloc.1 
1280         IL_0018:  bge.s IL_001a
1281
1282                                 br L1
1283         IL_001a:  ldloc.2 
1284         IL_001b:  ret 
1285         L1:
1286         IL_001c:  ldloc.2 
1287         IL_001d:  ldc.i4.1 
1288         IL_001e:  add 
1289         IL_001f:  stloc.2 
1290         IL_0020:  ldloc.0 
1291         IL_0021:  ldloc.1 
1292         IL_0022:  ble.s IL_002e
1293                                 br L2
1294         IL_002e:  ldloc.2 
1295         IL_002f:  ret 
1296         L2:
1297         IL_0030:  ldloc.2 
1298         IL_0031:  ldc.i4.1 
1299         IL_0032:  add 
1300         IL_0033:  stloc.2 
1301         IL_0034:  ldloc.0 
1302         IL_0035:  ldloc.1 
1303         IL_0036:  blt.s IL_0038
1304                                 br L3           
1305         IL_0038:  ldloc.2 
1306         IL_0039:  ret 
1307         L3:
1308         IL_003a:  ldloc.2 
1309         IL_003b:  ldc.i4.1 
1310         IL_003c:  add 
1311         IL_003d:  stloc.2 
1312         IL_003e:  ldloc.0 
1313         IL_003f:  ldloc.1 
1314         IL_0040:  bgt.s IL_0042
1315                                 br L4
1316         IL_0042:  ldloc.2 
1317         IL_0043:  ret 
1318         L4:
1319         IL_0044:  ldloc.2 
1320         IL_0045:  ldc.i4.1 
1321         IL_0046:  add 
1322         IL_0047:  stloc.2 
1323         IL_0048:  ldloc.2 
1324         IL_0049:  ret 
1325     } // end of method Tests::test_5_float_branch_nan
1326
1327     .method private static  hidebysig
1328            default void regress_80622_inner (object x)  cil managed
1329     {
1330                 .locals (unsigned int8 i)
1331         // Method begins at RVA 0x2050
1332         // Code size 14 (0xe)
1333         .maxstack 8
1334         IL_1000:  ldarg.0
1335         IL_1001:  unbox unsigned int8
1336         IL_1006:  ldobj unsigned int8
1337         IL_000b:  conv.ovf.i4.un
1338         IL_000c:  pop
1339         IL_000d:  ret
1340     }
1341
1342     // method line 2
1343     .method private static  hidebysig
1344            default int32 test_0_regress_80622 ()  cil managed
1345     {
1346         .maxstack 8
1347         IL_0000:  ldc.i4 255
1348         IL_0005:  box unsigned int8
1349         IL_000a:  call void class Tests::regress_80622_inner (object)
1350                 ldc.i4.0
1351         IL_000f:  ret
1352     }
1353
1354         .method private static default int32 test_0_regresss_80190 () cil managed
1355         {
1356             .maxstack  2
1357             .locals init (int32 V_0,
1358                      int32* V_1)
1359             IL_0000:  nop
1360             IL_0001:  nop
1361             IL_0002:  ldloca.s   V_0
1362             IL_0004:  conv.u
1363             IL_0005:  stloc.1
1364             IL_0006:  ldloc.1
1365             IL_0007:  ldc.i4.3
1366             IL_0008:  stind.i4
1367             IL_0009:  nop
1368                                   ldc.i4.0
1369                                   ret
1370         }
1371
1372 }