User Guide
50 General-Purpose Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
LEA has a limited capability to perform multiplication of operands in general-purpose registers using
scaled-index addressing. For example:
lea eax, [ebx+ebx*8]
loads the value of the EBX register, multiplied by 9, into the EAX register.
3.3.6 Arithmetic
The arithmetic instructions perform basic arithmetic operations, such as addition, subtraction,
multiplication, and division on integer operands.
Add and Subtract
• ADC—Add with Carry
• ADD—Signed or Unsigned Add
• SBB—Subtract with Borrow
• SUB—Subtract
• NEG—Two’s Complement Negation
The ADD instruction performs addition of two integer operands. There are opcodes that add an
immediate value to a byte, word, doubleword, or quadword register or a memory location. In these
opcodes, if the size of the immediate is smaller than that of the destination, the immediate is first sign-
extended to the size of the destination operand. The arithmetic flags (OF, SF, ZF, AF, CF, PF) are set
according to the resulting value of the destination operand.
The ADC instruction performs addition of two integer operands, plus 1 if the carry flag (CF) is set.
The SUB instruction performs subtraction of two integer operands.
The SBB instruction performs subtraction of two integer operands, and it also subtracts an additional 1
if the carry flag is set.
The ADC and SBB instructions simplify addition and subtraction of multiple-precision integer
operands, because they correctly handle carries (and borrows) between parts of a multiple-precision
operand.
The NEG instruction performs negation of an integer operand. The value of the operand is replaced
with the result of subtracting the operand from zero.
Multiply and Divide
• MUL—Multiply Unsigned
• IMUL—Signed Multiply
• DIV—Unsigned Divide
• IDIV—Signed Divide