andi
Bitwise AND immediate
Sets t1 to the bitwise AND of t2 and a sign-extended 12-bit immediate.
Used in
- Arithmetic, logic and bitsRISC-V assembly
- The bitmap display and the keyboard registersRISC-V assembly
- Even or odd, count the set bits, multiply by shiftingRISC-V assembly
- Move a square with the keyboardRISC-V assembly
- The snake gameRISC-V assembly
- Flappy birdRISC-V assembly
- Sampled soundRISC-V assembly
Forms
andi , ,
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. imm12- A signed 12-bit immediate,
-2048to2047.
.text
li t0, 13
# t0=13, immediate 5; andi writes 5 to t2.
andi t2, t0, 5