Skip to main content

mult

Function mult 

Source
pub const fn mult(a: u64, b: u64) -> HiLo
Expand description

MULT — 32-bit signed multiply. Reproduces the VR4300 sign-extension erratum.

When the inputs are not properly sign-extended 32-bit values, MULT behaves as a 64-bit by 35-bit signed multiply: the second operand is sign-extended on bit 34 before a 64-bit multiplication, and the first is taken as a full 64-bit value.

For well-formed inputs (both properly sign-extended 32-bit values) this reduces to the expected 32×32 signed multiply, which is why the erratum is invisible to ordinary compiler output and only surfaces with hand-written or miscompiled code. Results are for processor revision 2.2 (n64brew_wiki/markdown/VR4300.md § Known Bugs).