sthux (Store Half with Update Indexed) instruction
Purpose
Stores a halfword of data from a general-purpose register into a specified location in memory and possibly places the address in another general-purpose register.
Syntax
| Bits | Value |
|---|---|
| 0 - 5 | 31 |
| 6 - 10 | RS |
| 11 - 15 | RA |
| 16 | RB |
| 21 - 30 | 439 |
| 31 | / |
Description
The sthux instruction stores bits 16-31 of general-purpose register (GPR) RS into the halfword of storage addressed by the effective address (EA).
If GPR RA is not 0, the EA is the sum of the contents of GPR RA and GPR RB. If GPR RA is 0, then the EA is the contents of GPR RB.
If GPR RA does not equal 0 and the storage access does not cause an Alignment Interrupt or a Data Storage Interrupt, then the EA is placed into register GPR RA.
The sthux instruction has one syntax form and does not affect the Fixed-Point Exception Register or Condition Register Field 0.
Parameters
| Item | Description |
|---|---|
| RS | Specifies source general-purpose register of stored data. |
| RA | Specifies source general-purpose register for EA calculation and possible address update. |
| RB | Specifies source general-purpose register for EA calculation. |
Examples
The following code stores the halfword contents of GPR 6 into a memory location and stores the address in GPR 4:
.csect data[rw]
buffer: .long 0,0,0,0
# Assume GPR 6 contains 0x9000 3456.
# Assume GPR 4 contains 0x0000 0007.
# Assume GPR 5 contains the address of buffer.
.csect text[pr]
sthux 6,4,5
# buffer+0x07 contains 0x3456.
# GPR 4 contains the address of buffer+0x07.