2007-01-30 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / iltests.il
index fdfc570864ecf54d1d7281c6a0ed1cabba4787a1..eeebe6ef3a6e9bb6acd903707aa1003e1251c040 100644 (file)
@@ -510,6 +510,53 @@ COND:   ldloc.0
                ret
        }
 
+       .method static public int32 tail3 (int32 i, int32 j) il managed {
+               ldarg.0
+               ldarg.1
+               add
+               ret
+       }
+
+       .method static public int32 tail4 (int32 i, int32 j) il managed {
+               .maxstack 16
+               .locals init (
+                       int32 k)
+
+               // Test arg0 allocated to a register
+               ldarg.0
+               ldarg.0
+               ldarg.0
+               ldarg.0
+               add
+               add
+               add
+               starg 0
+
+               // Test switched up argument variables as the actual arguments
+               ldarg.1
+               ldarg.0
+               tail.
+               call int32 Tests::tail3 (int32, int32)
+               ret
+       }
+
+       .method static public int32 test_24_tail_calls2 () il managed {
+               .maxstack 16
+               .locals init (
+                       int32 i,
+                       int32 j)
+
+               ldc.i4.4
+               stloc.0
+               ldc.i4.8
+               stloc.1
+
+               ldloc.0 
+               ldloc.1
+               call int32 Tests::tail4 (int32, int32)
+               ret
+       }
+
        .method public static int32 test_5_jmp () cil managed {
                jmp int32 Tests::jmp2 ()
                ldc.i4.0
@@ -565,7 +612,7 @@ COND:   ldloc.0
                ret
        }               
 
-       .method public static int32 test_1234_conv_u4 () il managed {
+       .method public static int32 test_1234_conv_u4 () cil managed {
                .maxstack 16
 
                ldc.i4 1234
@@ -574,6 +621,93 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_2_lconv_to_ovf_i4_un () cil managed {
+               .maxstack 16
+               .locals init (int32 res)
+
+               ldc.i4 0x7fffffff
+               conv.u8
+               conv.ovf.i4.un
+               pop
+
+               ldc.i4.2
+               stloc res
+
+        .try {
+                       ldc.i8 0x80000000
+                       conv.ovf.i4.un
+                       pop
+                       ldc.i4.0
+                       stloc res
+                       leave RET
+               } catch [mscorlib]System.OverflowException {
+                       pop
+                       leave IL_0
+               }
+
+       IL_0:
+
+        .try {
+                       ldc.i8 0xffffffff80000000
+                       conv.ovf.i4.un
+                       pop
+                       ldc.i4.1
+                       stloc res
+                       leave RET
+               } catch [mscorlib]System.OverflowException {
+                       pop
+                       leave RET
+               }
+
+       RET:
+               ldloc res
+               ret
+       }
+
+    .method public static int32 test_1_lconv_to_ovf_i_un () cil managed {
+               .maxstack 16
+               .locals init (int32 res)
+
+               ldc.i4 0x7fffffff
+               conv.u8
+               conv.ovf.i.un
+               conv.i4
+               pop
+
+               ldc.i4.1
+               ret
+       }
+
+       .method public static int32 test_32_lconv_to_u8 () cil managed
+       {
+               .maxstack 16
+
+               ldc.i4 32
+               conv.i8
+               conv.u8
+               conv.i4
+               ret
+       }                               
+
+       .method public static int32 test_32_lconv_to_i8 () cil managed
+       {
+               .maxstack 16
+
+               ldc.i4 32
+               conv.i8
+               conv.i8
+               conv.i4
+               ret
+       }                               
+
+       .method public static int32 test_15_lconv_to_u () cil managed
+       {
+       ldc.i8 0x10000000f
+               conv.u
+               conv.i4
+               ret
+       }
+
        .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
        {
                .maxstack 16
@@ -976,6 +1110,30 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_5_different_in_stacks () cil managed {
+               .maxstack 16
+
+                       ldc.i4.1
+                       ldc.i4.1
+                       beq L_0
+
+                       ldc.i4.3
+                       ldc.i4.3
+                       br L_1
+                       ldc.i4.3
+                       ldc.i4.3
+                       br L_2
+        L_0:   ldc.i4.2
+                       ldc.i4.3
+                       ldc.i4.1
+                       ldc.i4.1
+                       beq L_2
+        L_1:   add
+                       ret
+        L_2:   add
+                       ret
+       }
+
        .method public static int32 test_3_larray_get_set () {
                .locals init (
                        int32[2]        V_0)
@@ -1002,6 +1160,27 @@ COND:   ldloc.0
                        ret
        }
 
+       .method public static int32 test_0_pop_side_effects () {
+               .try {
+                       ldc.r8 1
+                       ldc.r8 0
+                       div
+                       ckfinite
+                       pop
+                       leave FAIL
+               }
+               catch [mscorlib]System.ArithmeticException {
+                       pop
+                       leave L_0
+               }
+               L_0:
+               ldc.i4.0
+               ret
+               FAIL:
+               ldc.i4.1
+               ret
+       }
+
        .method public static void regalloc_regress_78314_helper (object o) cil managed
        {
                ret
@@ -1077,4 +1256,99 @@ COND:   ldloc.0
                ldc.i4.0
         ret
     }
+
+       // This belongs to basic-float.cs, but its hard to tell mcs/csc to
+       // generate the non .un version of the opcodes
+    .method private static  hidebysig 
+           default int32 test_4_float_branch_nan ()  cil managed 
+    {
+        // Method begins at RVA 0x27a4
+       // Code size 74 (0x4a)
+       .maxstack 2
+       .locals init (
+               float64 V_0,
+               float64 V_1,
+               int32   V_2)
+       IL_0000:  ldc.r8 (00 00 00 00 00 00 f8 ff)
+       IL_0009:  stloc.0 
+       IL_000a:  ldc.r8 1.
+       IL_0013:  stloc.1 
+       IL_0014:  ldc.i4.0 
+       IL_0015:  stloc.2 
+       IL_0016:  ldloc.0 
+       IL_0017:  ldloc.1 
+       IL_0018:  bge.s IL_001a
+
+                               br L1
+       IL_001a:  ldloc.2 
+       IL_001b:  ret 
+       L1:
+       IL_001c:  ldloc.2 
+       IL_001d:  ldc.i4.1 
+       IL_001e:  add 
+       IL_001f:  stloc.2 
+       IL_0020:  ldloc.0 
+       IL_0021:  ldloc.1 
+       IL_0022:  ble.s IL_002e
+                               br L2
+       IL_002e:  ldloc.2 
+       IL_002f:  ret 
+       L2:
+       IL_0030:  ldloc.2 
+       IL_0031:  ldc.i4.1 
+       IL_0032:  add 
+       IL_0033:  stloc.2 
+       IL_0034:  ldloc.0 
+       IL_0035:  ldloc.1 
+       IL_0036:  blt.s IL_0038
+                               br L3           
+       IL_0038:  ldloc.2 
+       IL_0039:  ret 
+       L3:
+       IL_003a:  ldloc.2 
+       IL_003b:  ldc.i4.1 
+       IL_003c:  add 
+       IL_003d:  stloc.2 
+       IL_003e:  ldloc.0 
+       IL_003f:  ldloc.1 
+       IL_0040:  bgt.s IL_0042
+                               br L4
+       IL_0042:  ldloc.2 
+       IL_0043:  ret 
+       L4:
+       IL_0044:  ldloc.2 
+       IL_0045:  ldc.i4.1 
+       IL_0046:  add 
+       IL_0047:  stloc.2 
+       IL_0048:  ldloc.2 
+       IL_0049:  ret 
+    } // end of method Tests::test_5_float_branch_nan
+
+    .method private static  hidebysig
+           default void regress_80622_inner (object x)  cil managed
+    {
+               .locals (unsigned int8 i)
+        // Method begins at RVA 0x2050
+        // Code size 14 (0xe)
+        .maxstack 8
+        IL_1000:  ldarg.0
+        IL_1001:  unbox unsigned int8
+        IL_1006:  ldobj unsigned int8
+        IL_000b:  conv.ovf.i4.un
+        IL_000c:  pop
+        IL_000d:  ret
+    }
+
+    // method line 2
+    .method private static  hidebysig
+           default int32 test_0_regress_80622 ()  cil managed
+    {
+        .maxstack 8
+        IL_0000:  ldc.i4 255
+        IL_0005:  box unsigned int8
+        IL_000a:  call void class Tests::regress_80622_inner (object)
+               ldc.i4.0
+        IL_000f:  ret
+    }
+
 }