lswi or lsi (Load String Word Immediate) instruction

Purpose

Loads consecutive bytes in storage from a specified location in memory into consecutive general-purpose registers.

Syntax

Bits Value
0 -5 31
6 - 10 RT
11 - 15 RA
16 - 20 NB
21 - 30 597
31 /
PowerPC® 
lswi RT, RA, NB
POWER® family 
lsi RT, RA, NB

Description

The lswi and lsi instructions load N consecutive bytes in storage addressed by the effective address (EA) into general-purpose register GPR RT, starting with the leftmost byte, through GPR RT+NR-1, and wrapping around back through GPR 0, if required.

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

Consider the following when using the lswi and lsi instructions:

  • NB is the byte count.
  • RT is the starting general-purpose register.
  • N is NB, which is the number of bytes to load. If NB is 0, then N is 32.
  • NR is ceiling(N/4), which is the number of general-purpose registers to receive data.

For the PowerPC® instruction lswi, if GPR RA is in the range of registers to be loaded or RT = RA = 0, the instruction form is invalid.

Consider the following when using the POWER® family instruction lsi:

  • If GPR RT + NR - 1 is only partially filled on the left, the rightmost bytes of that general-purpose register are set to 0.
  • If GPR RA is in the range to be loaded, and if GPR RA is not equal to 0, then GPR RA is not written into by this instruction. The data that would have been written into it is discarded, and the operation continues normally.

The lswi and lsi instructions have one syntax form which does not affect the Fixed-Point Exception Register or Condition Register Field 0.

Note: The lswi and lsi instructions can be interrupted by a Data Storage interrupt. When such an interrupt occurs, the instruction is restarted from the beginning.

Parameters

Item Description
RT Specifies starting general-purpose register of stored data.
RA Specifies general-purpose register for EA calculation.
NB Specifies byte count.

Examples

The following code loads the bytes contained in a location in memory addressed by GPR 7 into GPR 6:


.csect data[rw]
.string "Hello, World"
# Assume GPR 7 contains the address of csect data[rw].
.csect text[pr]
lswi 6,7,0x6
# GPR 6 now contains 0x4865 6c6c.