New tests.
[mono.git] / mono / mini / iltests.il.in
index dd1f641db2dec115a9204a9abd823d9c8148c180..d151b2d9f62329479a29c8bcfd2079af22141380 100644 (file)
@@ -486,7 +486,52 @@ COND:   ldloc.0
                ret
        }
 
-       .method static public int32 test_0_tail_calls () il managed {
+       .class nested private auto ansi sealed beforefieldinit TailCallStructBig
+               extends [mscorlib]System.ValueType {
+               .field public int32 a
+               .field public int32 b
+               .field public int32 c
+               .field public int32 d
+               .field public int32 e
+       }
+
+       .method static valuetype Tests/TailCallStructBig tail_vret_by_addr_inner (valuetype Tests/TailCallStructBig arg) {
+               ldarga 0
+               ldarga 0
+               ldfld int32 Tests/TailCallStructBig::a
+               ldc.i4.1
+               add
+               stfld int32 Tests/TailCallStructBig::a
+               ldarg.0
+               ret
+       }
+
+       .method static valuetype Tests/TailCallStructBig tail_vret_by_addr (valuetype Tests/TailCallStructBig arg) {
+               ldarg.0
+               tail.
+               call valuetype Tests/TailCallStructBig Tests::tail_vret_by_addr_inner (valuetype Tests/TailCallStructBig)
+               ret
+       }
+
+       .method static public int32 test_3_tail_call_vret_by_addr () il managed {
+               .maxstack 16
+               .locals init (
+                       valuetype Tests/TailCallStructBig arg2
+               )
+
+               ldloca 0
+               ldc.i4.2
+               stfld int32 Tests/TailCallStructBig::a
+               ldloc.0
+               call valuetype Tests/TailCallStructBig Tests::tail_vret_by_addr (valuetype Tests/TailCallStructBig)
+               stloc.0
+
+               ldloca 0
+               ldfld int32 Tests/TailCallStructBig::a
+               ret
+       }
+
+       .method static public int32 test_9_tail_call_vret_by_val () il managed {
                .maxstack 16
                .locals init (
                        valuetype Tests/TailCallStruct arg
@@ -500,13 +545,12 @@ COND:   ldloc.0
                ldloc.0
                call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
                stloc.0
+
                ldloca 0
                ldfld int32 Tests/TailCallStruct::a
                ldloca 0
                ldfld int32 Tests/TailCallStruct::b
                add
-               ldc.i4 9
-               sub
                ret
        }
 
@@ -794,6 +838,22 @@ COND:   ldloc.0
                ret
        }
 
+       .method public static int32 test_0_lconv_to_ovf_i8 () cil managed {
+               .maxstack 16
+
+               ldc.i4 1234
+               conv.i8
+               conv.ovf.i8
+               conv.i4
+               ldc.i4 1234
+               beq L1
+               ldc.i4.1
+               ret
+       L1:
+               ldc.i4.0
+               ret
+       }
+
        .method public static int32 test_0_lconv_to_ovf_u8_un () cil managed {
                .maxstack 16
 
@@ -897,7 +957,7 @@ COND:   ldloc.0
                ret
        }
 
-#if !defined(__ppc__) && !defined(__powerpc__)
+#if !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__sparc__)
        // PPC handles overflow by clipping, but this test assumes
        // no overflow handling.  According to ECMA the result of
        // float->int conversion is undefined if overflow occurs, so
@@ -1056,6 +1116,18 @@ COND:   ldloc.0
         ret
        }
 
+       .method public static int32 test_7_conv_ovf_u4_un () {
+       .maxstack  2
+        .locals    init (unsigned int32)
+
+        ldc.i4.7
+        conv.ovf.u4.un
+        stloc.0
+               ldloc.0
+               conv.i4
+        ret
+       }
+
        .method public static int32 test_1_bug_74591 () {
                .maxstack 16
                .locals init (int32)
@@ -2083,4 +2155,422 @@ HAS_VALUE:      ldc.i4.1
                ldc.i4.1
                ret
        }
+
+   .method public static hidebysig default int32 cmov_opt_regress_474718_inner (int32 A_1)  cil managed 
+   {
+      .maxstack 3
+      .locals init (int32 V_0, bool V_1, bool V_2)
+      
+         ldc.i4.0
+      IL_000b:  stloc.1 
+      IL_000d:  br IL_002f
+
+         ldc.i4.1    
+         stloc.2
+      IL_001e:  ldloc.2 
+      IL_001f:  brfalse IL_0036
+
+      IL_0024:  
+      IL_002a:  br IL_0041
+    
+      IL_002f:  ldloc.1
+      IL_0030:  stloc.2 
+      IL_0031:  br IL_001e
+    
+      IL_0036:  ldc.i4 0
+      IL_003b:  stloc.0 
+      IL_003c:  br IL_0041
+    
+      IL_0041:  ldloc.0 
+      IL_0042:  ret 
+  } 
+
+    .method public static default int32 test_0_cmov_opt_regress_474718 ()  cil managed 
+    {
+        .maxstack 16
+        ldc.i4.1
+        call int32 Tests::cmov_opt_regress_474718_inner (int32)
+        ret
+   }
+
+       .method public static default int32 test_5_createarr_newobj () cil managed
+       {
+               .maxstack 16
+
+               ldc.i4 5
+               newobj void char[]::.ctor(int32)
+               ldlen
+               ret
+       }
+
+       .method public static default int32 test_0_initblk_3_regress_481458 () cil managed
+       {
+               .maxstack 16
+               .locals init (native int)
+
+               ldc.i4.s 10
+               localloc
+               stloc.0
+
+               // Set the first value to 3
+               ldloc.0
+               ldc.i4.0
+               add             //addr
+               ldc.i4.3        //value
+               stind.i1
+
+               // Zero out the first 3 values
+               ldloc.0         //addr
+               ldc.i4.0        //value
+               ldc.i4.s 3      //size
+               initblk
+
+               // Load the first value
+               ldloc.0
+               ldc.i4.0
+               add     
+               ldind.u1
+               conv.i4
+               ret
+       }
+
+       .method public static float32 GetFloat32() cil managed noinlining
+       {
+               .maxstack  8
+               ldc.r8     0.19975845134874831
+               ret
+       }
+
+/*        Disabled until they can be fixed to run on amd64
+       .method public static default int32 test_0_implicit_float_to_double_conversion () cil managed
+       {
+               .maxstack 16
+
+               call float32 Tests::GetFloat32()
+               ldc.r8     0.19975845134874831
+               beq OK
+
+               ldc.i4.1
+               ret
+OK:
+               ldc.i4.0
+               ret
+       }
+*/
+
+       .method public static default int32 test_0_long_to_r8_un_overflow () cil managed
+       {
+               .maxstack 16
+               ldc.i8     0x00FFFFFFFFFFFFFF
+               conv.r.un
+               conv.i8
+               ldc.i8 0x100000000000000
+               beq OK_1
+
+               ldc.i4.1
+               ret
+OK_1:
+               ldc.i8     0x00FFFFFFFFFFFFFF
+               conv.r.un
+               conv.r8
+               conv.i8
+               ldc.i8 0x100000000000000
+               beq OK_2
+
+               ldc.i4.2
+               ret
+OK_2:
+               ldc.i4.0
+               ret
+       }
+
+       .field public static int32 shift1
+
+       .method public static int32 regress_497271_helper (int32 i) cil managed
+       {
+               ldarg.0
+               ret
+       }
+
+       .method public static int32 test_0_regalloc_regress_497271 () cil managed
+       {
+               .locals (int32 var)
+
+               ldc.i4  4
+               stsfld  int32 Tests::shift1
+               ldsfld  int32 Tests::shift1
+               stloc   var
+               ldc.i4  4660
+               ldloc   var
+               shr.un
+               ldc.i4  4660
+               ldc.i4  32
+               ldloc   var
+               sub
+               shl
+               or
+               ldc.i4  1073742115
+               beq     ?L10
+?L9:
+               ldc.i4  1
+               call    int32 Tests::regress_497271_helper (int32)
+               ret
+?L10:
+               ldc.i4  0
+               call    int32 Tests::regress_497271_helper (int32)
+               ret
+       }
+
+   .field  private static  int32 Value
+
+  .method public static hidebysig  specialname 
+          default int32 regress_513931_inner ()  cil managed 
+    {                                                                 
+        // Method begins at RVA 0x225c                                
+        // Code size 52 (0x34)                                        
+        .maxstack 2                                                   
+        .locals init (                                                
+                int32   V_0,                                          
+                int32   V_1,                                          
+                bool    V_2)
+                       
+                               ldc.i4 999
+                               stsfld int32 Tests::Value
+
+        IL_0000:  nop                                                 
+        IL_0001:  ldsfld int32 Tests::Value      
+        IL_0006:  stloc.0                                             
+        IL_0007:  ldloc.0                                             
+        IL_0008:  ldc.i4.0                                            
+        IL_0009:  cgt                                                 
+        IL_000b:  ldc.i4.0                                            
+        IL_000c:  ceq                                                 
+        IL_000e:  stloc.2                                             
+        IL_000f:  ldloc.2                                             
+        IL_0010:  brtrue.s IL_0027                                    
+
+        IL_0012:  nop 
+        IL_0013:  ldloc.0 
+        IL_0014:  ldc.i4.s 0x7b
+        IL_0016:  ceq          
+        IL_0018:  ldc.i4.0     
+        IL_0019:  ceq          
+        IL_001b:  stloc.2      
+        IL_001c:  ldloc.2      
+        IL_001d:  brtrue.s IL_0023
+
+        IL_001f:  ldc.i4.m1 
+        IL_0020:  stloc.1   
+        IL_0021:  br.s IL_0032
+
+        IL_0023:  ldc.i4.1 
+        IL_0024:  stloc.1  
+        IL_0025:  br.s IL_0032
+
+        IL_0027:  
+        IL_002c:  newobj instance void class [mscorlib]System.Exception::'.ctor'()
+        IL_0031:  throw                                                                            
+        IL_0032:  ldloc.1                                                                          
+        IL_0033:  ret                                                                              
+    }
+
+       .method public static hidebysig  specialname 
+         default int32 test_0_regress_513931 ()  cil managed 
+       {
+               call int32 Tests::regress_513931_inner ()
+               pop
+               ldc.i4.0
+               ret
+       }
+
+       .method public static default int32 test_0_newarr_i8 () cil managed
+       {
+               ldc.i4 1000
+               conv.i8
+               newarr [mscorlib]System.Boolean
+               pop
+               ldc.i4 0
+               ret
+       }
+
+       .method public static specialname 
+              default int32 return_1_noinline ()  cil managed noinlining 
+       {
+               .maxstack 0
+
+               ldc.i4.1
+               ret 
+       }
+
+       // Only happens with -O=-deadce,cmov
+       .method public static default int32 test_0_cmov_unused_582322 () cil managed
+       {
+        .maxstack 2                                                   
+        .locals init (                                                
+                               int32 V_0
+               )                               
+               call int32 Tests::return_1_noinline ()
+               ldc.i4.1
+               bne.un L0
+               ldloc.s 0
+               pop
+       L0:
+               ldc.i4.0
+               ret
+       }
+
+    .method public static  hidebysig 
+           default int32 test_0_regress_586664 ()  cil managed 
+    {                                        
+        // Method begins at RVA 0x20f4       
+        // Code size 76 (0x4c)               
+        .maxstack 6                          
+        .locals init (                       
+                float64 V_0,                 
+                float64[]       V_1)         
+        IL_0000:  ldc.r8 1.                  
+        IL_0009:  ldc.r8 2.                  
+        IL_0012:  ldc.r8 1.                  
+        IL_001b:  call float64 class [mscorlib]System.Math::Pow(float64, float64)
+        IL_0020:  div                                                            
+        IL_0021:  stloc.0                                                        
+        IL_0022:  ldc.i4.2                                                       
+        IL_0023:  newarr [mscorlib]System.Double                                 
+        IL_0028:  dup                                                            
+        IL_0029:  ldc.i4.0                                                       
+        IL_002a:  ldloc.0                                                        
+        IL_002b:  neg                                                            
+        IL_002c:  stelem.r8                                                      
+        IL_002d:  dup                                                            
+        IL_002e:  ldc.i4.1                                                       
+        IL_002f:  ldloc.0
+        IL_0030:  neg
+        IL_0031:  stelem.r8
+        IL_0032:  stloc.1
+        IL_0033:  ldloc.1
+        IL_0034:  ldc.i4.0
+        IL_0035:  ldelem.r8
+        IL_0036:  ldc.r8 -0.5
+        IL_003f:  bne.un IL_004a
+
+        IL_0044:  ldc.i4.0
+        IL_0045:  br IL_004b
+
+        IL_004a:  ldc.i4.1
+        IL_004b:  ret
+    }
+
+       .method public static int32 test_2_leave_multiple_blocks_from_end ()
+       {
+               .locals init (int32 V_0)
+
+               .try {
+                       .try {
+                               nop
+                               nop
+                               leave END
+                       } finally {
+                               ldloc.0
+                               ldc.i4.1
+                               add
+                               stloc.0
+                               endfinally
+                       }
+                       nop
+                       leave END
+               } finally {
+                       ldloc.0
+                       ldc.i4.1
+                       add
+                       stloc.0
+                       endfinally
+               }
+END:
+               ldloc.0
+               ret
+       }
+
+       .method public static int32 test_3_leave_multiple_blocks_from_hole ()
+       {
+               .locals init (int32 V_0)
+
+               .try {
+                       .try {
+                               ldloc.0
+                               brtrue REST
+                               leave BEFORE_END
+REST:
+                               nop
+                               nop
+                               leave END
+                       } finally {
+                               ldloc.0
+                               ldc.i4.1
+                               add
+                               stloc.0
+                               endfinally
+                       }
+                       nop
+                       leave END
+               } finally {
+                       ldloc.0
+                       ldc.i4.1
+                       add
+                       stloc.0
+                       endfinally
+               }
+BEFORE_END:
+               ldloc.0
+               ldc.i4.1
+               add
+               stloc.0
+END:
+               ldloc.0
+               ret
+       }
+
+       .class nested private auto ansi sealed beforefieldinit Pair`2<TKey,TValue>
+                  extends [mscorlib]System.ValueType
+       {
+               .field  public  !0 key
+       .field  public  !1 'value'
+       }
+
+    .method private static hidebysig 
+           default bool ContentEquals<TKey,TValue> (valuetype Tests/Pair`2<!!TKey, !!TValue> v)  cil managed 
+    {
+       .maxstack 8
+       IL_0000:  ldarga.s 0 
+       IL_0006:  ldnull 
+                         constrained. valuetype Tests/Pair`2<!!0,!!1>
+       IL_0007:  callvirt instance bool class [mscorlib]System.Object::Equals(object)
+                         ret
+    }
+
+    .method public static hidebysig default int32 test_0_constrained_gshared_595863 () cil managed
+    {
+               .locals init (
+               valuetype Tests/Pair`2<string, string>  V_0,
+               valuetype Tests/Pair`2<string, string>  V_1)
+       IL_0000:  ldloca.s 0
+       IL_0002:  initobj valuetype Tests/Pair`2<string,string>
+       IL_0008:  ldloc.0 
+       IL_0009:  stloc.1 
+       IL_000a:  ldloca.s 1
+       IL_000c:  ldstr "A"
+       IL_0011:  stfld !0 valuetype Tests/Pair`2<string,string>::key
+       IL_0016:  ldloca.s 1
+       IL_0018:  ldstr "B"
+       IL_001d:  stfld !1 valuetype Tests/Pair`2<string,string>::'value'
+       IL_0022:  ldloc.1 
+       IL_0023:  stloc.0 
+       IL_0024:  ldloc.0 
+       IL_0025:  call bool class Tests::ContentEquals<string, string> (valuetype Tests/Pair`2<!!0,!!1>)
+                         brfalse SUCCESS
+                         ldc.i4.1
+                         ret
+       SUCCESS:
+                         ldc.i4.0
+                         ret
+    }
 }