2009-07-11 Michael Barker <mike@middlesoft.co.uk>
[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_u8_un () cil managed {
842                 .maxstack 16
843
844                 ldc.i4 1234
845                 conv.i8
846                 conv.ovf.u8.un
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_2_lconv_to_ovf_i4_un () cil managed {
858                 .maxstack 16
859                 .locals init (int32 res)
860
861                 ldc.i4 0x7fffffff
862                 conv.u8
863                 conv.ovf.i4.un
864                 pop
865
866                 ldc.i4.2
867                 stloc res
868
869         .try {
870                         ldc.i8 0x80000000
871                         conv.ovf.i4.un
872                         pop
873                         ldc.i4.0
874                         stloc res
875                         leave RET
876                 } catch [mscorlib]System.OverflowException {
877                         pop
878                         leave IL_0
879                 }
880
881         IL_0:
882
883         .try {
884                         ldc.i8 0xffffffff80000000
885                         conv.ovf.i4.un
886                         pop
887                         ldc.i4.1
888                         stloc res
889                         leave RET
890                 } catch [mscorlib]System.OverflowException {
891                         pop
892                         leave RET
893                 }
894
895         RET:
896                 ldloc res
897                 ret
898         }
899
900     .method public static int32 test_1_lconv_to_ovf_i_un () cil managed {
901                 .maxstack 16
902                 .locals init (int32 res)
903
904                 ldc.i4 0x7fffffff
905                 conv.u8
906                 conv.ovf.i.un
907                 conv.i4
908                 pop
909
910                 ldc.i4.1
911                 ret
912         }
913
914         .method public static int32 test_32_lconv_to_u8 () cil managed
915         {
916                 .maxstack 16
917
918                 ldc.i4 32
919                 conv.i8
920                 conv.u8
921                 conv.i4
922                 ret
923         }                               
924
925         .method public static int32 test_32_lconv_to_i8 () cil managed
926         {
927                 .maxstack 16
928
929                 ldc.i4 32
930                 conv.i8
931                 conv.i8
932                 conv.i4
933                 ret
934         }                               
935
936         .method public static int32 test_15_lconv_to_u () cil managed
937         {
938         ldc.i8 0x10000000f
939                 conv.u
940                 conv.i4
941                 ret
942         }
943
944 #if !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__)
945         // PPC handles overflow by clipping, but this test assumes
946         // no overflow handling.  According to ECMA the result of
947         // float->int conversion is undefined if overflow occurs, so
948         // both behaviours are valid.
949         .method public static int32 test_0_fconv_to_i () cil managed {
950                 .maxstack 16
951
952                 ldc.r8 2147483648.0
953                 conv.i
954                 ldc.i8 2147483648
955                 conv.i
956                 beq L1
957                 ldc.i4.1
958                 ret
959         L1:
960                 ldc.i4.0
961                 ret
962         }
963 #endif
964
965         .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
966         {
967                 .maxstack 16
968         
969                 ldc.i4.1
970                 brfalse OBJECT
971         
972                 ldtoken [mscorlib]System.String
973                 br AFTER
974         OBJECT:
975                 ldtoken [mscorlib]System.Object
976         AFTER:
977                 call class [mscorlib]'System.Type' class [mscorlib]'System.Type'::'GetTypeFromHandle'(valuetype [mscorlib]'System.RuntimeTypeHandle')
978                 callvirt instance string class [mscorlib]System.Type::get_FullName ()
979                 ldstr "System.String"
980                 callvirt instance bool class [mscorlib]System.Object::Equals(object)
981                 ldc.i4.0
982                 ceq
983                 ret 
984         }
985                 
986         .method public static int32 test_0_bug59580  ()
987         {
988                 ldc.r4          float32(0x7FC00000)
989                 ldc.r4          float32(0x7FC00000)
990                 bge.un          pass
991                 br              fail
992         pass:
993                 ldc.i4.0
994                 ret
995         fail:
996                 ldc.i4.1
997                 ret
998         }
999         
1000         .method public static int32 test_1_bug60056  () {
1001                 .locals init (int32 m5)
1002                         
1003                 ldc.i4.m1
1004                 stloc.0
1005                 
1006                 ldc.i4.1
1007                 conv.u8
1008                 
1009                 ldloc.0
1010                 conv.i8
1011                 mul
1012                 
1013                 ldc.i4.m1
1014                 conv.i8
1015                 ceq
1016                 ret
1017         }
1018         
1019         .method public static int32 test_1_conv_u8_cfold  () {
1020                 ldc.i4.m1
1021                 conv.u8
1022                 
1023                 ldc.i8 0x00000000ffffffff
1024                 
1025                 ceq
1026                 ret
1027         }
1028         
1029         .method public static int32 test_1_array_type_mismatch_ldelema  () {
1030                 .locals init (int32 r)
1031                 
1032                         ldc.i4.1
1033                         newarr string
1034                         ldc.i4.0 
1035                         ldelema string
1036                         pop
1037                 
1038                 .try {
1039                         ldc.i4.1
1040                         newarr string
1041                         ldc.i4.0 
1042                         ldelema object
1043                         pop
1044                         
1045                         leave end
1046                 } catch [mscorlib]System.ArrayTypeMismatchException {
1047                         pop
1048                         ldc.i4.1
1049                         stloc.0
1050                         leave end
1051                 }
1052         end:
1053                 ldloc.0
1054                 ret
1055         }
1056
1057         .method public static int32 test_1_conv_ovf_i8_with_i4 () {
1058                         ldc.i4.m1 
1059                         conv.ovf.i8
1060                         conv.ovf.i4
1061                         neg
1062                         ret
1063         }
1064
1065         // bug #72148
1066     .method public static int32 test_0_initlocals_float_ptr () {
1067         .maxstack 3
1068         .locals init (
1069                 float32[]       V_0,
1070                 float32& pinned V_1,
1071                 unsigned int32  V_2)
1072                         ldc.i4.s 0x0f
1073                         newarr [mscorlib]System.Single
1074                         stloc.0 
1075                         ldloc.0 
1076                         ldc.i4.0 
1077                         ldc.r4 1.13
1078                         stelem.r4 
1079                         ldloc.0 
1080                         ldc.i4.0 
1081                         ldelema [mscorlib]System.Single
1082                         stloc.1 
1083                         ldloc.1 
1084                         conv.i 
1085                         ldind.u4 
1086                         stloc.2 
1087                         ldc.i4.0
1088                         ret
1089         }
1090
1091         .method public static int32 test_7_conv_ovf_u8_un () {
1092         .maxstack  2
1093         .locals    init (unsigned int64)
1094
1095         ldc.i4.7
1096         conv.ovf.u8.un
1097         stloc.0
1098                 ldloc.0
1099                 conv.i4
1100         ret
1101         }
1102
1103         .method public static int32 test_1_bug_74591 () {
1104                 .maxstack 16
1105                 .locals init (int32)
1106
1107                 ldc.i4.m1
1108                 stloc.0
1109                 ldloc.0
1110                 conv.ovf.i8
1111                 ldc.i4.m1
1112                 conv.ovf.i8
1113                 mul.ovf
1114                 conv.i4
1115                 ret
1116         }
1117
1118         .class nested public auto ansi Integer
1119                 extends [mscorlib]System.Object {
1120
1121                 .field public bool n
1122
1123             .method public hidebysig  specialname  rtspecialname 
1124            instance default void .ctor (unsigned int64 i, bool n)  cil managed 
1125             {
1126                         .maxstack 8
1127                         ldarg.0
1128                         call instance void class [mscorlib]System.Object::.ctor()
1129                         ldarg.0
1130                         ldarg.2
1131                         stfld bool Tests/Integer::n
1132                         ret
1133                 }
1134         }
1135
1136         .method public static int32 test_1_bug_74726 () {
1137                 .maxstack 16
1138
1139                 ldc.i4.2
1140                 conv.ovf.u8
1141                 ldc.i4.1
1142                 conv.ovf.u8
1143                 mul.ovf.un
1144                 ldc.i4.1
1145                 newobj instance void class Tests/Integer::.ctor(unsigned int64, bool)
1146                 ldfld bool Tests/Integer::n
1147                 ldc.i4.1
1148                 ceq
1149                 ret
1150         }
1151
1152         .class nested private auto ansi sealed xxx
1153         extends [mscorlib]System.ValueType
1154    {
1155      .field  public   object a
1156
1157      .method public hidebysig  specialname  rtspecialname 
1158             instance default void .ctor ()  cil managed 
1159      {
1160                  .maxstack 8
1161                  ret 
1162      }
1163    } // end of class xxx
1164
1165         .method public static int32 test_0_newobj_vtype () {
1166                 .maxstack 6
1167                 .locals init (
1168                         valuetype Tests/xxx V_0
1169                 )
1170
1171                 newobj instance void valuetype Tests/xxx::.ctor ()
1172                 stloc.0
1173                 ldloca.s 0
1174                 ldfld object Tests/xxx::a
1175                 brfalse OK
1176                 ldc.i4.s 1
1177                 ret
1178         OK:
1179                 ldc.i4.s 0
1180                 ret
1181         }
1182
1183         .method public static int32 test_0_newobj_vtype_primitive () {
1184                 .maxstack 6
1185                 .locals init (
1186                         native int V_0
1187                 )
1188
1189                 ldc.i4.s 10
1190                 newobj instance void native int::'.ctor'(int32)
1191                 stloc.0
1192                 ldloc.0
1193                 ldc.i4.s 10
1194                 beq OK
1195                 ldc.i4.s 1
1196                 ret
1197         OK:
1198                 ldc.i4.s 0
1199                 ret
1200         }
1201
1202         .method public static int32 test_1_filters () {
1203                 .maxstack 16
1204                 .locals init (
1205                         int32 res
1206                 )
1207
1208                 .try { // 0
1209                         .try {
1210                                 ldstr "OnErrorSub test Exception"
1211                                 newobj instance void class [mscorlib]System.Exception::.ctor(string)
1212                                 throw 
1213                                 leave.s IL_0033
1214                         }
1215                         filter {
1216                                 pop
1217                                 ldc.i4.0
1218                                 endfilter
1219                         } {
1220                                 pop
1221                                 // Should not be called
1222                                 ldc.i4.2
1223                                 stloc res
1224                                 leave.s IL_0033
1225                         }
1226                 }
1227                 filter {
1228                         pop
1229                         ldc.i4.1
1230                         endfilter 
1231                 } {
1232                   pop
1233                   ldc.i4.1
1234                   stloc res       
1235                   leave.s IL_0033
1236
1237                 }
1238                 IL_0033:
1239                 ldloc res
1240                 ret
1241         }
1242
1243         .class nested private auto ansi sealed beforefieldinit TheStruct
1244                 extends [mscorlib]System.ValueType {
1245                 .field public int32 a
1246                 .field public int32 b
1247         }
1248
1249         .method public static int32 test_5_cpobj () {
1250                 .maxstack 8
1251                 .locals init (  
1252                                 valuetype Tests/TheStruct v_0, 
1253                                 valuetype Tests/TheStruct v_1
1254                                          )
1255
1256                 ldloca v_0
1257                 ldc.i4.2
1258                 stfld int32 Tests/TheStruct::a
1259
1260                 ldloca v_0
1261                 ldc.i4.3
1262                 stfld int32 Tests/TheStruct::b
1263
1264                 ldloca v_1
1265                 ldloca v_0
1266                 cpobj Tests/TheStruct
1267
1268                 ldloca v_1
1269                 ldfld int32 Tests/TheStruct::a
1270                 ldloca v_1
1271                 ldfld int32 Tests/TheStruct::b
1272                 add
1273
1274                 ret
1275         }
1276
1277         .method public static int32 test_5_ldobj_stloc_optimization () {
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_0
1293                 ldobj valuetype Tests/TheStruct
1294                 stloc.s v_1
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_1_cpobj_reference () {
1306                 .maxstack 8
1307                 .locals init (  
1308                                 object v_0, 
1309                                 object v_1
1310                                          )
1311
1312                 newobj instance void object::.ctor()
1313                 stloc v_0
1314
1315                 ldloca v_1
1316                 ldloca v_0
1317                 cpobj object
1318
1319                 ldloc v_0
1320                 ldloc v_1
1321                 ceq
1322                 ret
1323         }
1324
1325         .method public static int32 test_1_initobj_reference () {
1326                 .maxstack 8
1327                 .locals init (  
1328                                 object v_0
1329                                          )
1330
1331                 newobj instance void object::.ctor()
1332                 stloc v_0
1333
1334                 ldloca v_0
1335                 initobj object
1336
1337                 ldloc v_0
1338                 ldnull
1339                 ceq
1340                 ret
1341         }
1342
1343         .method public static int32 test_1_ldobj_reference () {
1344                 .maxstack 8
1345                 .locals init (  
1346                                 object v_0
1347                                          )
1348
1349                 newobj instance void object::.ctor()
1350                 stloc v_0
1351
1352                 ldloc v_0
1353                 ldloca v_0
1354                 ldobj object
1355                 ceq
1356                 ret
1357         }
1358
1359         .method public static int32 test_5_vtype_on_bb_boundary () {
1360                 .maxstack 8
1361                 .locals init (  
1362                                 valuetype Tests/TheStruct v_0, 
1363                                 valuetype Tests/TheStruct v_1
1364                                          )
1365
1366                 ldloca v_0
1367                 ldc.i4.2
1368                 stfld int32 Tests/TheStruct::a
1369
1370                 ldloca v_0
1371                 ldc.i4.3
1372                 stfld int32 Tests/TheStruct::b
1373
1374                 ldloc v_0
1375                 br L_0
1376         L_0: stloc v_1
1377
1378                 ldloca v_1
1379                 ldfld int32 Tests/TheStruct::a
1380                 ldloca v_1
1381                 ldfld int32 Tests/TheStruct::b
1382                 add
1383                 ret
1384         }
1385
1386         .method public static int32 test_5_different_in_stacks () cil managed {
1387                 .maxstack 16
1388
1389                         ldc.i4.1
1390                         ldc.i4.1
1391                         beq L_0
1392
1393                         ldc.i4.3
1394                         ldc.i4.3
1395                         br L_1
1396                         ldc.i4.3
1397                         ldc.i4.3
1398                         br L_2
1399          L_0:   ldc.i4.2
1400                         ldc.i4.3
1401                         ldc.i4.1
1402                         ldc.i4.1
1403                         beq L_2
1404          L_1:   add
1405                         ret
1406          L_2:   add
1407                         ret
1408         }
1409
1410         .method public static int32 test_3_larray_get_set () {
1411                 .locals init (
1412                         int32[2]        V_0)
1413                           
1414                         ldc.i4.2 
1415                         newobj instance void int32[0...]::.ctor(int32)
1416                         stloc.0 
1417                         ldloc.0 
1418                         ldc.i4.0 
1419                         ldc.i4 1
1420                         call instance void int32[0...]::Set(int32, int32)
1421                     ldloc.0 
1422                     ldc.i4.1 
1423                         ldc.i4 2
1424                         call instance void int32[0...]::Set(int32, int32)
1425
1426                         ldloc.0
1427                         ldc.i4.0
1428                         call instance int32 int32[0...]::Get(int32)
1429                         ldloc.0
1430                         ldc.i4.1
1431                         call instance int32 int32[0...]::Get(int32)
1432                         add
1433                         ret
1434         }
1435
1436         .method public static int32 test_0_pop_side_effects () {
1437                 .try {
1438                         ldc.r8 1
1439                         ldc.r8 0
1440                         div
1441                         ckfinite
1442                         pop
1443                         leave FAIL
1444                 }
1445                 catch [mscorlib]System.ArithmeticException {
1446                         pop
1447                         leave L_0
1448                 }
1449                 L_0:
1450                 ldc.i4.0
1451                 ret
1452                 FAIL:
1453                 ldc.i4.1
1454                 ret
1455         }
1456
1457         .method public static void regalloc_regress_78314_helper (object o) cil managed
1458         {
1459                 ret
1460         }
1461
1462         .method public static int32 test_1_regalloc_regress_78314 () cil managed
1463         {
1464     // Code size       68 (0x44)
1465     .maxstack  6
1466     .locals init (int32 V_0, bool V_1)
1467     IL_0000:  ldc.i4.0
1468     IL_0001:  stloc.0
1469     IL_0002:  br.s       IL_003b
1470
1471     IL_0004:
1472     IL_001e:  ldc.i4.s   10
1473     IL_0020:  ldloc.0
1474     IL_0021:  shl
1475     IL_0022:  ldc.i4.s   10
1476     IL_0024:  ldloc.0
1477     IL_0025:  shl
1478     IL_0026:  ceq
1479     IL_0028:  box        [mscorlib]System.Boolean
1480     IL_0032:  call       void Tests::regalloc_regress_78314_helper(object)
1481     IL_0037:  ldloc.0
1482     IL_0038:  ldc.i4.1
1483     IL_0039:  add
1484     IL_003a:  stloc.0
1485     IL_003b:  ldloc.0
1486     IL_003c:  ldc.i4.8
1487     IL_003f:  blt.s      IL_0004
1488
1489         ldloc.0
1490         ldc.i4.8
1491         ceq
1492         conv.i4
1493         ret     
1494   }
1495
1496         .method public static void try_block_end_remove_if_useless () cil managed {
1497             .maxstack  8
1498
1499             T_START:
1500                 ldstr   "Start"
1501                         pop
1502                 leave.s COMPLETE
1503             T1_END:
1504
1505             COMPLETE:
1506                 ret
1507
1508             F1_START:
1509                 ldstr   "Finally1"
1510                         pop
1511                 endfinally
1512             F1_END:
1513
1514             .try T_START to T1_END finally handler F1_START to F1_END
1515         }
1516
1517         .method public static int32 test_0_try_block_end_remove_if_useless () cil managed {
1518                 call void class Tests::try_block_end_remove_if_useless ()
1519                 ldc.i4.0
1520                 ret
1521         }
1522
1523    .method private static int32 test_0_regress_78629_switch_next_ins_target ()  cil managed
1524     {
1525         ldc.i4.0
1526         switch (target)
1527         target: ldstr "bar"
1528                 pop
1529                 ldc.i4.0
1530         ret
1531     }
1532
1533         // This belongs to basic-float.cs, but its hard to tell mcs/csc to
1534         // generate the non .un version of the opcodes
1535     .method private static  hidebysig 
1536            default int32 test_4_float_branch_nan ()  cil managed 
1537     {
1538         // Method begins at RVA 0x27a4
1539         // Code size 74 (0x4a)
1540         .maxstack 2
1541         .locals init (
1542                 float64 V_0,
1543                 float64 V_1,
1544                 int32   V_2)
1545         IL_0000:  ldc.r8 (00 00 00 00 00 00 f8 ff)
1546         IL_0009:  stloc.0 
1547         IL_000a:  ldc.r8 1.
1548         IL_0013:  stloc.1 
1549         IL_0014:  ldc.i4.0 
1550         IL_0015:  stloc.2 
1551         IL_0016:  ldloc.0 
1552         IL_0017:  ldloc.1 
1553         IL_0018:  bge.s IL_001a
1554
1555                                 br L1
1556         IL_001a:  ldloc.2 
1557         IL_001b:  ret 
1558         L1:
1559         IL_001c:  ldloc.2 
1560         IL_001d:  ldc.i4.1 
1561         IL_001e:  add 
1562         IL_001f:  stloc.2 
1563         IL_0020:  ldloc.0 
1564         IL_0021:  ldloc.1 
1565         IL_0022:  ble.s IL_002e
1566                                 br L2
1567         IL_002e:  ldloc.2 
1568         IL_002f:  ret 
1569         L2:
1570         IL_0030:  ldloc.2 
1571         IL_0031:  ldc.i4.1 
1572         IL_0032:  add 
1573         IL_0033:  stloc.2 
1574         IL_0034:  ldloc.0 
1575         IL_0035:  ldloc.1 
1576         IL_0036:  blt.s IL_0038
1577                                 br L3           
1578         IL_0038:  ldloc.2 
1579         IL_0039:  ret 
1580         L3:
1581         IL_003a:  ldloc.2 
1582         IL_003b:  ldc.i4.1 
1583         IL_003c:  add 
1584         IL_003d:  stloc.2 
1585         IL_003e:  ldloc.0 
1586         IL_003f:  ldloc.1 
1587         IL_0040:  bgt.s IL_0042
1588                                 br L4
1589         IL_0042:  ldloc.2 
1590         IL_0043:  ret 
1591         L4:
1592         IL_0044:  ldloc.2 
1593         IL_0045:  ldc.i4.1 
1594         IL_0046:  add 
1595         IL_0047:  stloc.2 
1596         IL_0048:  ldloc.2 
1597         IL_0049:  ret 
1598     } // end of method Tests::test_5_float_branch_nan
1599
1600     .method private static  hidebysig
1601            default void regress_80622_inner (object x)  cil managed
1602     {
1603                 .locals (unsigned int8 i)
1604         // Method begins at RVA 0x2050
1605         // Code size 14 (0xe)
1606         .maxstack 8
1607         IL_1000:  ldarg.0
1608         IL_1001:  unbox unsigned int8
1609         IL_1006:  ldobj unsigned int8
1610         IL_000b:  conv.ovf.i4.un
1611         IL_000c:  pop
1612         IL_000d:  ret
1613     }
1614
1615     // method line 2
1616     .method private static  hidebysig
1617            default int32 test_0_regress_80622 ()  cil managed
1618     {
1619         .maxstack 8
1620         IL_0000:  ldc.i4 255
1621         IL_0005:  box unsigned int8
1622         IL_000a:  call void class Tests::regress_80622_inner (object)
1623                 ldc.i4.0
1624         IL_000f:  ret
1625     }
1626
1627         .method private static default int32 test_0_regresss_80190 () cil managed
1628         {
1629             .maxstack  2
1630             .locals init (int32 V_0,
1631                      int32* V_1)
1632             IL_0000:  nop
1633             IL_0001:  nop
1634             IL_0002:  ldloca.s   V_0
1635             IL_0004:  conv.u
1636             IL_0005:  stloc.1
1637             IL_0006:  ldloc.1
1638             IL_0007:  ldc.i4.3
1639             IL_0008:  stind.i4
1640             IL_0009:  nop
1641                                   ldc.i4.0
1642                                   ret
1643         }
1644
1645         .class interface nested public auto ansi abstract IFaceWithStaticMethod
1646         {
1647             .method public static  specialname 
1648                default void foo ()  cil managed noinlining 
1649             {
1650                 .maxstack 0
1651                 IL_0000:  ret 
1652         }
1653         }
1654         
1655         .class nested public auto ansi AClass extends [mscorlib]System.Object implements Tests/IFaceWithStaticMethod
1656         {
1657             .method public hidebysig  specialname  rtspecialname 
1658            instance default void .ctor ()  cil managed 
1659             {
1660                         .maxstack 8
1661                         ret
1662                 }
1663
1664         }
1665
1666         // Test that static methods in interfaces are ignored during vtable construction
1667         .method private static default int32 test_0_ifaces_with_static_methods () cil managed
1668         {
1669                 .maxstack 16
1670
1671                 newobj instance void class Tests/AClass::.ctor()
1672                 pop
1673                 ldc.i4.0
1674                 ret
1675         }
1676
1677         .method private static hidebysig default int32 Foo<T> (!!T n)  cil managed {
1678                 ldarg.0
1679                 box !!0
1680                 brtrue HAS_VALUE
1681                 ldc.i4.0
1682                 ret
1683 HAS_VALUE:      ldc.i4.1
1684                 ret
1685         }
1686
1687         // bug 78019
1688         .method static public int32 test_0_nullable_box_brtrue () cil managed {
1689
1690                 .locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
1691
1692                 ldloc.0
1693                 call int32 class Tests::Foo<valuetype [mscorlib]System.Nullable`1<int32>> (!!0)
1694                 ret
1695         }
1696
1697         //Bug 372410
1698         .method static public int32 test_0_ldelema_type_check () cil managed {
1699                 .maxstack 16
1700                 .locals init (object[] V_0,
1701                                           object[,] V_1)
1702
1703                 ldc.i4.1
1704                 newarr object
1705                 stloc.0
1706
1707                 .try {
1708                         ldloc.0
1709                         ldc.i4.0
1710                         ldelema object
1711                         leave L1
1712                 } catch [mscorlib]System.ArrayTypeMismatchException {
1713                         leave ERROR1
1714                 }
1715
1716         L1:
1717                 ldc.i4.1
1718                 newarr string
1719                 stloc.0
1720
1721                 .try {
1722                         ldloc.0
1723                         ldc.i4.0
1724                         ldelema object
1725                         leave ERROR2
1726                 } catch [mscorlib]System.ArrayTypeMismatchException {
1727                         leave L2
1728                 }
1729
1730         L2:
1731                         ldc.i4.1
1732                 newarr string
1733                 stloc.0
1734
1735                 .try {
1736                         ldloc.0
1737                         ldc.i4.0
1738                         readonly. ldelema object
1739                         leave L3
1740                 } catch [mscorlib]System.ArrayTypeMismatchException {
1741                         leave ERROR3
1742                 }
1743
1744         L3:
1745                 ldc.i4.0
1746                 ret
1747
1748
1749         ERROR1:
1750                 ldc.i4.1
1751                 ret
1752
1753         ERROR2:
1754                 ldc.i4.2
1755                 ret
1756
1757         ERROR3:
1758                 ldc.i4.3
1759                 ret
1760         }
1761
1762
1763         //Bug 372410
1764         .method static public int32 test_0_array_address_type_check () cil managed {
1765                 .maxstack 16
1766                 .locals init (object[] V_0,
1767                                           object[,] V_1)
1768
1769                 ldc.i4.1 
1770             ldc.i4.1 
1771             newobj instance void object[,]::.ctor(int32, int32)
1772                 stloc.1
1773
1774                 .try {
1775                         ldloc.1
1776                         ldc.i4.0
1777                         ldc.i4.0
1778                         call instance object&  object[,]::Address(int32, int32)
1779                         leave L4
1780                 } catch [mscorlib]System.ArrayTypeMismatchException {
1781                         leave ERROR4
1782                 }
1783
1784         L4:
1785                 ldc.i4.1 
1786             ldc.i4.1 
1787             newobj instance void string[,]::.ctor(int32, int32)
1788                 stloc.1
1789
1790                 .try {
1791                         ldloc.1
1792                         ldc.i4.0
1793                         ldc.i4.0
1794                         call instance object&  object[,]::Address(int32, int32)
1795                         leave ERROR5
1796                 } catch [mscorlib]System.ArrayTypeMismatchException {
1797                         leave L5
1798                 }
1799
1800         L5:
1801                 ldc.i4.1 
1802             ldc.i4.1 
1803             newobj instance void string[,]::.ctor(int32, int32)
1804                 stloc.1
1805
1806                 .try {
1807                         ldloc.1
1808                         ldc.i4.0
1809                         ldc.i4.0
1810                         readonly. call instance object&  object[,]::Address(int32, int32)
1811                         leave L6
1812                 } catch [mscorlib]System.ArrayTypeMismatchException {
1813                         leave ERROR6
1814                 }
1815
1816         L6:
1817                 ldc.i4.0
1818                 ret
1819         ERROR4:
1820                 ldc.i4.4
1821                 ret
1822
1823         ERROR5:
1824                 ldc.i4.5
1825                 ret
1826
1827         ERROR6:
1828                 ldc.i4.6
1829                 ret
1830         }
1831
1832         .field public  static unsigned int64 'ull'
1833
1834         .field public  static int32 'shift2'
1835
1836         .method public static int32 test_0_long_shift_regalloc () cil managed
1837         {
1838                 .locals (unsigned int32 'cilsimp.28', unsigned int64 'cilsimp.27', int32 'cilsimp.26')
1839
1840                 .maxstack 4
1841
1842                 ldc.i8  81985529234382576
1843                 stsfld  unsigned int64 Tests::ull
1844             ldc.i4      60
1845                 stsfld  int32 Tests::shift2
1846
1847                 ldsfld  unsigned int64 Tests::ull
1848                 stloc   'cilsimp.27'
1849                 ldsfld  int32 Tests::shift2
1850                 stloc   'cilsimp.28'
1851                 ldloc   'cilsimp.27'
1852                 ldloc   'cilsimp.28'
1853                 shr.un
1854                 ldloc   'cilsimp.27'
1855                 ldc.i4  64
1856                 ldloc   'cilsimp.28'
1857                 sub
1858                 shl
1859                 or
1860                 ldc.i8  1311768467750121216
1861                 ceq
1862                 ldc.i4.1
1863                 xor
1864                 conv.u4
1865                 ret
1866         }
1867
1868         // Test calling ldfld directly on a vtype instead of a vtype address
1869         .method public static int32 test_5_call_ldfld_vtype () cil managed
1870         {
1871                 .maxstack 16
1872                 .locals init (
1873                         valuetype Tests/TailCallStruct arg
1874                 )
1875                 ldloca 0
1876                 ldc.i4.2
1877                 stfld int32 Tests/TailCallStruct::a
1878                 ldloca 0
1879                 ldc.i4.4
1880                 stfld int32 Tests/TailCallStruct::b
1881                 ldloc.0
1882                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
1883                 ldfld int32 Tests/TailCallStruct::a
1884                 ret
1885         }
1886
1887         .method public static int32 throw_ret () cil managed
1888         {
1889                 ldstr "FOO"
1890                 newobj instance void class [mscorlib]System.OverflowException::.ctor(string)
1891                 throw
1892                 ldc.i4.4
1893                 ret
1894         }
1895
1896         .method public static int32 throw2_ret () cil managed
1897         {
1898                 // Disable inlining
1899                 ldc.i4.5
1900                 localloc
1901                 pop
1902
1903                 call int32 Tests::throw_ret ()
1904                 ret
1905         }
1906
1907         // Test inlining a method which contains just a throw
1908         .method public static int32 test_0_inline_throw () cil managed
1909         {
1910                 .maxstack 16
1911                 .locals init (
1912                                 int32 v_0
1913                 )
1914
1915                 .try {
1916                         call int32 Tests::throw2_ret ()
1917                         stloc.0
1918                         leave L0
1919                 } catch [mscorlib]System.OverflowException {
1920                         pop
1921                         leave L1
1922                 }
1923
1924                 L0:
1925                         ldc.i4.1
1926                         ret
1927                 L1:
1928                         ldc.i4.0
1929                         ret                     
1930         }
1931
1932     .method public static int32 test_0_stelem_any_null_opt () cil managed
1933     {
1934                 .maxstack 16
1935                 .locals init (
1936                                 object[]        V_0,
1937                                 int32   V_1)
1938
1939                 ldc.i4.s 10
1940                 newarr [mscorlib]System.Object
1941                 stloc.0
1942
1943                 ldc.i4.0
1944                 stloc.1
1945                 br L0
1946
1947         L1:
1948                 ldloc.0
1949                 ldloc.1
1950                 ldnull
1951                 stelem.any [mscorlib]System.Object
1952                 ldloc.1
1953                 ldc.i4.1
1954                 add
1955                 stloc.1
1956         L0:
1957                 ldloc.1
1958                 ldc.i4.s 10
1959                 blt L1
1960
1961                 ldc.i4.0
1962                 ret
1963         }
1964
1965     // method line 2
1966     .method public static  hidebysig 
1967            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 
1968     {
1969         // Method begins at RVA 0x20f4
1970         // Code size 44 (0x2c)
1971         .maxstack 8
1972         IL_0000:  ldarg.0 
1973         IL_0001:  ldarg.1 
1974         IL_0002:  add 
1975         IL_0003:  ldarg.2 
1976         IL_0004:  add 
1977         IL_0005:  ldarg.3 
1978         IL_0006:  add 
1979         IL_0007:  ldarg.s 4
1980         IL_0009:  add 
1981         IL_000a:  ldarg.s 5
1982         IL_000c:  add 
1983         IL_000d:  ldarg.s 6
1984         IL_000f:  add 
1985         IL_0010:  ldarg.s 7
1986         IL_0012:  add 
1987         IL_0013:  ldarg.s 8
1988         IL_0015:  add 
1989         IL_0016:  ldarg.s 9
1990         IL_0018:  add 
1991         IL_0019:  ldarg.s 10
1992         IL_001b:  add 
1993         IL_001c:  ldarg.s 11
1994         IL_001e:  add 
1995         IL_001f:  ldarg.s 12
1996         IL_0021:  add 
1997         IL_0022:  ldarg.s 13
1998         IL_0024:  add 
1999         IL_0025:  ldarg.s 14
2000         IL_0027:  add 
2001         IL_0028:  ldarg.s 15
2002         IL_002a:  add 
2003         IL_002b:  ret 
2004     } // end of method main::callee
2005
2006     // method line 3
2007     .method public static  hidebysig 
2008            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 
2009     {
2010         // Method begins at RVA 0x2124
2011         // Code size 34 (0x22)
2012         .maxstack 17
2013         IL_0000:  ldarg.0 
2014         IL_0001:  ldarg.1 
2015         IL_0002:  ldarg.2 
2016         IL_0003:  ldarg.3 
2017         IL_0004:  ldarg.s 4
2018         IL_0006:  ldarg.s 5
2019         IL_0008:  ldarg.s 6
2020         IL_000a:  ldarg.s 7
2021         IL_000c:  ldarg.s 8
2022         IL_000e:  ldarg.s 9
2023         IL_0010:  ldarg.s 10
2024         IL_0012:  ldarg.s 11
2025         IL_0014:  ldarg.s 12
2026         IL_0016:  ldarg.s 13
2027         IL_0018:  ldarg.s 14
2028         IL_001a:  ldarg.s 15
2029                   tail.
2030         IL_001c:  call int32 class Tests::manyargs_callee(int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32)
2031         IL_0021:  ret 
2032     } // end of method main::caller
2033
2034     // method line 4
2035     .method public static  hidebysig 
2036            default int32 test_0_many_args_tail_call ()  cil managed 
2037     {
2038         // Method begins at RVA 0x2154
2039         // Code size 43 (0x2b)
2040         .maxstack 17
2041         IL_0000:  ldc.i4.1 
2042         IL_0001:  ldc.i4.2 
2043         IL_0002:  ldc.i4.3 
2044         IL_0003:  ldc.i4.4 
2045         IL_0004:  ldc.i4.5 
2046         IL_0005:  ldc.i4.6 
2047         IL_0006:  ldc.i4.7 
2048         IL_0007:  ldc.i4.8 
2049         IL_0008:  ldc.i4.s 0x09
2050         IL_000a:  ldc.i4.s 0x0a
2051         IL_000c:  ldc.i4.s 0x0b
2052         IL_000e:  ldc.i4.s 0x0c
2053         IL_0010:  ldc.i4.s 0x0d
2054         IL_0012:  ldc.i4.s 0x0e
2055         IL_0014:  ldc.i4.s 0x0f
2056         IL_0016:  ldc.i4.s 0x10
2057         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)
2058         IL_001d:  ldc.i4 136
2059         IL_0022:  beq IL_0029
2060
2061         IL_0027:  ldc.i4.1 
2062         IL_0028:  ret 
2063         IL_0029:  ldc.i4.0 
2064         IL_002a:  ret 
2065     } // end of method main::Main
2066
2067         .class nested private auto ansi beforefieldinit R1
2068            extends [mscorlib]System.MarshalByRefObject
2069         {
2070                 .field  public  int32 test_field
2071
2072         .method public hidebysig  specialname  rtspecialname
2073                         instance default void '.ctor' ()  cil managed
2074         {
2075                         ret
2076                 }
2077         }
2078
2079         .method public static hidebysig
2080                         default int32 return_0 () cil managed
2081         {
2082                 ldc.i4.0
2083                 ret
2084         }
2085
2086         .method public static hidebysig
2087                         default int32 test_1_volatile_marshalbyref_bug_432673 () cil managed
2088         {
2089                 .locals init (
2090                         class Tests/R1 v_0
2091                 )
2092
2093                 newobj instance void class Tests/R1::.ctor ()
2094                 stloc.0
2095                 ldloc.0
2096                 ldc.i4.0
2097                 volatile.
2098                 stfld int32 Tests/R1::test_field
2099                 call int32 class Tests::return_0 ()
2100                 ldc.i4.1
2101                 add
2102                 ret
2103         }
2104
2105         .method public static default int32 return_2 () cil managed
2106         {
2107                 // Prevent inlining
2108                 ldc.i4.s 16
2109         localloc
2110                 pop
2111                 ldc.i4.s 2
2112                 ret
2113         }
2114
2115         .method public static hidebysig
2116                         default int32 test_1_cmov_opt_regress_463357 () cil managed
2117         {
2118                 call int32 class Tests::return_2 ()
2119                 ldc.i4.0
2120                 ceq
2121                 brfalse L1
2122                 ldc.i4.0
2123                 ret
2124                 br L2
2125         L1: nop
2126         L2: nop
2127                 ldc.i4.1
2128                 ret
2129         }
2130
2131    .method public static hidebysig default int32 cmov_opt_regress_474718_inner (int32 A_1)  cil managed 
2132    {
2133       .maxstack 3
2134       .locals init (int32 V_0, bool V_1, bool V_2)
2135       
2136           ldc.i4.0
2137       IL_000b:  stloc.1 
2138       IL_000d:  br IL_002f
2139
2140           ldc.i4.1    
2141           stloc.2
2142       IL_001e:  ldloc.2 
2143       IL_001f:  brfalse IL_0036
2144
2145       IL_0024:  
2146       IL_002a:  br IL_0041
2147     
2148       IL_002f:  ldloc.1
2149       IL_0030:  stloc.2 
2150       IL_0031:  br IL_001e
2151     
2152       IL_0036:  ldc.i4 0
2153       IL_003b:  stloc.0 
2154       IL_003c:  br IL_0041
2155     
2156       IL_0041:  ldloc.0 
2157       IL_0042:  ret 
2158   } 
2159
2160     .method public static default int32 test_0_cmov_opt_regress_474718 ()  cil managed 
2161     {
2162         .maxstack 16
2163         ldc.i4.1
2164         call int32 Tests::cmov_opt_regress_474718_inner (int32)
2165         ret
2166    }
2167
2168         .method public static default int32 test_5_createarr_newobj () cil managed
2169         {
2170                 .maxstack 16
2171
2172                 ldc.i4 5
2173                 newobj void char[]::.ctor(int32)
2174                 ldlen
2175                 ret
2176         }
2177
2178         .method public static default int32 test_0_initblk_3_regress_481458 () cil managed
2179         {
2180                 .maxstack 16
2181                 .locals init (native int)
2182
2183                 ldc.i4.s 10
2184                 localloc
2185                 stloc.0
2186
2187                 // Set the first value to 3
2188                 ldloc.0
2189                 ldc.i4.0
2190                 add             //addr
2191                 ldc.i4.3        //value
2192                 stind.i1
2193
2194                 // Zero out the first 3 values
2195                 ldloc.0         //addr
2196                 ldc.i4.0        //value
2197                 ldc.i4.s 3      //size
2198                 initblk
2199
2200                 // Load the first value
2201                 ldloc.0
2202                 ldc.i4.0
2203                 add     
2204                 ldind.u1
2205                 conv.i4
2206                 ret
2207         }
2208
2209         .method public static float32 GetFloat32() cil managed noinlining
2210         {
2211                 .maxstack  8
2212                 ldc.r8     0.19975845134874831
2213                 ret
2214         }
2215
2216 /*         Disabled until they can be fixed to run on amd64
2217         .method public static default int32 test_0_implicit_float_to_double_conversion () cil managed
2218         {
2219                 .maxstack 16
2220
2221                 call float32 Tests::GetFloat32()
2222                 ldc.r8     0.19975845134874831
2223                 beq OK
2224
2225                 ldc.i4.1
2226                 ret
2227 OK:
2228                 ldc.i4.0
2229                 ret
2230         }
2231 */
2232
2233         .method public static default int32 test_0_long_to_r8_un_overflow () cil managed
2234         {
2235                 .maxstack 16
2236                 ldc.i8     0x00FFFFFFFFFFFFFF
2237                 conv.r.un
2238                 conv.i8
2239                 ldc.i8 0x100000000000000
2240                 beq OK_1
2241
2242                 ldc.i4.1
2243                 ret
2244 OK_1:
2245                 ldc.i8     0x00FFFFFFFFFFFFFF
2246                 conv.r.un
2247                 conv.r8
2248                 conv.i8
2249                 ldc.i8 0x100000000000000
2250                 beq OK_2
2251
2252                 ldc.i4.2
2253                 ret
2254 OK_2:
2255                 ldc.i4.0
2256                 ret
2257         }
2258
2259         .field public static int32 shift1
2260
2261         .method public static int32 regress_497271_helper (int32 i) cil managed
2262         {
2263                 ldarg.0
2264                 ret
2265         }
2266
2267         .method public static int32 test_0_regalloc_regress_497271 () cil managed
2268         {
2269                 .locals (int32 var)
2270
2271                 ldc.i4  4
2272                 stsfld  int32 Tests::shift1
2273                 ldsfld  int32 Tests::shift1
2274                 stloc   var
2275                 ldc.i4  4660
2276                 ldloc   var
2277                 shr.un
2278                 ldc.i4  4660
2279                 ldc.i4  32
2280                 ldloc   var
2281                 sub
2282                 shl
2283                 or
2284                 ldc.i4  1073742115
2285                 beq     ?L10
2286 ?L9:
2287                 ldc.i4  1
2288                 call    int32 Tests::regress_497271_helper (int32)
2289                 ret
2290 ?L10:
2291                 ldc.i4  0
2292                 call    int32 Tests::regress_497271_helper (int32)
2293                 ret
2294         }
2295
2296    .field  private static  int32 Value
2297
2298   .method public static hidebysig  specialname 
2299           default int32 regress_513931_inner ()  cil managed 
2300     {                                                                 
2301         // Method begins at RVA 0x225c                                
2302         // Code size 52 (0x34)                                        
2303         .maxstack 2                                                   
2304         .locals init (                                                
2305                 int32   V_0,                                          
2306                 int32   V_1,                                          
2307                 bool    V_2)
2308                        
2309                                 ldc.i4 999
2310                                 stsfld int32 Tests::Value
2311
2312         IL_0000:  nop                                                 
2313         IL_0001:  ldsfld int32 Tests::Value      
2314         IL_0006:  stloc.0                                             
2315         IL_0007:  ldloc.0                                             
2316         IL_0008:  ldc.i4.0                                            
2317         IL_0009:  cgt                                                 
2318         IL_000b:  ldc.i4.0                                            
2319         IL_000c:  ceq                                                 
2320         IL_000e:  stloc.2                                             
2321         IL_000f:  ldloc.2                                             
2322         IL_0010:  brtrue.s IL_0027                                    
2323
2324         IL_0012:  nop 
2325         IL_0013:  ldloc.0 
2326         IL_0014:  ldc.i4.s 0x7b
2327         IL_0016:  ceq          
2328         IL_0018:  ldc.i4.0     
2329         IL_0019:  ceq          
2330         IL_001b:  stloc.2      
2331         IL_001c:  ldloc.2      
2332         IL_001d:  brtrue.s IL_0023
2333
2334         IL_001f:  ldc.i4.m1 
2335         IL_0020:  stloc.1   
2336         IL_0021:  br.s IL_0032
2337
2338         IL_0023:  ldc.i4.1 
2339         IL_0024:  stloc.1  
2340         IL_0025:  br.s IL_0032
2341
2342         IL_0027:  
2343         IL_002c:  newobj instance void class [mscorlib]System.Exception::'.ctor'()
2344         IL_0031:  throw                                                                            
2345         IL_0032:  ldloc.1                                                                          
2346         IL_0033:  ret                                                                              
2347     }
2348
2349         .method public static hidebysig  specialname 
2350          default int32 test_0_regress_513931 ()  cil managed 
2351         {
2352                 call int32 Tests::regress_513931_inner ()
2353                 pop
2354                 ldc.i4.0
2355                 ret
2356         }
2357                 
2358 }