slli
Shift left logical immediate
Shifts t2 left by an immediate amount and stores the result in t1.
Used in
- Loads, stores and immediatesRISC-V assembly
- if, else and jump tablesRISC-V assembly
- Arithmetic, logic and bitsRISC-V assembly
- Arrays and stringsRISC-V assembly
- The stack and spRISC-V assembly
- The bitmap display and the keyboard registersRISC-V assembly
- The largest elementRISC-V assembly
- Even or odd, count the set bits, multiply by shiftingRISC-V assembly
- A jump tableRISC-V assembly
- Binary searchRISC-V assembly
Forms
slli , ,
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. imm6- An unsigned shift count or bit number:
0to63in RV64, or0to31in RV32.
This example runs on RV64.
.text
li t0, 13
# t0=13, immediate 2; slli writes 52 to t2.
slli t2, t0, 2