Divide signed : Divides $t1 by $t2 (signed). Sets LO to the quotient and HI to the remainder. Division by zero produces undefined results with no exception. Use 'mflo' to get the quotient; 'mfhi' to get the remainder.
div
Operands
$reg, $reg, [$reg / imm]Variants
- Divide signed : Divides $t1 by $t2 (signed). Sets LO to the quotient and HI to the remainder. Division by zero produces undefined results with no exception. Use 'mflo' to get the quotient; 'mfhi' to get the remainder. div $t1,$t2
- DIVision : Set $t1 to ($t2 divided by $t3, integer division) div $t1,$t2,$t3
- DIVision : Set $t1 to ($t2 divided by 16-bit immediate, integer division) div $t1,$t2,-100
- DIVision : Set $t1 to ($t2 divided by 32-bit immediate, integer division) div $t1,$t2,100000
# Divide 23 by 5. Inspect LO: quotient 4; inspect HI: remainder 3.
li $t0, 23
li $t1, 5
div $t0, $t1
mflo $t2
mfhi $t3