Arithmetic |
Register |
Immediate |
Addition |
add $rd, $rs, $rt |
addi $rd, $rs, C162s |
Subtraction |
sub $rd, $rs, $rt |
|
Bitwise AND |
and $rd, $rs, $rt |
andi $rd, $rs, C16 |
Bitwise OR |
or $rd, $rs, $rt |
ori $rd, $rs, C16 |
Bitwise NOR |
nor $rd, $rs, $rt |
|
Bitwise XOR |
xor $rd, $rs, $rt |
xori $rd, $rs, C16 |
Set on Less Than |
slt $rd, $rs, $rt |
slti $rd, $rs, C162s |
Shift Left Logical |
sll $rd, $rs, C5 |
|
Shift Right Logical |
srl $rd, $rs, C5 |
|
C162s is a 16-bit numbers (or hex pattern) interpreted as 2s-complement number.
It will be sign-extended.
C16 is a 16-bit numbers (or hex pattern) interpreted as unsigned number.
It will be bit-extended.
C5 is a 5-bit numbers interpreted as unsigned number.
It will be bit-extended.
Jump/Branch |
Pseudo (less than) |
Pseudo (greater than) |
beq $rd, $rs, label |
blt $rd, $rs, label |
bgt $rd, $rs, label |
bne $rd, $rs, label |
ble $rd, $rs, label |
bge $rd, $rs, label |
j label |
|
|
The pseudo operations may not be standard and typically will be desugared into multiple operations.
Memory |
Load |
Store |
Word (aligned) |
lw $rt, offset($rs) |
sw $rt, offset($rs) |
Byte |
lb $rt, offset($rs) |
sb $rt, offset($rs) |
Word (unaligned) |
ulw $rt, offset($rs) |
usw $rt, offset($rs) |
Unaligned operations may not be standard and typically will be desugared into multiple operations.
If .data is declared, the label can be used as a base address.