I want to extend the Nils Pipenbrinck answer:
From the arsenal of MIPS32 for programmers
mthi
Format: MIPS32 (MIPS I)
MTHI rs
Purpose: To copy GPR to the special purpose HI register
Description: HI β rs
The contents of the GPR rs are loaded into a special HI register.
Limitations:
A calculated result written to an HI / LO pair using DIV, DIVU, MULT or MULTU must be read by MFHI or MFLO before a new result can be written to HI or LO. If the MTHI instruction is executed on one of these arithmetic instructions, but before the MFLO or MFHI instructions, the contents of LO are impractical. The following example shows this illegal situation:
MUL r2,r4
Historical Information:
In MIPS I-III, if one of the two previous instructions is MFHI, the result of this MFHI is CONTINUOUS. The reading of the HI or LO special register should be separated from any subsequent instructions that are written to them by two or more instructions. In MIPS IV and later, including MIPS32 and MIPS64, this restriction does not exist.
mtlo
Format: MIPS32 (MIPS I)
MTLO rs
Purpose: To copy the GPR to the special register LO Description:
LO β rs
The contents of the GPR rs are loaded into a special register LO.
Restrictions: A calculated result written to an HI / LO pair using DIV, DIVU, MULT or MULTU must be read by MFHI or MFLO before a new result can be written to HI or LO.
If the MTLO instruction is executed on one of these arithmetic instructions, but before the MFLO or MFHI instruction, the contents of the HI are CONTINUOUS. The following example shows this illegal situation:
MUL r2,r4
Historical Information:
In MIPS I-III, if one of the two previous instructions is MFHI, the result of this MFHI is CONTINUOUS. The reading of the HI or LO special register should be separated from any subsequent instructions that are written to them by two or more instructions. In MIPS IV and later, including MIPS32 and MIPS64, this restriction does not exist.