extsh

Extend Sign Halfword

extsh RA, RS

Sign extends the low halfword.

Encoding

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

Operands

  • RA
    Target
  • RS
    Source

Example

extsh r4, r3

Related

More in Base

Reference

Description

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.).

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.