![](http://datasheet.mmic.net.cn/380000/-PD98501_datasheet_16745028/-PD98501_107.png)
CHAPTER 2 V
R
4120A
Preliminary User’s Manual S14767EJ1V0UM00
107
Table 2-39. Multiply/Divide Instructions (1/2)
Instruction
Format and Description
Multiply
MULT rx, ry
The contents of general registers rx and ry are multiplied, treating both operands as 32-bit two's
complement values. No integer overflow exception occurs.
In the 64-bit mode, the operand must be a 64-bit value formed by sign-extending a 32-bit value.
The low-order 32-bit word of the result are placed in special register LO, and the high-order 32-bit word
is placed in special register HI. In the 64-bit mode, each result is sign extended and then stored.
If either of the two immediately preceding instructions is MFHI or MFLO, their transfer instruction
execution result becomes undefined. To obtain the correct result, insert two or more other instructions
between the MFHI, MFLO instructions, and the MULT instruction.
Multiply Unsigned
MULTU rx, ry
The contents of general registers rx and ry are multiplied, treating both operands as 32-bit unsigned
values. No integer overflow exception occurs. In the 64-bit mode, the operand must be a 64-bit value
formed by sign-extending a 32-bit value. The low-order 32-bit word of the result is placed in special
register LO, and the high-order 32-bit word is placed in special register HI. In the 64-bit mode, each
result is sign extended and stored.
If either of the two immediately preceding instructions is MFHI or MFLO, the result of execution of
these transfer instructions is undefined. To obtain the correct result, insert two or more other
instructions between the MFHI, MFLO instructions and the MULTU instruction.
Divide
DIV rx, ry
The contents of general register rx are divided by the contents of general register ry, treating both
operands as 32-bit two's complement values. No integer overflow exception occurs. The result when
the divisor is 0 is undefined. The 32-bit quotient is placed in special register LO, and the 32-bit
remainder is placed in special register HI. In the 64-bit mode, the result is sign extended.
Normally, this instruction is executed after instructions checking for division by zero and overflow.
If either of the two immediately preceding instructions is MFHI or MFLO, the result of execution of
these transfer instructions is undefined. To obtain the correct result, insert two or more other
instructions between the MFHI, MFLO instructions and the DIV instruction.
Divide Unsigned
DIVU rx, ry
The contents of general register rx are divided by the contents of general register ry, treating both
operands as 32-bit unsigned values. No integer overflow exception occurs. The result when the
divisor is 0 is undefined. The 32-bit quotient is placed in special register LO, and the 32-bit remainder
is placed in special register HI. In the 64-bit mode, the result is sign extended.
Normally, this instruction is executed after instructions checking for division by zero.
If either of the two immediately preceding instructions is MFHI or MFLO, the result of execution of
these transfer instructions is undefined. To obtain the correct result, insert two or more other
instructions between the MFHI, MFLO instructions and the DIVU instruction.
Move From HI
MFHI rx
The contents of special register HI are loaded into general register rx.
To ensure correct operation when an interrupt occurs, do not use an instruction that changes the HI
register (MULT, MULTU, DIV, DIVU, DMULT, DMULTU, DDIV, DDIVU) for the two instructions after
the MFHI instruction.
Move From LO
MFLO rx
The contents of special register LO are loaded into general register rx.
To ensure correct operation when an interrupt occurs, do not use an instruction that changes the LO
register (MULT, MULTU, DIV, DIVU, DMULT, DMULTU, DDIV, DDIVU) for the two instructions after
the MFLO instruction.