3-296
INSTRUCTION SET REFERENCE
IMUL—Signed Multiply (Continued)
The CF and OF flags are set when significant bits are carried into the upper half of the result.
The CF and OF flags are cleared when the result fits exactly in the lower half of the result.
The three forms of the IMUL instruction are similar in that the length of the product is calculated
to twice the length of the operands. With the one-operand form, the product is stored exactly in
the destination. With the two- and three- operand forms, however, result is truncated to the
length of the destination before it is stored in the destination register. Because of this truncation,
the CF or OF flag should be tested to ensure that no significant bits are lost.
The two- and three-operand forms may also be used with unsigned operands because the lower
half of the product is the same regardless if the operands are signed or unsigned. The CF and OF
flags, however, cannot be used to determine if the upper half of the result is non-zero.