Use of mflo statement
When,where and why should the mflo statement be used in assembly langu开发者_开发百科age?
By extrapolation from this document, when you want to access the result of a multiplication or division on a MIPS processor.
MIPS multiplier is a separate unit, and instructions within the unit consume more than other integer instructions. This is why there is a different handling of this unit and results it provides.
Usage of this unit is as follows:
- start multiply of divide
- execute the instructions in parallel
- store results in register
HI
andLO
, when finished - read results with
mfhi
andmflo
Note that if results are not ready when you try to read them, the CPU will wait until they arrive.
If you decide to use mul
and div
instructions, you do not need to think about mfhi
and mflo
instructions.
精彩评论