
CS485G Spring 2015 15
(c) Load Effective Address of src and put it in dest.
(d) Purpose: translate p = &x[i]
(e) Purpose: compute arithmetic expressions like x+k
*
y where k is
1, 2, 4, or 8.
i. Example: x
*
12
ii. leal (%eax,%eax,2), %eax # x = x+2x
sall $2, %eax # x = x << 2
19 Arithmetic operations
1. Two-operand instructions
instruction meaning
addl dest = dest + src
subl dest = dest − src
imull dest = dest × src
sall dest = dest << src
sarl dest = dest >> src (arithmetic)
shrl dest = dest >> src (logical)
xorl dest = dest ⊕ src (bitwise)
andl dest = dest ∧ src (bitwise)
orl dest = dest ∨ src (bitwise)
2. Lecture 10, 2/6/2015
3. Be careful of parameter order for asymmetric operations.
4. There is no distinction between signed and unsigned integers.
5. One-operand instructions
instruction meaning
incl dest = dest + 1
decl dest = dest − 1
negl dest = −dest
notl dest = ¬ dest (bitwise)
6. Example
Comentarios a estos manuales