extsh

Extend Sign Halfword

extsh RA, RS

Sign extends the low halfword.

Details

Sign-extends the low 16 bits (halfword) of the source register to fill all 64 bits of the destination register. The instruction replicates bit 15 of RS to all higher-order bits. No condition registers or status fields are affected unless an extended form with a recorded bit is used (extsH.).

Pseudocode Operation

RA ← EXTS(RS[48:63], 64)

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

extsh r4, r3

Encoding

Binary Layout
31
0
RS
6
RA
11
922
16
/
21
 
Format X-form
Opcode 0x7C000734
Extension Base

Operands

  • RA
    Target
  • RS
    Source