Skip to main content

lwr

Function lwr 

Source
pub const fn lwr(rt: u64, word: u32, byte: u64) -> u64
Expand description

LWR — merge the bytes from the start of the containing word up to the addressed byte into the bottom of rt, preserving rt’s high bytes.

Bits 63:32 diverge from LWL (ledger R-20). LWL always writes the word’s most-significant byte, so its result is always sign-extended; a partial LWR (byte < 3) never writes bit 31, and the VR4300 then leaves bits 63:32 of rt UNCHANGED rather than sign-extending. Only the full-word case (byte == 3) writes bit 31 and sign-extends. n64-systemtest’s tlb64 load battery pins this with a sentinel whose upper half is non-zero; the earlier unconditional sext32 zeroed it on every partial offset.