a test for cond. const propagation in switch statements
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 25 Mar 2003 10:07:16 +0000 (10:07 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 25 Mar 2003 10:07:16 +0000 (10:07 -0000)
svn path=/trunk/mono/; revision=12811

mono/benchmark/Makefile.am
mono/benchmark/switch.cs [new file with mode: 0755]

index 00b5f44c880ee04485baed3824a219a04a1aeec6..0d6edeff7f39cb98e833b3bac685c33528047eae 100644 (file)
@@ -15,6 +15,7 @@ TESTSRC=                      \
        loops.cs                \
        initlocals.cs           \
        logic.cs                \
+       switch.cs               \
        bulkcpy.il              \
        math.cs
 
diff --git a/mono/benchmark/switch.cs b/mono/benchmark/switch.cs
new file mode 100755 (executable)
index 0000000..da3cb9d
--- /dev/null
@@ -0,0 +1,26 @@
+public class Tests {
+
+       public static int Main () {
+               int n = 2;
+               int b = 0;
+
+               for (int i = 0; i < 1000000000; i++) {
+                       switch (n) {
+                       case 0: b = 2; break;
+                       case 1: b = 3; break;
+                       case 2: b = 4; break;
+                       case -1: b = 5; break;
+                       default:
+                               b = 6;
+                               break;
+                       }
+               }
+
+               if (b != 4)
+                       return 1;
+               
+               return 0;
+       }
+}
+
+