sh

Operands

$reg, [imm($reg) / LO(id) / ($reg) / imm / id / id($reg) / id+imm / id+imm($reg)], ($reg)

Store halfword : Writes the lowest 16 bits of $t1 to memory at address ($t2 + offset). The upper 16 bits of $t1 are ignored. The address must be halfword-aligned (divisible by 2).

Variants

  • Store halfword : Writes the lowest 16 bits of $t1 to memory at address ($t2 + offset). The upper 16 bits of $t1 are ignored. The address must be halfword-aligned (divisible by 2). sh $t1,-100($t2)
  • Store to Address : Write to label's address, reached through the %hi already in $t2 sh $t1,%lo(label)($t2)
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,($t2)
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,-100
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,100
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,100000
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,100($t2)
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,100000($t2)
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,label
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,label($t2)
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,label+100000
  • Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword address sh $t1,label+100000($t2)
.data
.align 2
data: .half 0
.text
# Write initialized value 0x12345678 with sh; inspect data bytes after the instruction: [0x78, 0x56].
la $t1, data
li $t0, 0x12345678
sh $t0, 0($t1)