MIPS Assembly/Pseudoinstructions
From Wikibooks, the open-content textbooks collection
The MIPS instruction set is very small, so to do more complicated tasks we need to employ assembler macros called pseudoinstructions.
Contents |
[edit] List of Pseudoinstructions
The following is a list of the standard MIPS instructions that are implemented as pseudoinstructions:
- blt
- bgt
- ble
- blt
- bge
- li
- move
[edit] Branch Pseudoinstructions
Branch if less than (blt)
The blt instruction compares 2 registers, treating them as signed integers, and takes a branch if one register is less than another.
blt $8, $9, 4
translates to
slt $1, $8, $9 bne $1, $0, 4
[edit] Other Pseudoinstructions
Load Immediate (li)
The li pseudo instruction loads an immediate value into a register.
li $1, 0x3BF20
translates to
lui $2, 0x0003 ori $1, $2, 0xBF20
Move (move)
The move pseudo instruction moves the contents of one register into another register.
move $1, $2
translates to
add $1, $2, $0