This preview shows page 1. Sign up to view the full content.
Unformatted text preview: rent “one-operand” multiply instructions to compute the full 64-bit product of two 32-bit values—one for unsigned (mull), and one for two’s complement (imull) multiplication. For both of these, one argument must be in register %eax, and the other is given as the instruction source operand. The product is then stored in registers %edx (high-order 32 bits) and %eax (low-order 32 bits). Note that although the name imull is used for two distinct multiplication operations, the assembler can tell which one is intended by counting the number of operands. As an example, suppose we have signed numbers x and y stored at positions and ½¾ relative to %ebp, and we want to store their full 64-bit product as 8 bytes on top of the stack. The code would proceed as follows:
x at %ebp+8, y at %ebp+12
1 2 3 4 movl 8(%ebp),%eax imull 12(%ebp) pushl %edx pushl %eax Put x in %eax Multiply by y Push high-order 32 bits Push low-order 32 bits Observe that the order in which we push the two registers is correct for a little-endian machine...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American