add
Addition
Adds t2 and t3 and stores the sum in t1.
Used in
- The RISC-V instruction setRISC-V assembly
- Loads, stores and immediatesRISC-V assembly
- Going 64-bitRISC-V assembly
- if, else and jump tablesRISC-V assembly
- LoopsRISC-V assembly
- Arithmetic, logic and bitsRISC-V assembly
- Arrays and stringsRISC-V assembly
- The stack and spRISC-V assembly
- jal, ret and the calling conventionRISC-V assembly
- ecallRISC-V assembly
Forms
add , ,
Operands
t1- Any integer register,
x0tox31, or its named alias, such aszero,t0ort6. t2- An integer register. It may be the same register as
t1. t3- An integer register. It may be the same register as
t1.
.text
li t0, 13
li t1, 5
# t0=13, t1=5; add writes 18 to t2.
add t2, t0, t1