User Guide
General-Purpose Programming 47
24592—Rev. 3.15—November 2009 AMD64 Technology
Flags are not affected by these instructions. The instructions can be used to prepare an operand for
signed division (performed by the IDIV instruction) by doubling its storage size.
Extract Sign Mask
• MOVMSKPS—Extract Packed Single-Precision Floating-Point Sign Mask
• MOVMSKPD—Extract Packed Double-Precision Floating-Point Sign Mask
The MOVMSKPS instruction moves the sign bits of four packed single-precision floating-point values
in an XMM register to the four low-order bits of a general-purpose register, with zero-extension.
MOVMSKPD does a similar operation for two packed double-precision floating-point values: it
moves the two sign bits to the two low-order bits of a general-purpose register, with zero-extension.
The result of either instruction is a sign-bit mask.
Translate
• XLAT—Translate Table Index
The XLAT instruction replaces the value stored in the AL register with a table element. The initial
value in AL serves as an unsigned index into the table, and the start (base) of table is specified by the
DS:rBX registers (depending on the effective address size).
This instruction is not recommended. The following instruction serves to replace it:
MOV AL,[rBX + AL]
ASCII Adjust
• AAA—ASCII Adjust After Addition
• AAD—ASCII Adjust Before Division
• AAM—ASCII Adjust After Multiply
• AAS—ASCII Adjust After Subtraction
The AAA, AAD, AAM, and AAS instructions perform corrections of arithmetic operations with non-
packed BCD values (i.e., when the decimal digit is stored in a byte register). There are no instructions
which directly operate on decimal numbers (either packed or non-packed BCD). However, the ASCII-
adjust instructions correct decimal-arithmetic results. These instructions assume that an arithmetic
instruction, such as ADD, was performed on two BCD operands, and that the result was stored in the
AL or AX register. This result can be incorrect or it can be a non-BCD value (for example, when a
decimal carry occurs). After executing the proper ASCII-adjust instruction, the AX register contains a
correct BCD representation of the result. (The AAD instruction is an exception to this, because it
should be applied before a DIV instruction, as explained below). All of the ASCII-adjust instructions
are able to operate with multiple-precision decimal values.
AAA should be applied after addition of two non-packed decimal digits. AAS should be applied after
subtraction of two non-packed decimal digits. AAM should be applied after multiplication of two non-
packed decimal digits. AAD should be applied before the division of two non-packed decimal
numbers.