2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / benchmark / regalloc-2.cs
blob69bb0c238f5ca930a18226a7c5b0a402255ea766
1 //
2 // Idealy, we would fold the operations from a...h into one long xor chain,
3 // we could then commute the xor operation.
4 //
5 // More realisticly, we should assign each of a...h to one reg, rather than making
6 // the two swap between two registers:
7 // (stind.i4 regvar[%edi] (xor (ldind.i4 regoffset[-0x18(%ebp)]) iconst[1]))
8 // (stind.i4 regvar[%esi] (xor (ldind.i4 regvar[%edi]) iconst[2]))
9 // (stind.i4 regvar[%edi] (xor (ldind.i4 regvar[%esi]) iconst[3]))
10 // (stind.i4 regvar[%esi] (xor (ldind.i4 regvar[%edi]) iconst[4]))
13 class T {
14 static void Main ()
16 int j = 0, k = 0, l = 0;
17 for (int i = 0; i < 50000000; i ++) {
18 int a = i ^ 1;
19 int b = a ^ 2;
20 int c = b ^ 3;
21 int d = c ^ 4;
22 int e = d ^ 5;
23 int f = e ^ 6;
24 int g = f ^ 7;
25 int h = g ^ 8;
27 j ^= h;
28 k ^= h + 1;
29 l ^= h & 5;
31 j ^= l;
32 k ^= k + 1;
33 l ^= j & 5;
35 j ^= l;
36 k ^= k + 1;
37 l ^= j & 5;