mfhi
Move from HI
Copies the special HI register into $t1.
Used in
- Arithmetic, logic and bitsMIPS assembly
- Multiply and divide with hi and loMIPS assembly
- A subroutine with its arguments in registersMIPS assembly
- Print a number in any base without helpMIPS assembly
- A bouncing ballMIPS assembly
- Flappy birdMIPS assembly
Forms
mfhi
Operands
$t1- Any general-purpose register,
$0to$31, using its numeric or named spelling, such as$8or$t0($zerois$0;$rais$31).
HI holds the upper 32 bits of a multiply result or the remainder from a divide. Always read HI/LO before executing another multiply or divide, as those instructions overwrite them.
# Read the initialized HI/LO result after multiplication. Inspect $t2: 0.
li $t0, 6
li $t1, 7
mult $t0, $t1
mfhi $t2