stwbrx or stbrx (Store Word Byte-Reverse Indexed) instruction

Purpose

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

Syntax

Bits Value
0 - 5 31
6 - 10 RS
11 - 15 RA
16 - 20 RB
21 - 30 662
31 /
PowerPC® 
stwbrx RS, RA, RB
POWER® family 
stbrx RS, RA, RB

Description

The stwbrx and stbrx instructions store a byte-reversed word from general-purpose register (GPR) RS into a word of storage addressed by the effective address (EA).

Consider the following when using the stwbrx and stbrx instructions:

  • Bits 24-31 of GPR RS are stored into bits 00-07 of the word in storage addressed by EA.
  • Bits 16-23 of GPR RS are stored into bits 08-15 of the word in storage addressed by EA.
  • Bits 08-15 of GPR RS are stored into bits 16-23 of the word in storage addressed by EA.
  • Bits 00-07 of GPR RS are stored into bits 24-31 of the word in storage addressed by 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.

The stwbrx and stbrx 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 a byte-reverse word from GPR 6 into a location in memory:


.csect data[rw]
buffer: .long 0
# Assume GPR 4 contains the address of buffer.
# Assume GPR 9 contains 0x0000 0000.
# Assume GPR 6 contains 0x1234 5678.
.csect text[pr]
stwbrx 6,4,9
# 0x7856 3412 is now stored at the address of buffer.