stswx or stsx (Store String Word Indexed) instruction

Purpose

Stores consecutive bytes from consecutive registers into a specified location in memory.

Syntax

Bits Value
0 - 5 31
6 - 10 RS
11 - 15 RA
16 - 20 RB
21 - 30 661
31 /
PowerPC® 
stswx RS, RA, RB
POWER® family 
stsx RS, RA, RB

Description

The stswx and stsx instructions store N consecutive bytes starting with the leftmost byte in register RS at the effective address (EA) from general-purpose register (GPR) RS through GPR RS + NR - 1.

If GPR RA is not 0, the EA is the sum of the contents of GPR RA and the contents of GPR RB. If GPR RA is 0, then EA is the contents of GPR RB.

Consider the following when using the stswx and stsx instructions:

  • XER25-31 contain the byte count.
  • RS is the starting register.
  • N is XER25-31, which is the number of bytes to store.
  • NR is ceiling(N/4), which is the number of registers to store data from.

For the POWER® family instruction stsx, the contents of the MQ Register are undefined.

The stswx and stsx 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.
RA Specifies source general-purpose register for EA calculation.
RB Specifies source general-purpose register for EA calculation.

Examples

The following code stores the bytes contained in GPR 6 to GPR 7 into the specified bytes of a location in memory:


.csect data[rw]
buffer: .long 0,0,0
# Assume GPR 5 contains 0x0000 0007.
# Assume GPR 4 contains the address of buffer.
# Assume GPR 6 contains 0x4865 6C6C.
# Assume GPR 7 contains 0x6F20 776F.
# The Fixed-Point Exception Register bits 25-31 contain 6.
.csect text[pr]
stswx 6,4,5
# buffer+0x7 now contains 0x4865 6C6C 6F20.