[llvm] Refactor the calling convention handling code a bit, add support for returning...
[mono.git] / mono / mini / iltests.il.in
index 7618fa65bf887fc202eed340bb495350138df91c..8510917341b87d747bd61318c19552789f330cf5 100644 (file)
@@ -1,4 +1,8 @@
-.assembly iltests {}
+.assembly iltests {
+  .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() =  (
+               01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
+               63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01       ) // ceptionThrows.
+}
 .assembly extern TestDriver {}
 .assembly extern mscorlib {}
 
@@ -344,7 +348,7 @@ PASS:       ldc.i4.0
         IL_000a:  ret
     }
 
-       // Check that localloc can't be inlined
+       // Check that localloc cannot be inlined
        .method static public int32 test_0_localloc_inline () cil managed {
                .maxstack 16
                .locals init (
@@ -585,6 +589,9 @@ COND:   ldloc.0
        }
 
        .method static public int32 test_24_tail_calls2 () il managed {
+               // Some platforms might not be able to AOT tail calls
+               .custom instance void class [TestDriver]CategoryAttribute::'.ctor'(string) =  (01 00 08 21 46 55 4C 4C 41 4F 54 00 00 ) // ...!FULLAOT..
+
                .maxstack 16
                .locals init (
                        int32 i,
@@ -602,6 +609,9 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_5_jmp () cil managed {
+               // Some platforms might not be able to AOT tail calls
+               .custom instance void class [TestDriver]CategoryAttribute::'.ctor'(string) =  (01 00 08 21 46 55 4C 4C 41 4F 54 00 00 ) // ...!FULLAOT..
+
                ldc.i4.1
                ldc.i4.2
                call int32 Tests::jmp2 (int32, int32)
@@ -838,6 +848,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
 
@@ -941,26 +967,14 @@ COND:   ldloc.0
                ret
        }
 
-#if !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__)
-       // 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
-       // both behaviours are valid.
-       .method public static int32 test_0_fconv_to_i () cil managed {
+       .method public static int32 test_1234_fconv_u () cil managed {
                .maxstack 16
 
-               ldc.r8 2147483648.0
-               conv.i
-               ldc.i8 2147483648
-               conv.i
-               beq L1
-               ldc.i4.1
-               ret
-       L1:
-               ldc.i4.0
+               ldc.r8 1234.0
+               conv.u
+               conv.i4
                ret
        }
-#endif
 
        .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
        {
@@ -1100,6 +1114,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)
@@ -1600,7 +1626,7 @@ COND:   ldloc.0
     .method private static  hidebysig
            default void regress_80622_inner (object x)  cil managed
     {
-               .locals (unsigned int8 i)
+               .locals init (unsigned int8 i)
         // Method begins at RVA 0x2050
         // Code size 14 (0xe)
         .maxstack 8
@@ -1835,7 +1861,7 @@ HAS_VALUE:        ldc.i4.1
 
        .method public static int32 test_0_long_shift_regalloc () cil managed
        {
-               .locals (unsigned int32 'cilsimp.28', unsigned int64 'cilsimp.27', int32 'cilsimp.26')
+               .locals init (unsigned int32 'cilsimp.28', unsigned int64 'cilsimp.27', int32 'cilsimp.26')
 
                .maxstack 4
 
@@ -2011,6 +2037,8 @@ HAS_VALUE:        ldc.i4.1
        // Code size 34 (0x22)
        .maxstack 17
        IL_0000:  ldarg.0 
+                         ldc.i4.1
+                         add
        IL_0001:  ldarg.1 
        IL_0002:  ldarg.2 
        IL_0003:  ldarg.3 
@@ -2025,7 +2053,11 @@ HAS_VALUE:       ldc.i4.1
        IL_0014:  ldarg.s 12
        IL_0016:  ldarg.s 13
        IL_0018:  ldarg.s 14
+                         ldc.i4.1
+                         add
        IL_001a:  ldarg.s 15
+                         ldc.i4.1
+                         add
                  tail.
        IL_001c:  call int32 class Tests::manyargs_callee(int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32, int32)
        IL_0021:  ret 
@@ -2033,8 +2065,11 @@ HAS_VALUE:       ldc.i4.1
 
     // method line 4
     .method public static  hidebysig 
-           default int32 test_0_many_args_tail_call ()  cil managed 
+           default int32 test_139_many_args_tail_call ()  cil managed
     {
+               // Some platforms might not be able to AOT tail calls
+               .custom instance void class [TestDriver]CategoryAttribute::'.ctor'(string) =  (01 00 08 21 46 55 4C 4C 41 4F 54 00 00 ) // ...!FULLAOT..
+
         // Method begins at RVA 0x2154
        // Code size 43 (0x2b)
        .maxstack 17
@@ -2055,13 +2090,7 @@ HAS_VALUE:       ldc.i4.1
        IL_0014:  ldc.i4.s 0x0f
        IL_0016:  ldc.i4.s 0x10
        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)
-       IL_001d:  ldc.i4 136
-       IL_0022:  beq IL_0029
-
-       IL_0027:  ldc.i4.1 
        IL_0028:  ret 
-       IL_0029:  ldc.i4.0 
-       IL_002a:  ret 
     } // end of method main::Main
 
        .class nested private auto ansi beforefieldinit R1
@@ -2266,7 +2295,7 @@ OK_2:
 
        .method public static int32 test_0_regalloc_regress_497271 () cil managed
        {
-               .locals (int32 var)
+               .locals init (int32 var)
 
                ldc.i4  4
                stsfld  int32 Tests::shift1
@@ -2364,4 +2393,392 @@ OK_2:
                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
+    }
+
+       .method public static default int32 test_0_wrap_non_exception_throws () cil managed
+       {
+         .try {
+                   newobj instance void class [mscorlib]System.Object::'.ctor'()
+                       throw
+                 leave IL_0
+         } catch class [mscorlib]System.Runtime.CompilerServices.RuntimeWrappedException {
+                 leave IL_0
+               }
+               IL_0:
+               ldc.i4.0
+               ret
+    }
+
+       .method public static default int32 test_0_typespec_modopt () cil managed {
+               ldtoken class Tests modopt (Tests)
+               pop
+               ldc.i4.0
+               ret
+       }
+
+       .method public hidebysig static int32 SizeOfT<T>() cil managed
+       {
+               .maxstack  8
+    
+               sizeof !!0
+       ret
+       }
+
+       .method public static default int32 test_1_sizeof_gshared () cil managed {
+           call   int32 Tests::SizeOfT<int8>()
+               ldc.i4.1
+               ceq
+               ret
+       }
+
+       .method public static default int32 test_1_sizeof_ref () cil managed {
+           call   int32 Tests::SizeOfT<object>()
+               sizeof [mscorlib]System.IntPtr
+               ceq
+               ret
+       }
+
+  .field static public int32 volatile_int
+
+       .method public static default int32 test_5_volatile_load_store () cil managed {
+               ldsflda int32 class Tests::volatile_int
+               ldc.i4 5
+               volatile.
+               stind.i4
+               ldsflda int32 class Tests::volatile_int
+               volatile.
+               ldind.i4
+               ret
+       }               
+
+    .method public static 
+           default int32 regress_693905_inner (int32 x, int32 acc)  cil managed 
+    {
+        // Method begins at RVA 0x2050
+        // Code size 17 (0x11)
+        .maxstack 5
+        IL_0000:  ldarg.0 
+        IL_0001:  brtrue.s IL_0005
+
+        IL_0003:  ldarg.1 
+        IL_0004:  ret 
+        IL_0005:  ldarg.0 
+        IL_0006:  ldc.i4.1 
+        IL_0007:  sub 
+        IL_0008:  ldarg.1 
+        IL_0009:  ldc.i4.1 
+        IL_000a:  add 
+        IL_000b:  starg.s 1
+        IL_000d:  starg.s 0
+        IL_000f:  br.s IL_0000
+
+    } // end of method Test::f
+
+    .method public static 
+           default int32 test_10_regress_693905 ()  cil managed 
+       {
+               ldc.i4.s 0x0a
+        ldc.i4.0 
+        call int32 class Tests::regress_693905_inner(int32, int32)
+               ret
+       }
+
+       .method public static
+                       default int32 test_0_llvm_regress_171 () cil managed
+       {
+               .locals init (
+                       int32 i
+               )
+
+               call int32 Tests::return_1_noinline ()
+               ldc.i4.1
+               beq L1
+               ldc.i4.1
+               stloc.s 0
+               call int32 Tests::return_1_noinline ()
+               ldc.i4.0
+               beq L1
+               L1:
+               ldloc.s 0
+               ret
+       }
+
+     .field  public static int32 static_a
+
+       .method public static
+                       default int32 test_4_ldfld_stfld_static () cil managed
+       {
+               ldnull
+               ldc.i4 2
+               stfld int32 Tests::static_a
+               ldnull
+               ldfld int32 Tests::static_a
+               ldnull
+               ldflda int32 Tests::static_a
+               ldind.i4
+               add
+               ret
+       }
+
+  .method public static default int32 no_initlocals_inner () cil managed
+  {
+    .locals (
+       int32 V_0,
+       float32 V_1,
+       float64 V_2,
+       valuetype Tests/TailCallStruct V_3)
+       ldloc V_0
+       ret
+  }
+
+  .method public static default int32 test_0_no_initlocals () cil managed
+  {
+       call int32 Tests::no_initlocals_inner()
+       pop
+          ldc.i4.0
+       ret
+  }
+
+  .method public hidebysig static int32  test_5_r4_fadd_mixed() cil managed
+  {
+    // Code size       17 (0x11)
+    .maxstack  2
+    .locals init (float32 V_0,
+             float64 V_1)
+    IL_0000:  ldc.r4     3
+    IL_0005:  stloc.0
+    IL_0006:  ldc.r8     2
+    IL_000b:  stloc.1
+    IL_000c:  ldloc.0
+    IL_000d:  ldloc.1
+    IL_000e:  add
+    IL_000f:  conv.i4
+    IL_0010:  ret
+  }
+
+ .method public hidebysig static int32  test_0_fcmp_eq_r4_mixed() cil managed
+  {
+    // Code size       32 (0x20)
+    .maxstack  2
+    .locals init (float32 V_0,
+             float64 V_1)
+    IL_0000:  ldc.r4     1
+    IL_0005:  stloc.0
+    IL_0006:  ldc.r8     1
+    IL_000f:  stloc.1
+    IL_0010:  ldloc.0
+    IL_0012:  ldloc.1
+    IL_0013:  bne.un     IL_001e
+
+    IL_0018:  ldc.i4.0
+    IL_0019:  br         IL_001f
+
+    IL_001e:  ldc.i4.1
+    IL_001f:  ret
+  } // end of method Tests::test_0_fcmp_eq_r4_mixed
+
+  .method public hidebysig static int32  test_0_fceq_r4_mixed() cil managed
+  {
+    // Code size       31 (0x1f)
+    .maxstack  2
+    .locals init (float32 V_0,
+             float64 V_1,
+             bool V_2)
+    IL_0000:  ldc.r4     1
+    IL_0005:  stloc.0
+    IL_0006:  ldc.r8     1
+    IL_000b:  stloc.1
+    IL_000c:  ldloc.0
+    IL_000d:  ldloc.1
+    IL_000e:  ceq
+    IL_0010:  stloc.2
+    IL_0011:  ldloc.2
+    IL_0012:  brfalse    IL_001d
+
+    IL_0017:  ldc.i4.0
+    IL_0018:  br         IL_001e
+
+    IL_001d:  ldc.i4.1
+    IL_001e:  ret
+  } // end of method Tests::test_0_fceq_r4
 }