2007-01-28 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 28 Jan 2007 09:13:31 +0000 (09:13 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sun, 28 Jan 2007 09:13:31 +0000 (09:13 -0000)
* basic.cs objects.cs iltests.il: Merge tests from the linear IL branch.

svn path=/trunk/mono/; revision=71799

mono/mini/ChangeLog
mono/mini/basic.cs
mono/mini/iltests.il
mono/mini/objects.cs

index 73cafb2216bae91be50f3f3aeb69bee6074e033c..a9901f4ba4d71e183c3a2a9ae963697a673d866e 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-28  Zoltan Varga  <vargaz@gmail.com>
+
+       * basic.cs objects.cs iltests.il: Merge tests from the linear IL branch.
+
 2007-01-27  Zoltan Varga  <vargaz@gmail.com>
 
        * mini-amd64.c (peephole_pass): Remove optimizations which omit a 
index 1368e79293b2dc938eb85736768cfd4b3248d841..45e449430939e74bc54eae78956383f035d0c612 100644 (file)
@@ -1210,4 +1210,69 @@ class Tests {
 
                return (int)(i % j);
        }
+
+       public static int test_0_div_opt () {
+               int i;
+
+               // Avoid cfolding this
+               i = 0;
+               for (int j = 0; j < 1234567; ++j)
+                       i ++;
+               if ((i / 2) != 617283)
+                       return 1;
+               if ((i / 4) != 308641)
+                       return 2;
+               if ((i / 8) != 154320)
+                       return 3;
+               if ((i / 16) != 77160)
+                       return 4;
+
+               // Avoid cfolding this
+               i = 0;
+               for (int j = 0; j < 1234567; ++j)
+                       i --;
+               if ((i / 2) != -617283)
+                       return 5;
+               if ((i / 4) != -308641)
+                       return 6;
+               if ((i / 8) != -154320)
+                       return 7;
+               if ((i / 16) != -77160)
+                       return 8;
+
+               return 0;
+       }
+
+       public static int test_0_rem_opt () {
+               int i;
+
+               // Avoid cfolding this
+               i = 0;
+               for (int j = 0; j < 29; ++j)
+                       i ++;
+               if ((i % 2) != 1)
+                       return 1;
+               if ((i % 4) != 1)
+                       return 2;
+               if ((i % 8) != 5)
+                       return 3;
+               if ((i % 16) != 13)
+                       return 4;
+
+               // Avoid cfolding this
+               i = 0;
+               for (int j = 0; j < 29; ++j)
+                       i --;
+               if ((i % 2) != -1)
+                       return 5;
+               if ((i % 4) != -1)
+                       return 6;
+               if ((i % 8) != -5)
+                       return 7;
+               if ((i % 16) != -13)
+                       return 8;
+
+               return 0;
+       }
+
 }
index a23b749a4e19a6900e393eb191176c46d3c87b0d..eeebe6ef3a6e9bb6acd903707aa1003e1251c040 100644 (file)
@@ -612,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
@@ -621,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
@@ -1023,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)
@@ -1049,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
index 9878a61baeba948d38b12625734fc4dc61f22b23..7ec3553d455a7273fdcaaa2d40de951d54496633 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.Text;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
@@ -248,17 +249,27 @@ class Tests {
                return 0;
        }
 
+       static int receive_small_sparc_many_args (int a, int a2, int a3, int a4, int a5, int a6, Small v, int b) {
+               if (v.b1 != 1)
+                       return 1;
+               if (v.b2 != 2)
+                       return 2;
+               return 0;
+       }
+
        static int test_5_pass_small_struct () {
                Small v = get_small (1);
                if (receive_small (7, v, 9) != 0)
                        return 0;
                if (receive_small (7, get_small (1), 9) != 0)
                        return 1;
+               if (receive_small_sparc_many_args (1, 2, 3, 4, 5, 6, v, 9) != 0)
+                       return 2;
                v = return_small (v);
                if (v.b1 != 1)
-                       return 2;
-               if (v.b2 != 2)
                        return 3;
+               if (v.b2 != 2)
+                       return 4;
                return 5;
        }
 
@@ -1001,6 +1012,14 @@ ncells ) {
                return i - i;
        }
 
+       static int test_0_intrins_string_setchar () {
+               StringBuilder sb = new StringBuilder ("ABC");
+
+               sb [1] = 'D';
+
+               return sb.ToString () == "ADC" ? 0 : 1;
+       }
+
        public class Bar {
                bool allowLocation = true;
         Foo f = new Foo ();