mult instruction can multiply two 32-bit integers which could give a 64-bit result. The higher significant 32 bits of the result (32 - 63) are saved in Hi and the lower bits (0 - 31) are saved in Lo. After the multiplication I can use mfhi and mflo to move the result to registers. But it is obviously not possible to write the 64-bit number into a 32-bit register. How can I store the result back into registers and use it? Should I save each part in a separate register and concatenate them?
You are correct that you save by both mfhi and mflo to registers separately. You just have to check if your product takes both registers (when Hi is NOT zero) then you take that into account and process both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With