stfs
Store Floating-Point Single - D0 00 00 00
stfs

Instruction Syntax

Mnemonic Format Flags
stfs frS,d(rA) None

Instruction Encoding

1
1
0
1
0
0
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 110100 (0x34)
frS 6-10 Source floating-point register
rA 11-15 Base register
SIMM 16-31 Signed immediate offset

Operation

EA ← (rA) + SIMM
(EA) ← (frS)[32:63]

The effective address is calculated by adding the signed immediate offset to the base register. The single-precision floating-point value (high-order 32 bits) of the source register is stored at the effective address.

Note: The stfs instruction stores a 32-bit single-precision floating-point value to memory. The address must be aligned to a 4-byte boundary.

Affected Registers

Memory

Examples

Basic Store Floating-Point Single

# Store single-precision value from fr1 to memory
stfs fr1, 0(r3)     # Store at address in r3
stfs fr1, 4(r3)     # Store at address r3 + 4

Array of Singles

# Store single in array
li r4, 0            # Array index
slwi r4, r4, 2      # Multiply by 4 (single size)
add r5, r3, r4      # Calculate address
stfs fr1, 0(r5)     # Store single

Floating-Point Calculations

# Store result of floating-point calculation
fadds fr2, fr0, fr1 # fr2 = fr0 + fr1 (single precision)
stfs fr2, result    # Store result to memory

Related Instructions

stfsu, stfsux, stfsx, lfs

Back to Index