Encoding:

SPECIAL

000000

rs

0

000 0000 0000 0000

MTHI

010001

6

5

15

6

Format:

MTHI rs

MIPS32, removed in Release 6

Move to HI Register

Purpose:

Move to HI Register

To copy a GPR to the special purpose HI register.

Description:

 HI = GPR[rs]

The contents of GPR rs are loaded into special register HI.

Restrictions:

A computed result written to the HI/LO pair by DIV, DIVU, DDIV, DDIVU, DMULT, DMULTU, MULT, or MULTU must be read by MFHI or MFLO before a new result can be written into either HI or LO.

If an MTHI instruction is executed following one of these arithmetic instructions, but before an MFLO or MFHI instruction, the contents of LO are UNPREDICTABLE. The following example shows this illegal situation:

MULT  r2,r4 # start operation that will eventually write to HI,LO
...          # code not containing mfhi or mflo
MTHI  r6
...          # code not containing mflo
MFLO  r3    # this mflo would get an UNPREDICTABLE value

Availability and Compatibility:

This instruction has been removed in Release 6.

Operation:

HI = GPR[rs]

Exceptions:

None

Historical Information:

In MIPS I-III, if either of the two preceding instructions is MFHI, the result of that MFHI is UNPREDICTABLE.

Reads of the HI or LO special register must be separated from any subsequent instructions that write to them by two or more instructions. In MIPS IV and later, including MIPS32 and MIPS64, this restriction does not exist.