Skip to content

Pseudo Instructions

Pseudo-instructions are syntactic shortcuts that make writing and reading Assembly programs easier. They are not part of the RISC-V hardware.

During the assembly process, each pseudo-instruction is automatically expanded into one or more real instructions from the RV32I set.

In the ÆRIS simulator, this expansion occurs during the code analysis phase, through the PseudoExpander component. After expansion, only real instructions remain in the program before machine code generation.

PseudoDescription
mv rd, rsCopies the value from one register to another
nopPerforms no operation
not rd, rsInverts all bits of a register

PseudoDescription
li rd, immLoads an immediate value into the register

PseudoDescription
la rd, labelLoads the address of a label

PseudoDescription
j labelUnconditional jump
jal labelJumps and saves return address in ra
jalr rsJumps to address in register
jalr rs, immJumps to address rs + imm
jalr rd, imm(rs)Jumps to rs + imm saving return in rd
jr rsJumps to address stored in rs
jr rs, immJumps to address rs + imm

PseudoDescription
beqz rs, labelBranch if rs == 0
bnez rs, labelBranch if rs != 0
bgez rs, labelBranch if rs >= 0
bltz rs, labelBranch if rs < 0
bgtz rs, labelBranch if rs > 0
blez rs, labelBranch if rs <= 0
bgt rs1, rs2, labelBranch if rs1 > rs2
bgtu rs1, rs2, labelBranch (unsigned)
ble rs1, rs2, labelBranch if rs1 <= rs2
bleu rs1, rs2, labelBranch (unsigned)

PseudoDescription
lb rd, (rs)Loads byte from memory
lb rd, immLoads byte using offset
lb rd, largeImmLoads byte with large immediate
lb rd, labelLoads byte from a label
lbu rd, (rs)Loads unsigned byte
lbu rd, immLoads unsigned byte with offset
lbu rd, largeImmLoads unsigned byte with large offset
lbu rd, labelLoads unsigned byte from label
lh rd, (rs)Loads halfword
lh rd, immLoads halfword with offset
lh rd, largeImmLoads halfword with large offset
lh rd, labelLoads halfword from label
lhu rd, (rs)Loads unsigned halfword
lhu rd, immLoads unsigned halfword with offset
lhu rd, largeImmLoads unsigned halfword with large offset
lhu rd, labelLoads unsigned halfword from label
lw rd, (rs)Loads word from memory
lw rd, immLoads word with offset
lw rd, largeImmLoads word with large offset
lw rd, labelLoads word from label

PseudoDescription
sb rs, (rd)Stores byte in memory
sb rs, immStores byte with offset
sb rs, label, rtStores byte at label
sh rs, (rd)Stores halfword
sh rs, immStores halfword with offset
sh rs, label, rtStores halfword at label
sw rs, (rd)Stores word
sw rs, immStores word with offset
sw rs, label, rtStores word at label

PseudoDescription
seqz rd, rsrd = 1 if rs == 0
snez rd, rsrd = 1 if rs != 0
sltz rd, rsrd = 1 if rs < 0
sgtz rd, rsrd = 1 if rs > 0
sgt rd, rs1, rs2rd = 1 if rs1 > rs2
sgtu rd, rs1, rs2rd = 1 if rs1 > rs2 (unsigned)