Commit [c88b29] Maximize Restore History

Smaller and more correct moving of single-floats on x86-64.

In the VOPs MAKE-SINGLE-FLOAT, MOVE-FROM-SINGLE, MOVE-TO-SINGLE-REG and
SINGLE-FLOAT-BITS the MOVD instruction is used to move data between an
XMM and a general-purpose register. Use the 32-bit instead of the 64-bit
form of the instruction there which often allows to spare the REX
prefix.

MAKE-SINGLE-FLOAT actually becomes more correct with this change: When
given a negative argument it used to set bits 32-63 of the destination
XMM register to 1, breaking the invariant that unused parts of XMM
registers should be zero.

The users of MAKE-SINGLE-FLOAT internal to SBCL happen to avoid being
negatively affected by this. One is SINGLE-FLOAT-FROM-BITS (used to
float bignums) which doesn't use the VOP but the function with the same
name which returns the float as a tagged number in a general-purpose
register, thus taking the XMM register out of the equation. The second
is RANDOM, which uses the VOP but never passes it a negative number.

Nevertheless, using the result of MAKE-SINGLE-FLOAT in a complex
single-float operation can make the 1 bits visible: as a QNaN in the
imaginary part.

In the VOP MAKE-SINGLE-FLOAT there is another 64-bit MOVD, not from a
general-purpose register to an XMM register, but from the signed-stack.
For the same correctness reason this also needs to be converted to move
only 32 bits, so use MOVSS there. (I couldn't test this change as I
found no way to make the compiler use this VOP with TNs of the
combination of storage classes needed to select this specific clause.)

Correct the comment at the top of the file for 64-bitness.

Add a test for MAKE-SINGLE-FLOAT and convert the test file's encoding to
UTF-8 while at it.

Lutz Euler Lutz Euler 2014-03-01

changed src/compiler/x86-64/float.lisp
changed tests/float.pure.lisp
src/compiler/x86-64/float.lisp Diff Switch to side-by-side view
Loading...
tests/float.pure.lisp Diff Switch to side-by-side view
Loading...