* basic.cs objects.cs iltests.il: Merge tests from the linear IL branch.
svn path=/trunk/mono/; revision=71799
+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
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;
+ }
+
}
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
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
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)
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
using System;
+using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
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;
}
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 ();