← Back to context

Comment by ack_complete

2 hours ago

Strange, because .NET was specifically designed to be a JITted environment and taking advantage of SSE2 when available would ordinarily be an advantage of a JIT. But sure enough, .NET 4.0 x86 still uses x87 instructions for math. It's not even good x87, this is surprisingly bad:

  01b2086a 8975e4          mov     dword ptr [ebp-1Ch],esi
  01b2086d db45e4          fild    dword ptr [ebp-1Ch]
  01b20870 d95de4          fstp    dword ptr [ebp-1Ch]
  01b20873 d945e4          fld     dword ptr [ebp-1Ch]
  01b20876 d80dcc08b201    fmul    dword ptr ds:[1B208CCh]
  01b2087c d95804          fstp    dword ptr [eax+4]

And that should be with optimization enabled, I didn't start it from the debugger.

But clearly it has some support for using SSE2 when available, because it does use it for zeroing memory:

  01b20884 0f57c0          xorps   xmm0,xmm0
  01b20887 660fd607        movq    mmword ptr [edi],xmm0
  01b2088b 660fd64708      movq    mmword ptr [edi+8],xmm0