X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgshared.cs;h=a8bfee03414ab95fe515d69c2dce3f7b178af86a;hb=7a94cbe3d4bb1e0f1cf8799f363e4996c046cb40;hp=7f54d4b709de41ca9f2aff2ddfbcf7371375014d;hpb=2c0682c70f566061ab912cd7b91431f13e772f44;p=mono.git diff --git a/mono/mini/gshared.cs b/mono/mini/gshared.cs index 7f54d4b709d..a8bfee03414 100644 --- a/mono/mini/gshared.cs +++ b/mono/mini/gshared.cs @@ -732,12 +732,33 @@ public class Tests } public static int test_0_gsharedvt_ginstvt_constructed_arg () { + { + // AOT: Force a instantiation of use_kvp + long a = 1; + var t = make_kvp (a, a); + var z = use_kvp (t); + } + IFaceKVP c = new ClassKVP (); if (c.do_kvp (1) != 1) return 1; return 0; } + public static int test_0_gsharedvt_ginstvt_constructed_arg_float () { + { + // AOT: Force a instantiation of use_kvp + double a = 1; + var t = make_kvp (a, a); + var z = use_kvp (t); + } + + IFaceKVP c = new ClassKVP (); + if (c.do_kvp (1) != 1) + return 1; + return 0; + } + interface IGetter { T Get(); @@ -1760,6 +1781,115 @@ public class Tests IFaceTest t = new ClassTest (); return obj.foo (ref t); } + + // Sign extension tests + // 0x55 == 85 == 01010101 + // 0xAA == 170 == 10101010 + // 0x5555 == 21845 == 0101010101010101 + // 0xAAAA == 43690 == 1010101010101010 + // 0x55555555 == 1431655765 + // 0xAAAAAAAA == 2863311530 + // 0x5555555555555555 == 6148914691236517205 + // 0xAAAAAAAAAAAAAAAA == 12297829382473034410 + + public interface SEFace { + T Copy (int a, int b, int c, int d, T t); + } + + class SEClass : SEFace { + public T Copy (int a, int b, int c, int d, T t) { + return t; + } + } + + // Test extension + static int test_20_signextension_sbyte () { + Type t = typeof (sbyte); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + long zz = i.Copy (1,2,3,4,(sbyte)(-0x55)); + + bool success = zz == -0x55; + return success ? 20 : 1; + } + + static int test_20_signextension_byte () { + Type t = typeof (byte); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + ulong zz = i.Copy (1,2,3,4,(byte)(0xAA)); + + bool success = zz == 0xAA; + return success ? 20 : 1; + } + + static int test_20_signextension_short () { + Type t = typeof (short); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + long zz = i.Copy (1,2,3,4,(short)(-0x5555)); + + bool success = zz == -0x5555; + return success ? 20 : 1; + } + + static int test_20_signextension_ushort () { + Type t = typeof (ushort); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + ulong zz = i.Copy (1,2,3,4,(ushort)(0xAAAA)); + + bool success = zz == 0xAAAA; + return success ? 20 : 1; + } + + static int test_20_signextension_int () { + Type t = typeof (int); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + long zz = i.Copy (1,2,3,4,(int)(-0x55555555)); + + bool success = zz == -0x55555555; + return success ? 20 : 1; + } + + static int test_20_signextension_uint () { + Type t = typeof (uint); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + ulong zz = i.Copy (1,2,3,4,(uint)(0xAAAAAAAA)); + + bool success = zz == 0xAAAAAAAA; + return success ? 20 : 1; + } + + static int test_20_signextension_long () { + Type t = typeof (long); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + long zz = i.Copy (1,2,3,4,(long)(-0x5555555555555555)); + + bool success = zz == -0x5555555555555555; + return success ? 20 : 1; + } + + static int test_20_signextension_ulong () { + Type t = typeof (ulong); + object o = Activator.CreateInstance (typeof (SEClass<>).MakeGenericType (new Type[] { t })); + var i = (SEFace)o; + + ulong zz = i.Copy (1,2,3,4,(ulong)(0xAAAAAAAAAAAAAAAA)); + + bool success = zz == 0xAAAAAAAAAAAAAAAA; + return success ? 20 : 1; + } } // #13191