Re: Either 64bit mode or floating-point ?



Peter Michael Hager wrote:
I am a slightly confused about a statement found at Tom's Hardware Guide:

"The activation of the 64 bit mode does, in practice, have one noteworthy
disadvantage: the floating-point unit is thereby rendered inoperable (even
for AMD)."

This is, quite simply, not true.

64-Bit Media and x87 Floating-Point Instructions
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/26569.pdf

<quote AMD>
This chapter describes the function, mnemonic syntax, opcodes, affected
flags, and possible exceptions generated by the 64-bit media
instructions. These instructions operate on data located in the 64-bit
MMX registers. [...]

The 64-bit media instructions can be used in legacy mode or long mode.
[...] Compilation of 64-bit media programs for execution in 64-bit mode
offers four primary advantages: access to the eight extended, 64-bit
general-purpose registers (for a register set consisting of GPR0–GPR15),
access to the eight extended XMM registers (for a register set
consisting of XMM0–XMM15), access to the 64-bit virtual address space,
and access to the RIP-relative addressing mode.
</quote>

MMX in 64-bit mode... OK

<quote AMD>
This chapter describes the function, mnemonic syntax, opcodes, condition
codes, affected flags, and possible exceptions generated by the x87
floating-point instructions. The x87 floating-point instructions are
used in legacy floating-point applications. Most of these instructions
load, store, or operate on data located in the x87 ST(0)-ST(7) stack
registers (the FPR0-FPR7 physical registers). The remaining instructions
within this category are used to manage the x87 floating-point
environment. [...]

The x87 instructions can be used in legacy mode or long mode. [...]
Compilation of x87 media programs for execution in 64-bit mode offers
two primary advantages: access to the 64-bit virtual address space and
access to the RIP-relative addressing mode.
</quote>

x87 in 64-bit mode... OK

In other words, as far as the hardware is concerned, MMX and x87 are
completely supported in 64-bit mode.

However, a looong time ago, Microsoft claimed they would deprecate MMX
and x87 by not saving the state on a context switch.

*But* they changed their mind along the way:
http://blogs.technet.com/josebda/archive/2005/04/30/404353.aspx

levicki wrote:
I have read somewhere in MSDN (perhaps it was in DDK part) that
Windows x64 will not preserve state of FPU and MMX registers across
context switch and that the code written to take advantage of FPU
and MMX will not work. Does that still apply and if it does what is
the scope? 64-bit apps, drivers, 32-bit apps or all of them?

Program Manager in Visual C++ Group wrote:
It does preserve the state. It's the DDK page that has stale
information, which I've requested it to be changed. Let them know that
the OS does preserve state of x87 and MMX registers on context switches.

Software Engineer in Windows Kernel Group added:
For user threads the state of legacy floating point is preserved at
context switch. But it is not true for kernel threads. Kernel mode
drivers can not use legacy floating point instructions.

Does that mean, I will have to emulate the f-instructions when using the
AMD64 or EM64T mode (win-x64) on these processors, like I did in former
times with the 486sx and its predecessors ?

If you are writing Windows application code, MMX and x87 are supported
in 64-bit mode.

--
Regards, Grumble

.



Relevant Pages

  • Re: builtin lists and Intel SSE support?
    ... these speedups can be attributed to the use of the SEE2 unit over the x87 ... utilising extra integer registers). ... ability to intermix integer and floating-point instructions in the same ... Code written with 128-bit media floating-point ...
    (comp.lang.lisp)
  • Re: builtin lists and Intel SSE support?
    ... However the floating point speedups could also be related to the ... > utilising extra integer registers). ... > ability to intermix integer and floating-point instructions in the same ... > This achieves potentially four times the computational work of x87 ...
    (comp.lang.lisp)
  • Re: Print statement within If-Then block changes output!!!????
    ... Presuming that Colin's conclusion that this isn't the usual sort of out-of-bounds error causing that problem, and that it is in fact a compiler bug, I think I've got a fair guess which exactly compiler bug it is, because I've run into it in exactly this situation: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323. ... The short version is of the bug this: The Intel floating-point system has 80-bit floating-point registers, but has only 64-bit floating-point storage. ... Thus, there are cases where, if a value is stored in memory, its value will be slightly different than if its kept in a register. ...
    (comp.lang.fortran)
  • Re: Function ieee_value( r, IEEE_SIGNALING_NAN )
    ... Any compiler implementor worth his salt could make the ... to go through the floating-point registers. ... reference in the example should be a signaling NaN. ... It is easy to store a signaling NaN into a floating-point ...
    (comp.lang.fortran)
  • Re: HLA v1.68 is now available
    ... Data) operations on floating-point data. ... MMX instructions from 64 to 128 bits and adds a few operations. ... the use of the MTRR MSRs (Memory Type Range Registe, ...
    (alt.lang.asm)