Comment by Sharlin

9 hours ago

There's also the fact that for all intents and purposes, the real floating-point unit of any x86 in the last 20 years is the SIMD unit, and legacy x87 instructions are emulated on top of that.

I don't believe so.

The issue is that x87 is 80bit floats which is awkward. As such, it still requires dedicated hardware.

Intel has proposed and abandoned pushing a new x86 architecture [1] which tweaks x86 instructions to fit better with the reality that everything is 64bit now. Part of that proposal was to make x87 work with 64bit floats instead of 80bit floats (which would have allowed it to share the same floating point units as the SIMD instructions).

[1] https://www.intel.com/content/www/us/en/developer/articles/t...

One exception that does come to mind, is .Net Framework on x86. AFAIR that didn't use SSE or SSE2. (In x64 mode it did however, since those were part of the baseline for x64)

  • 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