extsh
Extend Sign Halfword
Sign extends the low halfword.
Details
The extsh instruction extends the sign of a halfword in the source register to fill the entire destination register. If the most significant bit (MSB) of the halfword is 1, the destination register is filled with all ones; otherwise, it is filled with all zeros.
Pseudocode Operation
s ← (RS)48
RA48:63 ← (RS)48:63
RA0:47 ← 48s
Programming Note
The extsh instruction is commonly used to sign-extend a halfword value from the source register into the destination register. Ensure that the source register contains a valid halfword value, and be aware that this operation affects the entire 64-bit destination register. This instruction operates at user privilege level and does not generate exceptions under normal circumstances.
Example
Encoding
Operands
-
RA
Target -
RS
Source