Add some new benchmarks. They will be added to the makefile after the freeze
[mono.git] / mono / benchmark / regvar.cs
diff --git a/mono/benchmark/regvar.cs b/mono/benchmark/regvar.cs
new file mode 100644 (file)
index 0000000..4f5e0a3
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// We get stuff like:
+//  48:        8b c3                   mov    eax,ebx
+//  4a:        8b cf                   mov    ecx,edi
+//  4c:        0b c1                   or     eax,ecx
+//  4e:        8b d8                   mov    ebx,eax
+//
+
+using System;
+class T {
+       static void Main () {
+               int i = Environment.TickCount;
+               new T ().X ();
+               Console.WriteLine (Environment.TickCount - i);
+       }
+       
+       void X () {
+               int a = 0, b = 0, c = 0, d = 0;
+               for (int i = 0; i < 50000000; i ++) {
+                       
+                       
+                       a |= b;
+                       b |= c;
+                       c |= d;
+                       b |= d;
+                       
+                       a ^= b;
+                       b ^= c;
+                       c ^= d;
+                       b ^= d;
+                       
+                       a &= b;
+                       b &= c;
+                       c &= d;
+                       b &= d;
+                       
+                       a += b;
+                       b += c;
+                       c += d;
+                       b += d;
+               }
+       }
+}
\ No newline at end of file