srli
Shift right logical immediate
Shifts t2 right by an immediate amount, filling with zeros, and stores the result in t1.
Used in
- Arithmetic, logic and bitsRISC-V assembly
- Even or odd, count the set bits, multiply by shiftingRISC-V assembly
- Binary searchRISC-V assembly
- The snake gameRISC-V assembly
- Flappy birdRISC-V assembly
- Sampled soundRISC-V assembly
Forms
srli , ,
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; srli writes 3 to t2.
srli t2, t0, 2