[Mono-bugs] [Bug 81981][Nor] Changed - [PERF] Up to 4x slower unsafe code

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jul 1 06:55:49 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by marek.safar at seznam.cz.

http://bugzilla.ximian.com/show_bug.cgi?id=81981

--- shadow/81981	2007-06-30 16:01:32.000000000 -0400
+++ shadow/81981.tmp.7792	2007-07-01 06:55:49.000000000 -0400
@@ -119,6 +119,66 @@
 I am wondering whether I should change mcs to produce different code too.
 
 ------- Additional Comments From vargaz at gmail.com  2007-06-30 16:01 -------
 What platform is this ? It might be the fact that our x86 jit uses the
 x87 instruction set, while MS might be using the SSE instruction set.
 
+
+------- Additional Comments From marek.safar at seznam.cz  2007-07-01 06:55 -------
+I ran it on 32-bit x86, with SIMD support. However, when I checked
+what MS JIT produces it uses only 2 SSE2 instructions (MOVSD + CVTTSD2SI).
+
+Here is the important part of JITed code.
+
+			for (int runs = 0; runs < 100000; runs++) {
+000000a4  xor         edx,edx 
+000000a6  mov         dword ptr [ebp-28h],edx 
+000000a9  nop              
+000000aa  jmp         0000012C 
+				byte* pointer = fixed_array;
+000000af  mov         edi,dword ptr [ebp-24h] 
+000000b2  mov         esi,edi 
+				byte* end = fixed_array + 999;
+000000b4  mov         edi,dword ptr [ebp-24h] 
+000000b7  add         edi,3E7h 
+000000bd  mov         dword ptr [ebp-2Ch],edi 
+000000c0  nop              
+000000c1  jmp         00000124 
+					blue = pointer[0];
+000000c3  movzx       eax,byte ptr [esi] 
+000000c6  mov         dword ptr [ebp-20h],eax 
+					green = pointer[1];
+000000c9  movzx       eax,byte ptr [esi+1] 
+000000cd  mov         dword ptr [ebp-1Ch],eax 
+					red = pointer[2];
+000000d0  movzx       eax,byte ptr [esi+2] 
+000000d4  mov         dword ptr [ebp-18h],eax 
+					pointer[0] = pointer[1] = pointer[2] = (byte) (red * 0.3 + green
+* 0.59 + blue * 0.11);
+000000d7  fild        dword ptr [ebp-18h] 
+000000da  fmul        qword ptr ds:[010C0228h] 
+000000e0  fild        dword ptr [ebp-1Ch] 
+000000e3  fmul        qword ptr ds:[010C0230h] 
+000000e9  faddp       st(1),st 
+000000eb  fild        dword ptr [ebp-20h] 
+000000ee  fmul        qword ptr ds:[010C0238h] 
+000000f4  faddp       st(1),st 
+000000f6  fstp        qword ptr [ebp-48h] 
+000000f9  movsd       xmm0,mmword ptr [ebp-48h] 
+000000fe  cvttsd2si   eax,xmm0 
+00000102  and         eax,0FFh 
+00000107  mov         dword ptr [ebp-38h],eax 
+0000010a  mov         eax,dword ptr [ebp-38h] 
+0000010d  mov         byte ptr [esi+2],al 
+00000110  mov         eax,dword ptr [ebp-38h] 
+00000113  mov         dword ptr [ebp-3Ch],eax 
+00000116  mov         eax,dword ptr [ebp-3Ch] 
+00000119  mov         byte ptr [esi+1],al 
+0000011c  mov         eax,dword ptr [ebp-3Ch] 
+0000011f  mov         byte ptr [esi],al 
+					pointer += 3;
+00000121  add         esi,3 
+
+				while (pointer < end) {
+00000124  cmp         esi,dword ptr [ebp-2Ch] 
+00000127  jb          000000C3 
+


More information about the mono-bugs mailing list