In MIPS, what are HI and LO

前端 未结 3 1781
感动是毒
感动是毒 2020-12-24 07:06

I\'m reading about division in MIPS and I\'ve found that div

Divides $s by $t and stores the quotient in $LO and the remainder in $HI

<
3条回答
  •  半阙折子戏
    2020-12-24 08:05

    These are special registers used to store the result of multiplication and division. They are separate from the $0 .. $31 general purpose registers, not directly addressable. Their contents are accessed with special instructions mfhi and mflo (Move From HI/LO).

    They are present in the Multiply Unit and are 32-bits each. More info here. As a pair, they hold the 64-bit full result of a 32x32-bit integer mult.


    Raymond Chen's blog article The MIPS R4000, part 3: Multiplication, division, and the temperamental HI and LO registers has some very good info about early MIPS's non-intuitive behaviours, including mtlo / mtlo invalidating the previous hi / lo (respectively).

    The incomplete integer instruction-set reference (linked in the question) for early MIPS also has some details, http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html, or see MIPS's official PDF manuals, or PDFs of manuals for classic MIPS CPUs.

提交回复
热议问题