ADD

By Vesper Vei
1 minute read

Table of Contents

  1. ADD (add)
    1. Basic function
    2. Instruction format
    3. Instruction execution process
    4. Example
    5. Equivalent expansion example
    6. Common uses

ADD (add)

Basic function

The ADD instruction performs addition, writing the result of x1 + x2 into x1.
At the same time, it affects multiple EFLAGS flags.

Instruction format

add x1, x2
x1 = x1 + x2

x1, x2 types:

Instruction execution process

x1 ← x1 + x2
EFLAGS ← 根据结果更新

The affected flags include:

Example

add eax, ebx ;寄存器 寄存器
add rax, 0x20. ;寄存器 立即数
add [rbp-0x4], 1 ; 内存 立即数

Equivalent expansion example

add rax, rbx
; 等价于
tmp = rax + rbx
rax = tmp
更新 EFLAGS

Common uses



Relationship Graph

Loading graph...