stmw
Store Multiple Words - BC 00 00 00
stmw

Instruction Syntax

Mnemonic Format Flags
stmw rS,d(rA) None

Instruction Encoding

1
0
1
1
1
1
S
S
S
S
S
A
A
A
A
A
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I

Field Bits Description
Primary Opcode 0-5 101111 (0x2F)
rS 6-10 Starting source register
rA 11-15 Base register
SIMM 16-31 Signed immediate offset

Operation

EA ← (rA) + SIMM
for i = rS to 31 do
    (EA + (i - rS) * 4) ← (GPR[i])
endfor

The effective address is calculated by adding the signed immediate offset to the base register. Starting from register rS, all registers from rS through r31 are stored to consecutive memory locations, with each register stored at an address that is 4 bytes higher than the previous one.

Note: The stmw instruction stores multiple consecutive registers to memory. This is useful for saving registers during function calls or context switches.

Affected Registers

Memory

Examples

Basic Store Multiple Words

# Store registers r14 through r31 to memory
stmw r14, 0(r3)    # Store at address in r3
# Stores r14 at EA, r15 at EA+4, r16 at EA+8, etc.

Function Prologue

# Save non-volatile registers in function prologue
stmw r14, -64(r1)  # Save r14-r31 to stack
# This saves 18 registers (r14 through r31)

Context Switch

# Save all registers during context switch
stmw r0, save_area  # Save r0-r31 to save area
# This saves all 32 general purpose registers

Related Instructions

lmw, stw, stwu

Back to Index