lfs

Load Floating-Point Single D-form

lfs FRT,D(RA)

Loads a single-precision floating-point value from memory into a floating-point register and converts it to double precision.

Details

The lfs instruction loads a single-precision floating-point value from the effective address (EA) into the target floating-point register FRT. The EA is calculated as RA + D, where D is sign-extended to 64 bits if RA is not zero.

Pseudocode Operation

EA <- (RA) + SIMM
if WORD1:8 = 255 or WORD1:31 = 0 then
    FRT0:1 ←WORD0:1
    FRT2 ←WORD1
    FRT3 ←WORD1
    FRT4 ←WORD1
    FRT5:63 ←WORD2:31 || 290
else if WORD1:8 > 0 and WORD1:8 < 255 then
    FRT0:1 ←WORD0:1
    FRT2 ←¬WORD1
    FRT3 ←¬WORD1
    FRT4 ←¬WORD1
    FRT5:63 ←WORD2:31 || 290
else if WORD1:8 = 0 and WORD9:31 ≠ 0 then
    sign ←WORD0
    exp ←-126
    frac0:52 ←0b0 || WORD9:31 || 290
    do while frac0 = 0
        frac0:52 ←frac1:52 || 0b0
        exp ←exp - 1
    FRT0 ←sign
    FRT1:11 ←exp + 1023

Programming Note

The lfs extended mnemonic permits computing an effective address as a Load or Store instruction would, but loads the address itself into a GPR rather than loading the value that is in storage at that address.

Example

lfs f1, 0(r4)

Encoding

Binary Layout
48
0
FRT
6
RA
11
D
16
 
Format D-form
Opcode 0x30000000
Extension Floating-Point
Registers Altered None, FPSCR

Operands

  • FRT
    Target Floating-Point Register
  • RA
    Base General Purpose Register
  • D
    Displacement
  • offset
    Immediate Offset