Revert dfa9220e8b7e89c29447a71c7b30d5a9a3cbdfec.
[mono.git] / mono / mini / basic.cs
index 3f736d506932733084a923eb9f1bbc5907a91fd9..b700efa87e39503de0291560b09a388d4600241e 100644 (file)
@@ -195,6 +195,11 @@ class Tests {
                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;
@@ -1235,8 +1240,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)
@@ -1248,8 +1254,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)
@@ -1326,16 +1333,32 @@ class Tests {
                return 0;
        }
 
-       //repro for #505375
-       public static int test_2_cprop_bug () {
-               int idx = 0;
-               int a = 1;
-               var cmp = System.Collections.Generic.Comparer<int>.Default ;
-               if (cmp.Compare (a, 0) > 0)
-                       a = 0;
-               do { idx++; } while (cmp.Compare (idx - 1, a) == 0);
-               return idx;
+       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 k == -32768 ? 0 : 1;
+       }
+}
\ No newline at end of file