On 11/13/26 08:11, Philippe Mathieu-Daudé wrote:
The MIPS64 Release 6.05 manual (LWR description) says that when bit
31 is not loaded, bits 63..32 of the destination are implementation
dependent: either unchanged or a copy of bit 31. Both behaviours are
architecturally allowed.

Octeon III CN71XX hardware leaves bits 63..32 unchanged unless the
whole word is loaded (vAddr[1:0] = 3 for big-endian, 0 for
little-endian). QEMU always sign-extended the merged low word.

Seen replaying a risu trace recorded on a Cavium Octeon III CN71XX:
"lwr s7,26334(a2)" left r23 = 0004114d368db793 on the hardware where
QEMU had 00000000368db793.

Only change the behaviour for Octeon CPUs (INSN_OCTEON); all other
CPUs keep sign-extending the result. LWL always loads bit 31 and is
unchanged.

Signed-off-by: Philippe Mathieu-Daudé<[email protected]>
---
  target/mips/tcg/translate.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)

Horrid, but,
Acked-by: Richard Henderson <[email protected]>

r~

Reply via email to