16-bit Multiplication

The new multiply instructions are specifically designed to improve 16-bit multiplication. This chapter presents solutions for using the hardware multiplier to do multiplication with 16-bit operands.

The figure below schematically illustrates the general algorithm for multiplying two 16-bit numbers with a 32-bit result (C = A • B). AH denotes the high byte and AL the low byte of the A operand. CMH denotes the middle high byte and CML the middle low byte of the result C. Equal notations are used for the remaining bytes.

The algorithm is basic for all multiplication. All of the partial 16-bit results are shifted and added together. The sign extension is necessary for signed numbers only, but note that the carry propagation must still be done for unsigned numbers.

Figure 1. 16-bit Multiplication, General Algorithm