divu
Divide unsigned
Divides unsigned integers: with three operands the quotient goes to $t1, with two it goes to LO and the remainder to HI.
Used in
- Flappy birdMIPS assembly
Forms
divu ,
Pseudo-instructions
The assembler turns these into one or more real instructions.
-
Set $t1 to ($t2 divided by $t3, unsigned integer division)
Operands
$t1- Any general-purpose register,
$0to$31, using its numeric or named spelling, such as$8or$t0($zerois$0;$rais$31). $t2- A general-purpose register. It may be the same register as
$t1. $t3- A general-purpose register. It may be the same register as
$t1. imm- An immediate value: a signed 16-bit value (
-32768to32767) or a 32-bit value (-2147483648to4294967295). The assembler chooses a supported encoding for the value and other operands; a pseudoinstruction may expand into several instructions.
Sets LO to the quotient and HI to the remainder. Division by zero produces undefined results with no exception. Use 'mflo' for the quotient; 'mfhi' for the remainder.
# Divide 23 by 5. Inspect LO: quotient 4; inspect HI: remainder 3.
li $t0, 23
li $t1, 5
divu $t0, $t1
mflo $t2
mfhi $t3