User Guide

140 128-Bit Media and Scientific Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
Before executing a CVTPI2x instruction, software should ensure that the MMX registers are properly
initialized so as to prevent conflict with their aliased use by x87 floating-point instructions. This may
require clearing the MMX state, as described in “Accessing Operands in MMX™ Registers” on
page 188.
For a description of 128-bit media instructions that convert in the opposite direction—floating-point to
integer in MMX registers—see “Convert Floating-Point to MMX™ Integer” on page 163. For a
summary of instructions that operate on MMX registers, see Chapter 5, “64-Bit Media Programming.”
Convert GPR Integer to Floating-Point. These instructions convert integer data types in GPR
registers or memory into floating-point data types in XMM registers.
CVTSI2SS—Convert Signed Doubleword or Quadword Integer to Scalar Single-Precision
Floating-Point
CVTSI2SD—Convert Signed Doubleword or Quadword Integer to Scalar Double-Precision
Floating-Point
The C VTSI2SS instruction converts a 32-bit or 64-bit signed integer value in a general-purpose
register or memory location to a single-precision floating-point value and writes the converted value in
the low-order 32 bits of an XMM register. The three high-order doublewords in the destination XMM
register are not modified.
The CVTSI2SD instruction converts a 32-bit or 64-bit signed integer value in a general-purpose
register or memory location to a double-precision floating-point value and writes the converted value
in the low-order 64 bits of an XMM register. The high-order 64 bits in the destination XMM register
are not modified.
4.5.4 Data Reordering
The integer data-reordering instructions pack, unpack, interleave, extract, insert, and shuffle the
elements of vector operands.
Pack with Saturation. These instructions pack larger data types into smaller data types, thus halving
the precision of each element in a vector operand.
PACKSSDW—Pack with Saturation Signed Doubleword to Word
PACKSSWB—Pack with Saturation Signed Word to Byte
PACKUSWB—Pack with Saturation Signed Word to Unsigned Byte
The PACKSSDW instruction converts each of the four signed doubleword integers in its two source
operands (an XMM register, and another XMM register or 128-bit memory location) into signed word
integers and packs the converted values into the destination operand (an XMM register). The
PACKSSWB instruction does the analogous conversion between word elements in the source vectors
and byte elements in the destination vector. The PACKUSWB instruction does the same as
PACKSSWB except that it converts signed word integers into unsigned (rather than signed) bytes.