div
and the divu
InstructionsWith N-place integer division there are two results, an N-place quotient and an N-place remainder. With 32-bit operands there will be (in general) two 32-bit results. MIPS uses the hi and lo registers for the results:
Here are the MIPS instructions for integer divide. The "u" means operands and results are in unsigned binary.
div s,t # lo <-- s div t # hi <-- s mod t # two's complement
divu s,t # lo <-- s div t # hi <-- s mod t # unsigned