seh

Sign extend halfword

Copies the low 16 bits of $t2 into $t1, with bit 15 replicated through the upper 16 bits.

Forms

  • seh ,

Operands

$t1
Any general-purpose register, $0 to $31, using its numeric or named spelling, such as $8 or $t0 ($zero is $0; $ra is $31).
$t2
A general-purpose register. It may be the same register as $t1.

Turns a halfword loaded with 'lhu' back into a signed value.

# Apply seh to initialized pattern 0x80FF. Inspect $t2: 0xFFFF80FF.
li $t0, 0x80FF
seh $t2, $t0