stw or st (Store) instruction

Purpose

Stores a word of data from a general-purpose register into a specified location in memory.

Syntax

Bits Value
0 - 5 36
6 - 10 RS
11 - 15 RA
16 - 31 D
PowerPC® 
stw RS, D( RA)
POWER® family 
st RS, D( RA)

Description

The stw and st instructions store a word from general-purpose register (GPR) RS into a word 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 D, a 16-bit signed two's complement integer sign-extended to 32 bits. If GPR RA is 0, then the EA is D.

The stw and st instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.

Parameters

Item Description
RS Specifies source general-purpose register of stored data.
D Specifies a16-bit signed two's complement integer sign-extended to 32 bits for EA calculation.
RA Specifies source general-purpose register for EA calculation.

Examples

The following code stores the contents of GPR 6 into a location in memory:


.csect data[rw]
buffer: .long 0,0
# Assume GPR 6 contains 0x9000 3000.
# Assume GPR 5 contains the address of buffer.
.csect text[pr]
stw 6,4(5)
# 0x9000 3000 is now stored at the address buffer+4.