This preview shows page 1. Sign up to view the full content.
Unformatted text preview: eal instruction is actually a variant of the movl instruction. Its ﬁrst operand appears to be a memory reference, but instead of reading from the designated location, the instruction copies the effective address to the destination. We indicate this computation in Figure 3.6 using the C address operator &Ë . This instruction can be used to generate pointers for later memory references. In addition, it can be used to compactly describe common arithmetic operations. For example, if register %edx contains value Ü, then the instruction leal 7(%edx,%edx,4), %eax will set register %eax to Ü · . The destination operand must be a register. Practice Problem 3.3:
Suppose register %eax holds value Ü and %ecx holds value Ý . Fill in the table below with formulas indicating the value that will be stored in register %edx for each of the following assembly code instructions. Expression leal 6(%eax), %edx leal (%eax,%ecx), %edx leal (%eax,%ecx,4), %edx leal 7(%eax,%eax,8), %edx leal 0xA(,$ecx,4), %edx leal 9(%eax,%ecx,2), %edx Result 3.5.2 Unary and Binary Operations
Operations in the second group are unary operations, with the sin...
View Full Document