2010-04-13 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         .class nested private auto ansi sealed beforefieldinit TailCallStructBig
490                 extends [mscorlib]System.ValueType {
491                 .field public int32 a
492                 .field public int32 b
493                 .field public int32 c
494                 .field public int32 d
495                 .field public int32 e
496         }
497
498         .method static valuetype Tests/TailCallStructBig tail_vret_by_addr_inner (valuetype Tests/TailCallStructBig arg) {
499                 ldarga 0
500                 ldarga 0
501                 ldfld int32 Tests/TailCallStructBig::a
502                 ldc.i4.1
503                 add
504                 stfld int32 Tests/TailCallStructBig::a
505                 ldarg.0
506                 ret
507         }
508
509         .method static valuetype Tests/TailCallStructBig tail_vret_by_addr (valuetype Tests/TailCallStructBig arg) {
510                 ldarg.0
511                 tail.
512                 call valuetype Tests/TailCallStructBig Tests::tail_vret_by_addr_inner (valuetype Tests/TailCallStructBig)
513                 ret
514         }
515
516         .method static public int32 test_3_tail_call_vret_by_addr () il managed {
517                 .maxstack 16
518                 .locals init (
519                         valuetype Tests/TailCallStructBig arg2
520                 )
521
522                 ldloca 0
523                 ldc.i4.2
524                 stfld int32 Tests/TailCallStructBig::a
525                 ldloc.0
526                 call valuetype Tests/TailCallStructBig Tests::tail_vret_by_addr (valuetype Tests/TailCallStructBig)
527                 stloc.0
528
529                 ldloca 0
530                 ldfld int32 Tests/TailCallStructBig::a
531                 ret
532         }
533
534         .method static public int32 test_9_tail_call_vret_by_val () il managed {
535                 .maxstack 16
536                 .locals init (
537                         valuetype Tests/TailCallStruct arg
538                 )
539                 ldloca 0
540                 ldc.i4.2
541                 stfld int32 Tests/TailCallStruct::a
542                 ldloca 0
543                 ldc.i4.4
544                 stfld int32 Tests/TailCallStruct::b
545                 ldloc.0
546                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
547                 stloc.0
548
549                 ldloca 0
550                 ldfld int32 Tests/TailCallStruct::a
551                 ldloca 0
552                 ldfld int32 Tests/TailCallStruct::b
553                 add
554                 ret
555         }
556
557         .method static public int32 tail3 (int32 i, int32 j) il managed {
558                 ldarg.0
559                 ldarg.1
560                 add
561                 ret
562         }
563
564         .method static public int32 tail4 (int32 i, int32 j) il managed {
565                 .maxstack 16
566                 .locals init (
567                         int32 k)
568
569                 // Test arg0 allocated to a register
570                 ldarg.0
571                 ldarg.0
572                 ldarg.0
573                 ldarg.0
574                 add
575                 add
576                 add
577                 starg 0
578
579                 // Test switched up argument variables as the actual arguments
580                 ldarg.1
581                 ldarg.0
582                 tail.
583                 call int32 Tests::tail3 (int32, int32)
584                 ret
585         }
586
587         .method static public int32 test_24_tail_calls2 () il managed {
588                 .maxstack 16
589                 .locals init (
590                         int32 i,
591                         int32 j)
592
593                 ldc.i4.4
594                 stloc.0
595                 ldc.i4.8
596                 stloc.1
597
598                 ldloc.0 
599                 ldloc.1
600                 call int32 Tests::tail4 (int32, int32)
601                 ret
602         }
603
604         .method public static int32 test_5_jmp () cil managed {
605                 ldc.i4.1
606                 ldc.i4.2
607                 call int32 Tests::jmp2 (int32, int32)
608                 ret
609         }
610
611         .method public static int32 jmp2 (int32, int32) cil managed {
612                 ldarg.0
613                 ldc.i4.1
614                 add
615                 starg.s 0
616                 ldarg.1
617                 ldc.i4.1
618                 add
619                 starg.s 1
620                 jmp int32 Tests::jmp3 (int32, int32)
621                 ldc.i4.0
622                 ret
623         }               
624
625         .method public static int32 jmp3 (int32 i, int32 j) cil managed {
626                 ldarg.0
627                 ldarg.1
628                 add
629                 ret
630         }
631
632         .method static public int32 test_11_switch_with_nonempty_stack () il managed {
633                 .maxstack 16
634
635                 ldc.i4.5
636                 ldc.i4.6
637                 ldc.i4.1
638                 switch (L0, L1)
639         L0: 
640                 add
641                 ret
642         L1:
643                 add
644                 ret
645         }
646  
647     .method public static int32 test_5_endfinally_with_nonempty_stack () il managed {
648                 .maxstack 16
649
650         .try {
651           leave IL_0
652         }
653         finally  {
654           ldc.i4.0
655           endfinally
656         }
657         IL_0:  ldc.i4.5
658                 ret
659     }
660
661         .method public static int32 test_0_conv_ovf_i8_neg () il managed {
662                 .maxstack 16
663
664                 ldc.i4.m1
665                 conv.ovf.i8
666                 conv.i4
667                 ldc.i4.m1
668                 beq L_OK
669                 ldc.i4.1
670                 ret
671         L_OK:
672                 ldc.i4.0
673                 ret
674         }               
675
676         .method public static int32 test_1234_conv_u4 () cil managed {
677                 .maxstack 16
678
679                 ldc.i4 1234
680                 conv.u4
681                 conv.i4
682                 ret
683         }
684
685         .method public static int32 test_0_conv_ovf_i_un () cil managed {
686                 .maxstack 16
687
688                 ldc.i4 1234
689                 conv.ovf.i.un
690                 conv.i4
691                 ldc.i4 1234
692                 beq L1
693                 ldc.i4.1
694                 ret
695         L1:
696                 ldc.i4 0x7fffffff
697                 conv.ovf.i.un
698                 conv.i4
699                 ldc.i4 0x7fffffff
700                 beq L2
701                 ldc.i4.2
702                 ret
703         L2:
704                 sizeof [mscorlib]System.IntPtr
705                 ldc.i4 8
706                 beq L5
707                 .try {
708                         ldc.i4 0x80000000
709                         conv.ovf.i.un
710                         leave L4
711                 } catch [mscorlib]System.OverflowException {
712                         pop
713                         leave L5
714                 }
715         L4: 
716                 ldc.i4.3
717                 ret
718         L5:
719                 ldc.i4.0
720                 ret
721         }
722
723         .method public static int32 test_0_conv_ovf_u_un () cil managed {
724                 .maxstack 16
725
726                 ldc.i4 1234
727                 conv.ovf.u.un
728                 conv.i4
729                 ldc.i4 1234
730                 beq L1
731                 ldc.i4.1
732                 ret
733         L1:
734                 ldc.i4.0
735                 ret
736         }
737
738         .method public static int32 test_0_conv_ovf_i () cil managed {
739                 .maxstack 16
740
741                 ldc.i4 1234
742                 conv.ovf.i
743                 conv.i4
744                 ldc.i4 1234
745                 beq L1
746                 ldc.i4.1
747                 ret
748         L1:
749                 ldc.i4.0
750                 ret
751         }
752
753         .method public static int32 test_0_conv_ovf_u () cil managed {
754                 .maxstack 16
755
756                 ldc.i4 1234
757                 conv.ovf.u
758                 conv.i4
759                 ldc.i4 1234
760                 beq L1
761                 ldc.i4.1
762                 ret
763         L1:
764                 ldc.i4.0
765                 ret
766         }
767
768         .method public static int32 test_1234_conv_ovf_i8_un () cil managed {
769                 .maxstack 16
770
771                 ldc.i4 1234
772                 conv.ovf.i8.un
773                 conv.i4
774                 ret
775         }
776
777         .method public static int32 test_0_lconv_ovf_i () cil managed {
778                 .maxstack 16
779
780                 ldc.i4 1234
781                 conv.i8
782                 conv.ovf.i
783                 conv.i4
784                 ldc.i4 1234
785                 beq L1
786                 ldc.i4.1
787                 ret
788         L1:
789                 ldc.i4.0
790                 ret
791         }
792
793         .method public static int32 test_0_lconv_ovf_u () cil managed {
794                 .maxstack 16
795
796                 ldc.i4 1234
797                 conv.i8
798                 conv.ovf.u
799                 conv.i4
800                 ldc.i4 1234
801                 beq L1
802                 ldc.i4.1
803                 ret
804         L1:
805                 ldc.i4.0
806                 ret
807         }
808
809         .method public static int32 test_0_lconv_ovf_i_un () cil managed {
810                 .maxstack 16
811
812                 ldc.i4 1234
813                 conv.i8
814                 conv.ovf.i.un
815                 conv.i4
816                 ldc.i4 1234
817                 beq L1
818                 ldc.i4.1
819                 ret
820         L1:
821                 ldc.i4.0
822                 ret
823         }
824
825         .method public static int32 test_0_lconv_ovf_u_un () cil managed {
826                 .maxstack 16
827
828                 ldc.i4 1234
829                 conv.i8
830                 conv.ovf.u.un
831                 conv.i4
832                 ldc.i4 1234
833                 beq L1
834                 ldc.i4.1
835                 ret
836         L1:
837                 ldc.i4.0
838                 ret
839         }
840
841         .method public static int32 test_0_lconv_to_ovf_i8 () cil managed {
842                 .maxstack 16
843
844                 ldc.i4 1234
845                 conv.i8
846                 conv.ovf.i8
847                 conv.i4
848                 ldc.i4 1234
849                 beq L1
850                 ldc.i4.1
851                 ret
852         L1:
853                 ldc.i4.0
854                 ret
855         }
856
857         .method public static int32 test_0_lconv_to_ovf_u8_un () cil managed {
858                 .maxstack 16
859
860                 ldc.i4 1234
861                 conv.i8
862                 conv.ovf.u8.un
863                 conv.i4
864                 ldc.i4 1234
865                 beq L1
866                 ldc.i4.1
867                 ret
868         L1:
869                 ldc.i4.0
870                 ret
871         }
872
873         .method public static int32 test_2_lconv_to_ovf_i4_un () cil managed {
874                 .maxstack 16
875                 .locals init (int32 res)
876
877                 ldc.i4 0x7fffffff
878                 conv.u8
879                 conv.ovf.i4.un
880                 pop
881
882                 ldc.i4.2
883                 stloc res
884
885         .try {
886                         ldc.i8 0x80000000
887                         conv.ovf.i4.un
888                         pop
889                         ldc.i4.0
890                         stloc res
891                         leave RET
892                 } catch [mscorlib]System.OverflowException {
893                         pop
894                         leave IL_0
895                 }
896
897         IL_0:
898
899         .try {
900                         ldc.i8 0xffffffff80000000
901                         conv.ovf.i4.un
902                         pop
903                         ldc.i4.1
904                         stloc res
905                         leave RET
906                 } catch [mscorlib]System.OverflowException {
907                         pop
908                         leave RET
909                 }
910
911         RET:
912                 ldloc res
913                 ret
914         }
915
916     .method public static int32 test_1_lconv_to_ovf_i_un () cil managed {
917                 .maxstack 16
918                 .locals init (int32 res)
919
920                 ldc.i4 0x7fffffff
921                 conv.u8
922                 conv.ovf.i.un
923                 conv.i4
924                 pop
925
926                 ldc.i4.1
927                 ret
928         }
929
930         .method public static int32 test_32_lconv_to_u8 () cil managed
931         {
932                 .maxstack 16
933
934                 ldc.i4 32
935                 conv.i8
936                 conv.u8
937                 conv.i4
938                 ret
939         }                               
940
941         .method public static int32 test_32_lconv_to_i8 () cil managed
942         {
943                 .maxstack 16
944
945                 ldc.i4 32
946                 conv.i8
947                 conv.i8
948                 conv.i4
949                 ret
950         }                               
951
952         .method public static int32 test_15_lconv_to_u () cil managed
953         {
954         ldc.i8 0x10000000f
955                 conv.u
956                 conv.i4
957                 ret
958         }
959
960 #if !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__sparc__)
961         // PPC handles overflow by clipping, but this test assumes
962         // no overflow handling.  According to ECMA the result of
963         // float->int conversion is undefined if overflow occurs, so
964         // both behaviours are valid.
965         .method public static int32 test_0_fconv_to_i () cil managed {
966                 .maxstack 16
967
968                 ldc.r8 2147483648.0
969                 conv.i
970                 ldc.i8 2147483648
971                 conv.i
972                 beq L1
973                 ldc.i4.1
974                 ret
975         L1:
976                 ldc.i4.0
977                 ret
978         }
979 #endif
980
981         .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
982         {
983                 .maxstack 16
984         
985                 ldc.i4.1
986                 brfalse OBJECT
987         
988                 ldtoken [mscorlib]System.String
989                 br AFTER
990         OBJECT:
991                 ldtoken [mscorlib]System.Object
992         AFTER:
993                 call class [mscorlib]'System.Type' class [mscorlib]'System.Type'::'GetTypeFromHandle'(valuetype [mscorlib]'System.RuntimeTypeHandle')
994                 callvirt instance string class [mscorlib]System.Type::get_FullName ()
995                 ldstr "System.String"
996                 callvirt instance bool class [mscorlib]System.Object::Equals(object)
997                 ldc.i4.0
998                 ceq
999                 ret 
1000         }
1001                 
1002         .method public static int32 test_0_bug59580  ()
1003         {
1004                 ldc.r4          float32(0x7FC00000)
1005                 ldc.r4          float32(0x7FC00000)
1006                 bge.un          pass
1007                 br              fail
1008         pass:
1009                 ldc.i4.0
1010                 ret
1011         fail:
1012                 ldc.i4.1
1013                 ret
1014         }
1015         
1016         .method public static int32 test_1_bug60056  () {
1017                 .locals init (int32 m5)
1018                         
1019                 ldc.i4.m1
1020                 stloc.0
1021                 
1022                 ldc.i4.1
1023                 conv.u8
1024                 
1025                 ldloc.0
1026                 conv.i8
1027                 mul
1028                 
1029                 ldc.i4.m1
1030                 conv.i8
1031                 ceq
1032                 ret
1033         }
1034         
1035         .method public static int32 test_1_conv_u8_cfold  () {
1036                 ldc.i4.m1
1037                 conv.u8
1038                 
1039                 ldc.i8 0x00000000ffffffff
1040                 
1041                 ceq
1042                 ret
1043         }
1044         
1045         .method public static int32 test_1_array_type_mismatch_ldelema  () {
1046                 .locals init (int32 r)
1047                 
1048                         ldc.i4.1
1049                         newarr string
1050                         ldc.i4.0 
1051                         ldelema string
1052                         pop
1053                 
1054                 .try {
1055                         ldc.i4.1
1056                         newarr string
1057                         ldc.i4.0 
1058                         ldelema object
1059                         pop
1060                         
1061                         leave end
1062                 } catch [mscorlib]System.ArrayTypeMismatchException {
1063                         pop
1064                         ldc.i4.1
1065                         stloc.0
1066                         leave end
1067                 }
1068         end:
1069                 ldloc.0
1070                 ret
1071         }
1072
1073         .method public static int32 test_1_conv_ovf_i8_with_i4 () {
1074                         ldc.i4.m1 
1075                         conv.ovf.i8
1076                         conv.ovf.i4
1077                         neg
1078                         ret
1079         }
1080
1081         // bug #72148
1082     .method public static int32 test_0_initlocals_float_ptr () {
1083         .maxstack 3
1084         .locals init (
1085                 float32[]       V_0,
1086                 float32& pinned V_1,
1087                 unsigned int32  V_2)
1088                         ldc.i4.s 0x0f
1089                         newarr [mscorlib]System.Single
1090                         stloc.0 
1091                         ldloc.0 
1092                         ldc.i4.0 
1093                         ldc.r4 1.13
1094                         stelem.r4 
1095                         ldloc.0 
1096                         ldc.i4.0 
1097                         ldelema [mscorlib]System.Single
1098                         stloc.1 
1099                         ldloc.1 
1100                         conv.i 
1101                         ldind.u4 
1102                         stloc.2 
1103                         ldc.i4.0
1104                         ret
1105         }
1106
1107         .method public static int32 test_7_conv_ovf_u8_un () {
1108         .maxstack  2
1109         .locals    init (unsigned int64)
1110
1111         ldc.i4.7
1112         conv.ovf.u8.un
1113         stloc.0
1114                 ldloc.0
1115                 conv.i4
1116         ret
1117         }
1118
1119         .method public static int32 test_7_conv_ovf_u4_un () {
1120         .maxstack  2
1121         .locals    init (unsigned int32)
1122
1123         ldc.i4.7
1124         conv.ovf.u4.un
1125         stloc.0
1126                 ldloc.0
1127                 conv.i4
1128         ret
1129         }
1130
1131         .method public static int32 test_1_bug_74591 () {
1132                 .maxstack 16
1133                 .locals init (int32)
1134
1135                 ldc.i4.m1
1136                 stloc.0
1137                 ldloc.0
1138                 conv.ovf.i8
1139                 ldc.i4.m1
1140                 conv.ovf.i8
1141                 mul.ovf
1142                 conv.i4
1143                 ret
1144         }
1145
1146         .class nested public auto ansi Integer
1147                 extends [mscorlib]System.Object {
1148
1149                 .field public bool n
1150
1151             .method public hidebysig  specialname  rtspecialname 
1152            instance default void .ctor (unsigned int64 i, bool n)  cil managed 
1153             {
1154                         .maxstack 8
1155                         ldarg.0
1156                         call instance void class [mscorlib]System.Object::.ctor()
1157                         ldarg.0
1158                         ldarg.2
1159                         stfld bool Tests/Integer::n
1160                         ret
1161                 }
1162         }
1163
1164         .method public static int32 test_1_bug_74726 () {
1165                 .maxstack 16
1166
1167                 ldc.i4.2
1168                 conv.ovf.u8
1169                 ldc.i4.1
1170                 conv.ovf.u8
1171                 mul.ovf.un
1172                 ldc.i4.1
1173                 newobj instance void class Tests/Integer::.ctor(unsigned int64, bool)
1174                 ldfld bool Tests/Integer::n
1175                 ldc.i4.1
1176                 ceq
1177                 ret
1178         }
1179
1180         .class nested private auto ansi sealed xxx
1181         extends [mscorlib]System.ValueType
1182    {
1183      .field  public   object a
1184
1185      .method public hidebysig  specialname  rtspecialname 
1186             instance default void .ctor ()  cil managed 
1187      {
1188                  .maxstack 8
1189                  ret 
1190      }
1191    } // end of class xxx
1192
1193         .method public static int32 test_0_newobj_vtype () {
1194                 .maxstack 6
1195                 .locals init (
1196                         valuetype Tests/xxx V_0
1197                 )
1198
1199                 newobj instance void valuetype Tests/xxx::.ctor ()
1200                 stloc.0
1201                 ldloca.s 0
1202                 ldfld object Tests/xxx::a
1203                 brfalse OK
1204                 ldc.i4.s 1
1205                 ret
1206         OK:
1207                 ldc.i4.s 0
1208                 ret
1209         }
1210
1211         .method public static int32 test_0_newobj_vtype_primitive () {
1212                 .maxstack 6
1213                 .locals init (
1214                         native int V_0
1215                 )
1216
1217                 ldc.i4.s 10
1218                 newobj instance void native int::'.ctor'(int32)
1219                 stloc.0
1220                 ldloc.0
1221                 ldc.i4.s 10
1222                 beq OK
1223                 ldc.i4.s 1
1224                 ret
1225         OK:
1226                 ldc.i4.s 0
1227                 ret
1228         }
1229
1230         .method public static int32 test_1_filters () {
1231                 .maxstack 16
1232                 .locals init (
1233                         int32 res
1234                 )
1235
1236                 .try { // 0
1237                         .try {
1238                                 ldstr "OnErrorSub test Exception"
1239                                 newobj instance void class [mscorlib]System.Exception::.ctor(string)
1240                                 throw 
1241                                 leave.s IL_0033
1242                         }
1243                         filter {
1244                                 pop
1245                                 ldc.i4.0
1246                                 endfilter
1247                         } {
1248                                 pop
1249                                 // Should not be called
1250                                 ldc.i4.2
1251                                 stloc res
1252                                 leave.s IL_0033
1253                         }
1254                 }
1255                 filter {
1256                         pop
1257                         ldc.i4.1
1258                         endfilter 
1259                 } {
1260                   pop
1261                   ldc.i4.1
1262                   stloc res       
1263                   leave.s IL_0033
1264
1265                 }
1266                 IL_0033:
1267                 ldloc res
1268                 ret
1269         }
1270
1271         .class nested private auto ansi sealed beforefieldinit TheStruct
1272                 extends [mscorlib]System.ValueType {
1273                 .field public int32 a
1274                 .field public int32 b
1275         }
1276
1277         .method public static int32 test_5_cpobj () {
1278                 .maxstack 8
1279                 .locals init (  
1280                                 valuetype Tests/TheStruct v_0, 
1281                                 valuetype Tests/TheStruct v_1
1282                                          )
1283
1284                 ldloca v_0
1285                 ldc.i4.2
1286                 stfld int32 Tests/TheStruct::a
1287
1288                 ldloca v_0
1289                 ldc.i4.3
1290                 stfld int32 Tests/TheStruct::b
1291
1292                 ldloca v_1
1293                 ldloca v_0
1294                 cpobj Tests/TheStruct
1295
1296                 ldloca v_1
1297                 ldfld int32 Tests/TheStruct::a
1298                 ldloca v_1
1299                 ldfld int32 Tests/TheStruct::b
1300                 add
1301
1302                 ret
1303         }
1304
1305         .method public static int32 test_5_ldobj_stloc_optimization () {
1306                 .maxstack 8
1307                 .locals init (  
1308                                 valuetype Tests/TheStruct v_0, 
1309                                 valuetype Tests/TheStruct v_1
1310                                          )
1311
1312                 ldloca v_0
1313                 ldc.i4.2
1314                 stfld int32 Tests/TheStruct::a
1315
1316                 ldloca v_0
1317                 ldc.i4.3
1318                 stfld int32 Tests/TheStruct::b
1319
1320                 ldloca v_0
1321                 ldobj valuetype Tests/TheStruct
1322                 stloc.s v_1
1323
1324                 ldloca v_1
1325                 ldfld int32 Tests/TheStruct::a
1326                 ldloca v_1
1327                 ldfld int32 Tests/TheStruct::b
1328                 add
1329
1330                 ret
1331         }
1332
1333         .method public static int32 test_1_cpobj_reference () {
1334                 .maxstack 8
1335                 .locals init (  
1336                                 object v_0, 
1337                                 object v_1
1338                                          )
1339
1340                 newobj instance void object::.ctor()
1341                 stloc v_0
1342
1343                 ldloca v_1
1344                 ldloca v_0
1345                 cpobj object
1346
1347                 ldloc v_0
1348                 ldloc v_1
1349                 ceq
1350                 ret
1351         }
1352
1353         .method public static int32 test_1_initobj_reference () {
1354                 .maxstack 8
1355                 .locals init (  
1356                                 object v_0
1357                                          )
1358
1359                 newobj instance void object::.ctor()
1360                 stloc v_0
1361
1362                 ldloca v_0
1363                 initobj object
1364
1365                 ldloc v_0
1366                 ldnull
1367                 ceq
1368                 ret
1369         }
1370
1371         .method public static int32 test_1_ldobj_reference () {
1372                 .maxstack 8
1373                 .locals init (  
1374                                 object v_0
1375                                          )
1376
1377                 newobj instance void object::.ctor()
1378                 stloc v_0
1379
1380                 ldloc v_0
1381                 ldloca v_0
1382                 ldobj object
1383                 ceq
1384                 ret
1385         }
1386
1387         .method public static int32 test_5_vtype_on_bb_boundary () {
1388                 .maxstack 8
1389                 .locals init (  
1390                                 valuetype Tests/TheStruct v_0, 
1391                                 valuetype Tests/TheStruct v_1
1392                                          )
1393
1394                 ldloca v_0
1395                 ldc.i4.2
1396                 stfld int32 Tests/TheStruct::a
1397
1398                 ldloca v_0
1399                 ldc.i4.3
1400                 stfld int32 Tests/TheStruct::b
1401
1402                 ldloc v_0
1403                 br L_0
1404         L_0: stloc v_1
1405
1406                 ldloca v_1
1407                 ldfld int32 Tests/TheStruct::a
1408                 ldloca v_1
1409                 ldfld int32 Tests/TheStruct::b
1410                 add
1411                 ret
1412         }
1413
1414         .method public static int32 test_5_different_in_stacks () cil managed {
1415                 .maxstack 16
1416
1417                         ldc.i4.1
1418                         ldc.i4.1
1419                         beq L_0
1420
1421                         ldc.i4.3
1422                         ldc.i4.3
1423                         br L_1
1424                         ldc.i4.3
1425                         ldc.i4.3
1426                         br L_2
1427          L_0:   ldc.i4.2
1428                         ldc.i4.3
1429                         ldc.i4.1
1430                         ldc.i4.1
1431                         beq L_2
1432          L_1:   add
1433                         ret
1434          L_2:   add
1435                         ret
1436         }
1437
1438         .method public static int32 test_3_larray_get_set () {
1439                 .locals init (
1440                         int32[2]        V_0)
1441                           
1442                         ldc.i4.2 
1443                         newobj instance void int32[0...]::.ctor(int32)
1444                         stloc.0 
1445                         ldloc.0 
1446                         ldc.i4.0 
1447                         ldc.i4 1
1448                         call instance void int32[0...]::Set(int32, int32)
1449                     ldloc.0 
1450                     ldc.i4.1 
1451                         ldc.i4 2
1452                         call instance void int32[0...]::Set(int32, int32)
1453
1454                         ldloc.0
1455                         ldc.i4.0
1456                         call instance int32 int32[0...]::Get(int32)
1457                         ldloc.0
1458                         ldc.i4.1
1459                         call instance int32 int32[0...]::Get(int32)
1460                         add
1461                         ret
1462         }
1463
1464         .method public static int32 test_0_pop_side_effects () {
1465                 .try {
1466                         ldc.r8 1
1467                         ldc.r8 0
1468                         div
1469                         ckfinite
1470                         pop
1471                         leave FAIL
1472                 }
1473                 catch [mscorlib]System.ArithmeticException {
1474                         pop
1475                         leave L_0
1476                 }
1477                 L_0:
1478                 ldc.i4.0
1479                 ret
1480                 FAIL:
1481                 ldc.i4.1
1482                 ret
1483         }
1484
1485         .method public static void regalloc_regress_78314_helper (object o) cil managed
1486         {
1487                 ret
1488         }
1489
1490         .method public static int32 test_1_regalloc_regress_78314 () cil managed
1491         {
1492     // Code size       68 (0x44)
1493     .maxstack  6
1494     .locals init (int32 V_0, bool V_1)
1495     IL_0000:  ldc.i4.0
1496     IL_0001:  stloc.0
1497     IL_0002:  br.s       IL_003b
1498
1499     IL_0004:
1500     IL_001e:  ldc.i4.s   10
1501     IL_0020:  ldloc.0
1502     IL_0021:  shl
1503     IL_0022:  ldc.i4.s   10
1504     IL_0024:  ldloc.0
1505     IL_0025:  shl
1506     IL_0026:  ceq
1507     IL_0028:  box        [mscorlib]System.Boolean
1508     IL_0032:  call       void Tests::regalloc_regress_78314_helper(object)
1509     IL_0037:  ldloc.0
1510     IL_0038:  ldc.i4.1
1511     IL_0039:  add
1512     IL_003a:  stloc.0
1513     IL_003b:  ldloc.0
1514     IL_003c:  ldc.i4.8
1515     IL_003f:  blt.s      IL_0004
1516
1517         ldloc.0
1518         ldc.i4.8
1519         ceq
1520         conv.i4
1521         ret     
1522   }
1523
1524         .method public static void try_block_end_remove_if_useless () cil managed {
1525             .maxstack  8
1526
1527             T_START:
1528                 ldstr   "Start"
1529                         pop
1530                 leave.s COMPLETE
1531             T1_END:
1532
1533             COMPLETE:
1534                 ret
1535
1536             F1_START:
1537                 ldstr   "Finally1"
1538                         pop
1539                 endfinally
1540             F1_END:
1541
1542             .try T_START to T1_END finally handler F1_START to F1_END
1543         }
1544
1545         .method public static int32 test_0_try_block_end_remove_if_useless () cil managed {
1546                 call void class Tests::try_block_end_remove_if_useless ()
1547                 ldc.i4.0
1548                 ret
1549         }
1550
1551    .method private static int32 test_0_regress_78629_switch_next_ins_target ()  cil managed
1552     {
1553         ldc.i4.0
1554         switch (target)
1555         target: ldstr "bar"
1556                 pop
1557                 ldc.i4.0
1558         ret
1559     }
1560
1561         // This belongs to basic-float.cs, but its hard to tell mcs/csc to
1562         // generate the non .un version of the opcodes
1563     .method private static  hidebysig 
1564            default int32 test_4_float_branch_nan ()  cil managed 
1565     {
1566         // Method begins at RVA 0x27a4
1567         // Code size 74 (0x4a)
1568         .maxstack 2
1569         .locals init (
1570                 float64 V_0,
1571                 float64 V_1,
1572                 int32   V_2)
1573         IL_0000:  ldc.r8 (00 00 00 00 00 00 f8 ff)
1574         IL_0009:  stloc.0 
1575         IL_000a:  ldc.r8 1.
1576         IL_0013:  stloc.1 
1577         IL_0014:  ldc.i4.0 
1578         IL_0015:  stloc.2 
1579         IL_0016:  ldloc.0 
1580         IL_0017:  ldloc.1 
1581         IL_0018:  bge.s IL_001a
1582
1583                                 br L1
1584         IL_001a:  ldloc.2 
1585         IL_001b:  ret 
1586         L1:
1587         IL_001c:  ldloc.2 
1588         IL_001d:  ldc.i4.1 
1589         IL_001e:  add 
1590         IL_001f:  stloc.2 
1591         IL_0020:  ldloc.0 
1592         IL_0021:  ldloc.1 
1593         IL_0022:  ble.s IL_002e
1594                                 br L2
1595         IL_002e:  ldloc.2 
1596         IL_002f:  ret 
1597         L2:
1598         IL_0030:  ldloc.2 
1599         IL_0031:  ldc.i4.1 
1600         IL_0032:  add 
1601         IL_0033:  stloc.2 
1602         IL_0034:  ldloc.0 
1603         IL_0035:  ldloc.1 
1604         IL_0036:  blt.s IL_0038
1605                                 br L3           
1606         IL_0038:  ldloc.2 
1607         IL_0039:  ret 
1608         L3:
1609         IL_003a:  ldloc.2 
1610         IL_003b:  ldc.i4.1 
1611         IL_003c:  add 
1612         IL_003d:  stloc.2 
1613         IL_003e:  ldloc.0 
1614         IL_003f:  ldloc.1 
1615         IL_0040:  bgt.s IL_0042
1616                                 br L4
1617         IL_0042:  ldloc.2 
1618         IL_0043:  ret 
1619         L4:
1620         IL_0044:  ldloc.2 
1621         IL_0045:  ldc.i4.1 
1622         IL_0046:  add 
1623         IL_0047:  stloc.2 
1624         IL_0048:  ldloc.2 
1625         IL_0049:  ret 
1626     } // end of method Tests::test_5_float_branch_nan
1627
1628     .method private static  hidebysig
1629            default void regress_80622_inner (object x)  cil managed
1630     {
1631                 .locals (unsigned int8 i)
1632         // Method begins at RVA 0x2050
1633         // Code size 14 (0xe)
1634         .maxstack 8
1635         IL_1000:  ldarg.0
1636         IL_1001:  unbox unsigned int8
1637         IL_1006:  ldobj unsigned int8
1638         IL_000b:  conv.ovf.i4.un
1639         IL_000c:  pop
1640         IL_000d:  ret
1641     }
1642
1643     // method line 2
1644     .method private static  hidebysig
1645            default int32 test_0_regress_80622 ()  cil managed
1646     {
1647         .maxstack 8
1648         IL_0000:  ldc.i4 255
1649         IL_0005:  box unsigned int8
1650         IL_000a:  call void class Tests::regress_80622_inner (object)
1651                 ldc.i4.0
1652         IL_000f:  ret
1653     }
1654
1655         .method private static default int32 test_0_regresss_80190 () cil managed
1656         {
1657             .maxstack  2
1658             .locals init (int32 V_0,
1659                      int32* V_1)
1660             IL_0000:  nop
1661             IL_0001:  nop
1662             IL_0002:  ldloca.s   V_0
1663             IL_0004:  conv.u
1664             IL_0005:  stloc.1
1665             IL_0006:  ldloc.1
1666             IL_0007:  ldc.i4.3
1667             IL_0008:  stind.i4
1668             IL_0009:  nop
1669                                   ldc.i4.0
1670                                   ret
1671         }
1672
1673         .class interface nested public auto ansi abstract IFaceWithStaticMethod
1674         {
1675             .method public static  specialname 
1676                default void foo ()  cil managed noinlining 
1677             {
1678                 .maxstack 0
1679                 IL_0000:  ret 
1680         }
1681         }
1682         
1683         .class nested public auto ansi AClass extends [mscorlib]System.Object implements Tests/IFaceWithStaticMethod
1684         {
1685             .method public hidebysig  specialname  rtspecialname 
1686            instance default void .ctor ()  cil managed 
1687             {
1688                         .maxstack 8
1689                         ret
1690                 }
1691
1692         }
1693
1694         // Test that static methods in interfaces are ignored during vtable construction
1695         .method private static default int32 test_0_ifaces_with_static_methods () cil managed
1696         {
1697                 .maxstack 16
1698
1699                 newobj instance void class Tests/AClass::.ctor()
1700                 pop
1701                 ldc.i4.0
1702                 ret
1703         }
1704
1705         .method private static hidebysig default int32 Foo<T> (!!T n)  cil managed {
1706                 ldarg.0
1707                 box !!0
1708                 brtrue HAS_VALUE
1709                 ldc.i4.0
1710                 ret
1711 HAS_VALUE:      ldc.i4.1
1712                 ret
1713         }
1714
1715         // bug 78019
1716         .method static public int32 test_0_nullable_box_brtrue () cil managed {
1717
1718                 .locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
1719
1720                 ldloc.0
1721                 call int32 class Tests::Foo<valuetype [mscorlib]System.Nullable`1<int32>> (!!0)
1722                 ret
1723         }
1724
1725         //Bug 372410
1726         .method static public int32 test_0_ldelema_type_check () cil managed {
1727                 .maxstack 16
1728                 .locals init (object[] V_0,
1729                                           object[,] V_1)
1730
1731                 ldc.i4.1
1732                 newarr object
1733                 stloc.0
1734
1735                 .try {
1736                         ldloc.0
1737                         ldc.i4.0
1738                         ldelema object
1739                         leave L1
1740                 } catch [mscorlib]System.ArrayTypeMismatchException {
1741                         leave ERROR1
1742                 }
1743
1744         L1:
1745                 ldc.i4.1
1746                 newarr string
1747                 stloc.0
1748
1749                 .try {
1750                         ldloc.0
1751                         ldc.i4.0
1752                         ldelema object
1753                         leave ERROR2
1754                 } catch [mscorlib]System.ArrayTypeMismatchException {
1755                         leave L2
1756                 }
1757
1758         L2:
1759                         ldc.i4.1
1760                 newarr string
1761                 stloc.0
1762
1763                 .try {
1764                         ldloc.0
1765                         ldc.i4.0
1766                         readonly. ldelema object
1767                         leave L3
1768                 } catch [mscorlib]System.ArrayTypeMismatchException {
1769                         leave ERROR3
1770                 }
1771
1772         L3:
1773                 ldc.i4.0
1774                 ret
1775
1776
1777         ERROR1:
1778                 ldc.i4.1
1779                 ret
1780
1781         ERROR2:
1782                 ldc.i4.2
1783                 ret
1784
1785         ERROR3:
1786                 ldc.i4.3
1787                 ret
1788         }
1789
1790
1791         //Bug 372410
1792         .method static public int32 test_0_array_address_type_check () cil managed {
1793                 .maxstack 16
1794                 .locals init (object[] V_0,
1795                                           object[,] V_1)
1796
1797                 ldc.i4.1 
1798             ldc.i4.1 
1799             newobj instance void object[,]::.ctor(int32, int32)
1800                 stloc.1
1801
1802                 .try {
1803                         ldloc.1
1804                         ldc.i4.0
1805                         ldc.i4.0
1806                         call instance object&  object[,]::Address(int32, int32)
1807                         leave L4
1808                 } catch [mscorlib]System.ArrayTypeMismatchException {
1809                         leave ERROR4
1810                 }
1811
1812         L4:
1813                 ldc.i4.1 
1814             ldc.i4.1 
1815             newobj instance void string[,]::.ctor(int32, int32)
1816                 stloc.1
1817
1818                 .try {
1819                         ldloc.1
1820                         ldc.i4.0
1821                         ldc.i4.0
1822                         call instance object&  object[,]::Address(int32, int32)
1823                         leave ERROR5
1824                 } catch [mscorlib]System.ArrayTypeMismatchException {
1825                         leave L5
1826                 }
1827
1828         L5:
1829                 ldc.i4.1 
1830             ldc.i4.1 
1831             newobj instance void string[,]::.ctor(int32, int32)
1832                 stloc.1
1833
1834                 .try {
1835                         ldloc.1
1836                         ldc.i4.0
1837                         ldc.i4.0
1838                         readonly. call instance object&  object[,]::Address(int32, int32)
1839                         leave L6
1840                 } catch [mscorlib]System.ArrayTypeMismatchException {
1841                         leave ERROR6
1842                 }
1843
1844         L6:
1845                 ldc.i4.0
1846                 ret
1847         ERROR4:
1848                 ldc.i4.4
1849                 ret
1850
1851         ERROR5:
1852                 ldc.i4.5
1853                 ret
1854
1855         ERROR6:
1856                 ldc.i4.6
1857                 ret
1858         }
1859
1860         .field public  static unsigned int64 'ull'
1861
1862         .field public  static int32 'shift2'
1863
1864         .method public static int32 test_0_long_shift_regalloc () cil managed
1865         {
1866                 .locals (unsigned int32 'cilsimp.28', unsigned int64 'cilsimp.27', int32 'cilsimp.26')
1867
1868                 .maxstack 4
1869
1870                 ldc.i8  81985529234382576
1871                 stsfld  unsigned int64 Tests::ull
1872             ldc.i4      60
1873                 stsfld  int32 Tests::shift2
1874
1875                 ldsfld  unsigned int64 Tests::ull
1876                 stloc   'cilsimp.27'
1877                 ldsfld  int32 Tests::shift2
1878                 stloc   'cilsimp.28'
1879                 ldloc   'cilsimp.27'
1880                 ldloc   'cilsimp.28'
1881                 shr.un
1882                 ldloc   'cilsimp.27'
1883                 ldc.i4  64
1884                 ldloc   'cilsimp.28'
1885                 sub
1886                 shl
1887                 or
1888                 ldc.i8  1311768467750121216
1889                 ceq
1890                 ldc.i4.1
1891                 xor
1892                 conv.u4
1893                 ret
1894         }
1895
1896         // Test calling ldfld directly on a vtype instead of a vtype address
1897         .method public static int32 test_5_call_ldfld_vtype () cil managed
1898         {
1899                 .maxstack 16
1900                 .locals init (
1901                         valuetype Tests/TailCallStruct arg
1902                 )
1903                 ldloca 0
1904                 ldc.i4.2
1905                 stfld int32 Tests/TailCallStruct::a
1906                 ldloca 0
1907                 ldc.i4.4
1908                 stfld int32 Tests/TailCallStruct::b
1909                 ldloc.0
1910                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
1911                 ldfld int32 Tests/TailCallStruct::a
1912                 ret
1913         }
1914
1915         .method public static int32 throw_ret () cil managed
1916         {
1917                 ldstr "FOO"
1918                 newobj instance void class [mscorlib]System.OverflowException::.ctor(string)
1919                 throw
1920                 ldc.i4.4
1921                 ret
1922         }
1923
1924         .method public static int32 throw2_ret () cil managed
1925         {
1926                 // Disable inlining
1927                 ldc.i4.5
1928                 localloc
1929                 pop
1930
1931                 call int32 Tests::throw_ret ()
1932                 ret
1933         }
1934
1935         // Test inlining a method which contains just a throw
1936         .method public static int32 test_0_inline_throw () cil managed
1937         {
1938                 .maxstack 16
1939                 .locals init (
1940                                 int32 v_0
1941                 )
1942
1943                 .try {
1944                         call int32 Tests::throw2_ret ()
1945                         stloc.0
1946                         leave L0
1947                 } catch [mscorlib]System.OverflowException {
1948                         pop
1949                         leave L1
1950                 }
1951
1952                 L0:
1953                         ldc.i4.1
1954                         ret
1955                 L1:
1956                         ldc.i4.0
1957                         ret                     
1958         }
1959
1960     .method public static int32 test_0_stelem_any_null_opt () cil managed
1961     {
1962                 .maxstack 16
1963                 .locals init (
1964                                 object[]        V_0,
1965                                 int32   V_1)
1966
1967                 ldc.i4.s 10
1968                 newarr [mscorlib]System.Object
1969                 stloc.0
1970
1971                 ldc.i4.0
1972                 stloc.1
1973                 br L0
1974
1975         L1:
1976                 ldloc.0
1977                 ldloc.1
1978                 ldnull
1979                 stelem.any [mscorlib]System.Object
1980                 ldloc.1
1981                 ldc.i4.1
1982                 add
1983                 stloc.1
1984         L0:
1985                 ldloc.1
1986                 ldc.i4.s 10
1987                 blt L1
1988
1989                 ldc.i4.0
1990                 ret
1991         }
1992
1993     // method line 2
1994     .method public static  hidebysig 
1995            default int32 manyargs_callee (int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g, int32 h, int32 i, int32 j, int32 k, int32 l, int32 m, int32 n, int32 o, int32 p)  cil managed 
1996     {
1997         // Method begins at RVA 0x20f4
1998         // Code size 44 (0x2c)
1999         .maxstack 8
2000         IL_0000:  ldarg.0 
2001         IL_0001:  ldarg.1 
2002         IL_0002:  add 
2003         IL_0003:  ldarg.2 
2004         IL_0004:  add 
2005         IL_0005:  ldarg.3 
2006         IL_0006:  add 
2007         IL_0007:  ldarg.s 4
2008         IL_0009:  add 
2009         IL_000a:  ldarg.s 5
2010         IL_000c:  add 
2011         IL_000d:  ldarg.s 6
2012         IL_000f:  add 
2013         IL_0010:  ldarg.s 7
2014         IL_0012:  add 
2015         IL_0013:  ldarg.s 8
2016         IL_0015:  add 
2017         IL_0016:  ldarg.s 9
2018         IL_0018:  add 
2019         IL_0019:  ldarg.s 10
2020         IL_001b:  add 
2021         IL_001c:  ldarg.s 11
2022         IL_001e:  add 
2023         IL_001f:  ldarg.s 12
2024         IL_0021:  add 
2025         IL_0022:  ldarg.s 13
2026         IL_0024:  add 
2027         IL_0025:  ldarg.s 14
2028         IL_0027:  add 
2029         IL_0028:  ldarg.s 15
2030         IL_002a:  add 
2031         IL_002b:  ret 
2032     } // end of method main::callee
2033
2034     // method line 3
2035     .method public static  hidebysig 
2036            default int32 manyargs_tail_caller (int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 g, int32 h, int32 i, int32 j, int32 k, int32 l, int32 m, int32 n, int32 o, int32 p)  cil managed 
2037     {
2038         // Method begins at RVA 0x2124
2039         // Code size 34 (0x22)
2040         .maxstack 17
2041         IL_0000:  ldarg.0 
2042         IL_0001:  ldarg.1 
2043         IL_0002:  ldarg.2 
2044         IL_0003:  ldarg.3 
2045         IL_0004:  ldarg.s 4
2046         IL_0006:  ldarg.s 5
2047         IL_0008:  ldarg.s 6
2048         IL_000a:  ldarg.s 7
2049         IL_000c:  ldarg.s 8
2050         IL_000e:  ldarg.s 9
2051         IL_0010:  ldarg.s 10
2052         IL_0012:  ldarg.s 11
2053         IL_0014:  ldarg.s 12
2054         IL_0016:  ldarg.s 13
2055         IL_0018:  ldarg.s 14
2056         IL_001a:  ldarg.s 15
2057                   tail.
2058         IL_001c:  call int32 class Tests::manyargs_callee(int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32)
2059         IL_0021:  ret 
2060     } // end of method main::caller
2061
2062     // method line 4
2063     .method public static  hidebysig 
2064            default int32 test_0_many_args_tail_call ()  cil managed 
2065     {
2066         // Method begins at RVA 0x2154
2067         // Code size 43 (0x2b)
2068         .maxstack 17
2069         IL_0000:  ldc.i4.1 
2070         IL_0001:  ldc.i4.2 
2071         IL_0002:  ldc.i4.3 
2072         IL_0003:  ldc.i4.4 
2073         IL_0004:  ldc.i4.5 
2074         IL_0005:  ldc.i4.6 
2075         IL_0006:  ldc.i4.7 
2076         IL_0007:  ldc.i4.8 
2077         IL_0008:  ldc.i4.s 0x09
2078         IL_000a:  ldc.i4.s 0x0a
2079         IL_000c:  ldc.i4.s 0x0b
2080         IL_000e:  ldc.i4.s 0x0c
2081         IL_0010:  ldc.i4.s 0x0d
2082         IL_0012:  ldc.i4.s 0x0e
2083         IL_0014:  ldc.i4.s 0x0f
2084         IL_0016:  ldc.i4.s 0x10
2085         IL_0018:  call int32 class Tests::manyargs_tail_caller(int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32)
2086         IL_001d:  ldc.i4 136
2087         IL_0022:  beq IL_0029
2088
2089         IL_0027:  ldc.i4.1 
2090         IL_0028:  ret 
2091         IL_0029:  ldc.i4.0 
2092         IL_002a:  ret 
2093     } // end of method main::Main
2094
2095         .class nested private auto ansi beforefieldinit R1
2096            extends [mscorlib]System.MarshalByRefObject
2097         {
2098                 .field  public  int32 test_field
2099
2100         .method public hidebysig  specialname  rtspecialname
2101                         instance default void '.ctor' ()  cil managed
2102         {
2103                         ret
2104                 }
2105         }
2106
2107         .method public static hidebysig
2108                         default int32 return_0 () cil managed
2109         {
2110                 ldc.i4.0
2111                 ret
2112         }
2113
2114         .method public static hidebysig
2115                         default int32 test_1_volatile_marshalbyref_bug_432673 () cil managed
2116         {
2117                 .locals init (
2118                         class Tests/R1 v_0
2119                 )
2120
2121                 newobj instance void class Tests/R1::.ctor ()
2122                 stloc.0
2123                 ldloc.0
2124                 ldc.i4.0
2125                 volatile.
2126                 stfld int32 Tests/R1::test_field
2127                 call int32 class Tests::return_0 ()
2128                 ldc.i4.1
2129                 add
2130                 ret
2131         }
2132
2133         .method public static default int32 return_2 () cil managed
2134         {
2135                 // Prevent inlining
2136                 ldc.i4.s 16
2137         localloc
2138                 pop
2139                 ldc.i4.s 2
2140                 ret
2141         }
2142
2143         .method public static hidebysig
2144                         default int32 test_1_cmov_opt_regress_463357 () cil managed
2145         {
2146                 call int32 class Tests::return_2 ()
2147                 ldc.i4.0
2148                 ceq
2149                 brfalse L1
2150                 ldc.i4.0
2151                 ret
2152                 br L2
2153         L1: nop
2154         L2: nop
2155                 ldc.i4.1
2156                 ret
2157         }
2158
2159    .method public static hidebysig default int32 cmov_opt_regress_474718_inner (int32 A_1)  cil managed 
2160    {
2161       .maxstack 3
2162       .locals init (int32 V_0, bool V_1, bool V_2)
2163       
2164           ldc.i4.0
2165       IL_000b:  stloc.1 
2166       IL_000d:  br IL_002f
2167
2168           ldc.i4.1    
2169           stloc.2
2170       IL_001e:  ldloc.2 
2171       IL_001f:  brfalse IL_0036
2172
2173       IL_0024:  
2174       IL_002a:  br IL_0041
2175     
2176       IL_002f:  ldloc.1
2177       IL_0030:  stloc.2 
2178       IL_0031:  br IL_001e
2179     
2180       IL_0036:  ldc.i4 0
2181       IL_003b:  stloc.0 
2182       IL_003c:  br IL_0041
2183     
2184       IL_0041:  ldloc.0 
2185       IL_0042:  ret 
2186   } 
2187
2188     .method public static default int32 test_0_cmov_opt_regress_474718 ()  cil managed 
2189     {
2190         .maxstack 16
2191         ldc.i4.1
2192         call int32 Tests::cmov_opt_regress_474718_inner (int32)
2193         ret
2194    }
2195
2196         .method public static default int32 test_5_createarr_newobj () cil managed
2197         {
2198                 .maxstack 16
2199
2200                 ldc.i4 5
2201                 newobj void char[]::.ctor(int32)
2202                 ldlen
2203                 ret
2204         }
2205
2206         .method public static default int32 test_0_initblk_3_regress_481458 () cil managed
2207         {
2208                 .maxstack 16
2209                 .locals init (native int)
2210
2211                 ldc.i4.s 10
2212                 localloc
2213                 stloc.0
2214
2215                 // Set the first value to 3
2216                 ldloc.0
2217                 ldc.i4.0
2218                 add             //addr
2219                 ldc.i4.3        //value
2220                 stind.i1
2221
2222                 // Zero out the first 3 values
2223                 ldloc.0         //addr
2224                 ldc.i4.0        //value
2225                 ldc.i4.s 3      //size
2226                 initblk
2227
2228                 // Load the first value
2229                 ldloc.0
2230                 ldc.i4.0
2231                 add     
2232                 ldind.u1
2233                 conv.i4
2234                 ret
2235         }
2236
2237         .method public static float32 GetFloat32() cil managed noinlining
2238         {
2239                 .maxstack  8
2240                 ldc.r8     0.19975845134874831
2241                 ret
2242         }
2243
2244 /*         Disabled until they can be fixed to run on amd64
2245         .method public static default int32 test_0_implicit_float_to_double_conversion () cil managed
2246         {
2247                 .maxstack 16
2248
2249                 call float32 Tests::GetFloat32()
2250                 ldc.r8     0.19975845134874831
2251                 beq OK
2252
2253                 ldc.i4.1
2254                 ret
2255 OK:
2256                 ldc.i4.0
2257                 ret
2258         }
2259 */
2260
2261         .method public static default int32 test_0_long_to_r8_un_overflow () cil managed
2262         {
2263                 .maxstack 16
2264                 ldc.i8     0x00FFFFFFFFFFFFFF
2265                 conv.r.un
2266                 conv.i8
2267                 ldc.i8 0x100000000000000
2268                 beq OK_1
2269
2270                 ldc.i4.1
2271                 ret
2272 OK_1:
2273                 ldc.i8     0x00FFFFFFFFFFFFFF
2274                 conv.r.un
2275                 conv.r8
2276                 conv.i8
2277                 ldc.i8 0x100000000000000
2278                 beq OK_2
2279
2280                 ldc.i4.2
2281                 ret
2282 OK_2:
2283                 ldc.i4.0
2284                 ret
2285         }
2286
2287         .field public static int32 shift1
2288
2289         .method public static int32 regress_497271_helper (int32 i) cil managed
2290         {
2291                 ldarg.0
2292                 ret
2293         }
2294
2295         .method public static int32 test_0_regalloc_regress_497271 () cil managed
2296         {
2297                 .locals (int32 var)
2298
2299                 ldc.i4  4
2300                 stsfld  int32 Tests::shift1
2301                 ldsfld  int32 Tests::shift1
2302                 stloc   var
2303                 ldc.i4  4660
2304                 ldloc   var
2305                 shr.un
2306                 ldc.i4  4660
2307                 ldc.i4  32
2308                 ldloc   var
2309                 sub
2310                 shl
2311                 or
2312                 ldc.i4  1073742115
2313                 beq     ?L10
2314 ?L9:
2315                 ldc.i4  1
2316                 call    int32 Tests::regress_497271_helper (int32)
2317                 ret
2318 ?L10:
2319                 ldc.i4  0
2320                 call    int32 Tests::regress_497271_helper (int32)
2321                 ret
2322         }
2323
2324    .field  private static  int32 Value
2325
2326   .method public static hidebysig  specialname 
2327           default int32 regress_513931_inner ()  cil managed 
2328     {                                                                 
2329         // Method begins at RVA 0x225c                                
2330         // Code size 52 (0x34)                                        
2331         .maxstack 2                                                   
2332         .locals init (                                                
2333                 int32   V_0,                                          
2334                 int32   V_1,                                          
2335                 bool    V_2)
2336                        
2337                                 ldc.i4 999
2338                                 stsfld int32 Tests::Value
2339
2340         IL_0000:  nop                                                 
2341         IL_0001:  ldsfld int32 Tests::Value      
2342         IL_0006:  stloc.0                                             
2343         IL_0007:  ldloc.0                                             
2344         IL_0008:  ldc.i4.0                                            
2345         IL_0009:  cgt                                                 
2346         IL_000b:  ldc.i4.0                                            
2347         IL_000c:  ceq                                                 
2348         IL_000e:  stloc.2                                             
2349         IL_000f:  ldloc.2                                             
2350         IL_0010:  brtrue.s IL_0027                                    
2351
2352         IL_0012:  nop 
2353         IL_0013:  ldloc.0 
2354         IL_0014:  ldc.i4.s 0x7b
2355         IL_0016:  ceq          
2356         IL_0018:  ldc.i4.0     
2357         IL_0019:  ceq          
2358         IL_001b:  stloc.2      
2359         IL_001c:  ldloc.2      
2360         IL_001d:  brtrue.s IL_0023
2361
2362         IL_001f:  ldc.i4.m1 
2363         IL_0020:  stloc.1   
2364         IL_0021:  br.s IL_0032
2365
2366         IL_0023:  ldc.i4.1 
2367         IL_0024:  stloc.1  
2368         IL_0025:  br.s IL_0032
2369
2370         IL_0027:  
2371         IL_002c:  newobj instance void class [mscorlib]System.Exception::'.ctor'()
2372         IL_0031:  throw                                                                            
2373         IL_0032:  ldloc.1                                                                          
2374         IL_0033:  ret                                                                              
2375     }
2376
2377         .method public static hidebysig  specialname 
2378          default int32 test_0_regress_513931 ()  cil managed 
2379         {
2380                 call int32 Tests::regress_513931_inner ()
2381                 pop
2382                 ldc.i4.0
2383                 ret
2384         }
2385
2386         .method public static default int32 test_0_newarr_i8 () cil managed
2387         {
2388                 ldc.i4 1000
2389                 conv.i8
2390                 newarr [mscorlib]System.Boolean
2391                 pop
2392                 ldc.i4 0
2393                 ret
2394         }
2395
2396         .method public static specialname 
2397                default int32 return_1_noinline ()  cil managed noinlining 
2398         {
2399                 .maxstack 0
2400
2401                 ldc.i4.1
2402                 ret 
2403         }
2404
2405         // Only happens with -O=-deadce,cmov
2406         .method public static default int32 test_0_cmov_unused_582322 () cil managed
2407         {
2408         .maxstack 2                                                   
2409         .locals init (                                                
2410                                 int32 V_0
2411                 )                               
2412                 call int32 Tests::return_1_noinline ()
2413                 ldc.i4.1
2414                 bne.un L0
2415                 ldloc.s 0
2416                 pop
2417         L0:
2418                 ldc.i4.0
2419                 ret
2420         }
2421
2422     .method public static  hidebysig 
2423            default int32 test_0_regress_586664 ()  cil managed 
2424     {                                        
2425         // Method begins at RVA 0x20f4       
2426         // Code size 76 (0x4c)               
2427         .maxstack 6                          
2428         .locals init (                       
2429                 float64 V_0,                 
2430                 float64[]       V_1)         
2431         IL_0000:  ldc.r8 1.                  
2432         IL_0009:  ldc.r8 2.                  
2433         IL_0012:  ldc.r8 1.                  
2434         IL_001b:  call float64 class [mscorlib]System.Math::Pow(float64, float64)
2435         IL_0020:  div                                                            
2436         IL_0021:  stloc.0                                                        
2437         IL_0022:  ldc.i4.2                                                       
2438         IL_0023:  newarr [mscorlib]System.Double                                 
2439         IL_0028:  dup                                                            
2440         IL_0029:  ldc.i4.0                                                       
2441         IL_002a:  ldloc.0                                                        
2442         IL_002b:  neg                                                            
2443         IL_002c:  stelem.r8                                                      
2444         IL_002d:  dup                                                            
2445         IL_002e:  ldc.i4.1                                                       
2446         IL_002f:  ldloc.0
2447         IL_0030:  neg
2448         IL_0031:  stelem.r8
2449         IL_0032:  stloc.1
2450         IL_0033:  ldloc.1
2451         IL_0034:  ldc.i4.0
2452         IL_0035:  ldelem.r8
2453         IL_0036:  ldc.r8 -0.5
2454         IL_003f:  bne.un IL_004a
2455
2456         IL_0044:  ldc.i4.0
2457         IL_0045:  br IL_004b
2458
2459         IL_004a:  ldc.i4.1
2460         IL_004b:  ret
2461     }
2462
2463         .method public static int32 test_2_leave_multiple_blocks_from_end ()
2464         {
2465                 .locals init (int32 V_0)
2466
2467                 .try {
2468                         .try {
2469                                 nop
2470                                 nop
2471                                 leave END
2472                         } finally {
2473                                 ldloc.0
2474                                 ldc.i4.1
2475                                 add
2476                                 stloc.0
2477                                 endfinally
2478                         }
2479                         nop
2480                         leave END
2481                 } finally {
2482                         ldloc.0
2483                         ldc.i4.1
2484                         add
2485                         stloc.0
2486                         endfinally
2487                 }
2488 END:
2489                 ldloc.0
2490                 ret
2491         }
2492
2493         .method public static int32 test_3_leave_multiple_blocks_from_hole ()
2494         {
2495                 .locals init (int32 V_0)
2496
2497                 .try {
2498                         .try {
2499                                 ldloc.0
2500                                 brtrue REST
2501                                 leave BEFORE_END
2502 REST:
2503                                 nop
2504                                 nop
2505                                 leave END
2506                         } finally {
2507                                 ldloc.0
2508                                 ldc.i4.1
2509                                 add
2510                                 stloc.0
2511                                 endfinally
2512                         }
2513                         nop
2514                         leave END
2515                 } finally {
2516                         ldloc.0
2517                         ldc.i4.1
2518                         add
2519                         stloc.0
2520                         endfinally
2521                 }
2522 BEFORE_END:
2523                 ldloc.0
2524                 ldc.i4.1
2525                 add
2526                 stloc.0
2527 END:
2528                 ldloc.0
2529                 ret
2530         }
2531
2532         .class nested private auto ansi sealed beforefieldinit Pair`2<TKey,TValue>
2533                    extends [mscorlib]System.ValueType
2534         {
2535                 .field  public  !0 key
2536         .field  public  !1 'value'
2537         }
2538
2539     .method private static hidebysig 
2540            default bool ContentEquals<TKey,TValue> (valuetype Tests/Pair`2<!!TKey, !!TValue> v)  cil managed 
2541     {
2542         .maxstack 8
2543         IL_0000:  ldarga.s 0 
2544         IL_0006:  ldnull 
2545                           constrained. valuetype Tests/Pair`2<!!0,!!1>
2546         IL_0007:  callvirt instance bool class [mscorlib]System.Object::Equals(object)
2547                           ret
2548     }
2549
2550     .method public static hidebysig default int32 test_0_constrained_gshared_595863 () cil managed
2551     {
2552                 .locals init (
2553                 valuetype Tests/Pair`2<string, string>  V_0,
2554                 valuetype Tests/Pair`2<string, string>  V_1)
2555         IL_0000:  ldloca.s 0
2556         IL_0002:  initobj valuetype Tests/Pair`2<string,string>
2557         IL_0008:  ldloc.0 
2558         IL_0009:  stloc.1 
2559         IL_000a:  ldloca.s 1
2560         IL_000c:  ldstr "A"
2561         IL_0011:  stfld !0 valuetype Tests/Pair`2<string,string>::key
2562         IL_0016:  ldloca.s 1
2563         IL_0018:  ldstr "B"
2564         IL_001d:  stfld !1 valuetype Tests/Pair`2<string,string>::'value'
2565         IL_0022:  ldloc.1 
2566         IL_0023:  stloc.0 
2567         IL_0024:  ldloc.0 
2568         IL_0025:  call bool class Tests::ContentEquals<string, string> (valuetype Tests/Pair`2<!!0,!!1>)
2569                           brfalse SUCCESS
2570                           ldc.i4.1
2571                           ret
2572         SUCCESS:
2573                           ldc.i4.0
2574                           ret
2575     }
2576 }