X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fbasic.cs;h=477af333e9b4a8401a8b6ec5ab4e7646e6044ac3;hb=468225a247b8897b2a4fa1e6bd7ffa32aa8c243b;hp=0bfd047f7ed98c9dd7854fc83afc51cb266b33e2;hpb=b80bd06ab23bd1a725a8ab35dfaa0be5c122fa78;p=mono.git diff --git a/mono/mini/basic.cs b/mono/mini/basic.cs index 0bfd047f7ed..477af333e9b 100644 --- a/mono/mini/basic.cs +++ b/mono/mini/basic.cs @@ -23,11 +23,18 @@ using System.Reflection; * the IL code looks. */ -class Tests { - - static int Main () { - return TestDriver.RunTests (typeof (Tests)); - } +#if MOBILE +class BasicTests +#else +class Tests +#endif +{ + +#if !MOBILE + public static int Main (string[] args) { + return TestDriver.RunTests (typeof (Tests), args); + } +#endif public static int test_0_return () { return 0; @@ -190,6 +197,16 @@ class Tests { return b % 8; } + public static int test_0_rem_imm_0 () { + int b = 12; + return b % 1; + } + + public static int test_0_rem_imm_0_neg () { + int b = -2; + return b % 1; + } + public static int test_4_rem_big_imm () { int b = 10004; return b % 10000; @@ -675,7 +692,21 @@ class Tests { return 1; else return 0; - } + } + + public static int test_127_iconv_to_i1 () { + int i = 0x100017f; + sbyte s = (sbyte)i; + + return s; + } + + public static int test_384_iconv_to_i2 () { + int i = 0x1000180; + short s = (short)i; + + return s; + } public static int test_15_for_loop () { int i; @@ -1216,8 +1247,9 @@ class Tests { // Avoid cfolding this i = 0; - for (int j = 0; j < 1234567; ++j) + for (int j = 0; j < 567; ++j) i ++; + i += 1234000; if ((i / 2) != 617283) return 1; if ((i / 4) != 308641) @@ -1229,8 +1261,9 @@ class Tests { // Avoid cfolding this i = 0; - for (int j = 0; j < 1234567; ++j) + for (int j = 0; j < 567; ++j) i --; + i -= 1234000; if ((i / 2) != -617283) return 5; if ((i / 4) != -308641) @@ -1275,13 +1308,64 @@ class Tests { return 0; } - /* This still doesn't work on ia64 - public static int test_0_regress_cprop_80738 () { - int hours = Int32.MinValue; - int hrssec = (hours * 3600); - long t = ((long)(hrssec) * 1000L); + public static int cmov (int i) { + int j = 0; + + if (i > 0) + j = 1; + + return j; + } + + public static int cmov2 (int i) { + int j = 0; + + if (i <= 0) + ; + else + j = 1; + + return j; + } + + public static int test_0_branch_to_cmov_opt () { + if (cmov (0) != 0) + return 1; + if (cmov (1) != 1) + return 2; + if (cmov2 (0) != 0) + return 1; + if (cmov2 (1) != 1) + return 2; + return 0; + } + + public static unsafe int test_0_ishr_sign_extend () { + // Check that ishr does sign extension from bit 31 on 64 bit platforms + uint val = 0xF0000000u; + + uint *a = &val; + uint ui = (uint)((int)(*a) >> 2); + + if (ui != 0xfc000000) + return 1; + + // Same with non-immediates + int amount = 2; + + ui = (uint)((int)(*a) >> amount); + + if (ui != 0xfc000000) + return 2; + + return 0; + } + + public static unsafe int test_0_ishr_sign_extend_cfold () { + int i = 32768; + int j = i << 16; + int k = j >> 16; - return t == 0 ? 0 : 1; + return k == -32768 ? 0 : 1; } - */ }