2007-01-28 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / basic.cs
index 53fe900d5dacc5f6573d9aa89a88e96a4ffbbb2f..45e449430939e74bc54eae78956383f035d0c612 100644 (file)
@@ -250,7 +250,7 @@ class Tests {
                return (int)res;
        }
 
-       public static int test_0_add_ovf () {
+       public static int test_0_add_ovf1 () {
                int i, j, k;
 
                checked {
@@ -261,6 +261,11 @@ class Tests {
 
                if (k != System.Int32.MinValue)
                        return 1;
+               return 0;
+       }
+
+       public static int test_0_add_ovf2 () {
+               int i, j, k;
 
                checked {
                        i = System.Int32.MaxValue;
@@ -270,6 +275,11 @@ class Tests {
 
                if (k != System.Int32.MaxValue)
                        return 2;
+               return 0;
+       }
+
+       public static int test_0_add_ovf3 () {
+               int i, j, k;
 
                checked {
                        i = System.Int32.MinValue;
@@ -279,6 +289,11 @@ class Tests {
 
                if (k != -1)
                        return 3;
+               return 0;
+       }
+
+       public static int test_0_add_ovf4 () {
+               int i, j, k;
 
                checked {
                        i = System.Int32.MaxValue;
@@ -288,6 +303,11 @@ class Tests {
 
                if (k != -1)
                        return 4;
+               return 0;
+       }
+
+       public static int test_0_add_ovf5 () {
+               int i, j, k;
 
                checked {
                        i = System.Int32.MinValue + 1234;
@@ -297,6 +317,11 @@ class Tests {
 
                if (k != System.Int32.MinValue)
                        return 5;
+               return 0;
+       }
+
+       public static int test_0_add_ovf6 () {
+               int i, j, k;
 
                checked {
                        i = System.Int32.MaxValue - 1234;
@@ -317,7 +342,7 @@ class Tests {
                return number == n ? 0 : 1;
        }
 
-       public static int test_0_sub_ovf () {
+       public static int test_0_sub_ovf1 () {
                int i, j, k;
 
                checked {
@@ -329,6 +354,12 @@ class Tests {
                if (k != System.Int32.MinValue)
                        return 1;
 
+               return 0;
+       }
+
+       public static int test_0_sub_ovf2 () {
+               int i, j, k;
+
                checked {
                        i = System.Int32.MaxValue;
                        j = 0;
@@ -338,6 +369,12 @@ class Tests {
                if (k != System.Int32.MaxValue)
                        return 2;
 
+               return 0;
+       }
+
+       public static int test_0_sub_ovf3 () {
+               int i, j, k;
+
                checked {
                        i = System.Int32.MinValue;
                        j = System.Int32.MinValue + 1234;
@@ -347,6 +384,12 @@ class Tests {
                if (k != -1234)
                        return 3;
 
+               return 0;
+       }
+
+       public static int test_0_sub_ovf4 () {
+               int i, j, k;
+
                checked {
                        i = System.Int32.MaxValue;
                        j = 1234;
@@ -356,6 +399,12 @@ class Tests {
                if (k != System.Int32.MaxValue - 1234)
                        return 4;
 
+               return 0;
+       }
+
+       public static int test_0_sub_ovf5 () {
+               int i, j, k;
+
                checked {
                        i = System.Int32.MaxValue - 1234;
                        j = -1234;
@@ -365,6 +414,12 @@ class Tests {
                if (k != System.Int32.MaxValue)
                        return 5;
 
+               return 0;
+       }
+
+       public static int test_0_sub_ovf6 () {
+               int i, j, k;
+
                checked {
                        i = System.Int32.MinValue + 1234;
                        j = 1234;
@@ -1155,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;
+       }
+
 }