From: Zoltan Varga Date: Sun, 28 Jan 2007 09:13:31 +0000 (-0000) Subject: 2007-01-28 Zoltan Varga X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=f35a601c56f922bdb8e351645c810607d933159e;p=mono.git 2007-01-28 Zoltan Varga * basic.cs objects.cs iltests.il: Merge tests from the linear IL branch. svn path=/trunk/mono/; revision=71799 --- diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 73cafb2216b..a9901f4ba4d 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,7 @@ +2007-01-28 Zoltan Varga + + * basic.cs objects.cs iltests.il: Merge tests from the linear IL branch. + 2007-01-27 Zoltan Varga * mini-amd64.c (peephole_pass): Remove optimizations which omit a diff --git a/mono/mini/basic.cs b/mono/mini/basic.cs index 1368e79293b..45e44943093 100644 --- a/mono/mini/basic.cs +++ b/mono/mini/basic.cs @@ -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; + } + } diff --git a/mono/mini/iltests.il b/mono/mini/iltests.il index a23b749a4e1..eeebe6ef3a6 100644 --- a/mono/mini/iltests.il +++ b/mono/mini/iltests.il @@ -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 diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index 9878a61baeb..7ec3553d455 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -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 ();