« Previous | Next » 

Revision c728154b

IDc728154bbbc1a86465a0fd6bfc839bc9710ac374

Added by Richard Sandiford about 11 years ago

target-mips: Sign-extend the result of LWR

Sign-extend the result of LWR, as is already done for LWL. This is necessary
in the case where LWR loads the full word (i.e. the address is actually
aligned). In the other cases, it is implementation defined whether the
upper 32 bits of the result are unchanged or a copy of bit 31. The latter
seems easier to implement.

Previously the code used:

(oldval & (0xfffffffe << (31 - bitshift))) | (newval >> bitshift)

which zeroed the upper bits of the register, losing any previous sign
extension in the unaligned cases.

Signed-off-by: Richard Sandiford <>
Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences