# `fsw`

[RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v.md) › [Instructions](https://asm-editor.specy.app/documentation/risc-v/instruction.md)

Web page: https://asm-editor.specy.app/documentation/risc-v/instruction/fsw

**Store a float to memory**

Category: Floating point

Stores the single-precision value in the first register at the address in the second plus an offset.

[RISC-V manual: fsw](https://docs.riscv.org/reference/isa/v20260120/unpriv/f-st-ext.html#norm:fsw_flw_op)

Used in: [Floating point and the F and D extensions](https://asm-editor.specy.app/learn/courses/risc-v/think-in-assembly/floating-point-and-the-f-and-d-extensions.md) (RISC-V assembly)

## Forms

- `fsw f1, imm12(t1)`

## Pseudo-instructions

The processor does not have these forms. The assembler replaces each of them with one or more real instructions. Open a row to see them.

Store 32-bit value from f1 to effective memory word address

- `fsw f1, (t2)`
  - `fsw f1,(t2)` → `fsw f1, 0(t2)`
- `fsw f1, imm12`
  - `fsw f1,-100` → `fsw f1, imm12(zero)`

Store 32-bit value from f1 to effective memory word address using t3 as a temporary

- `fsw f1, imm32, t3`
  - `fsw f1,10000000,t3` → `lui t3, hi(imm32)`; `fsw f1, lo(imm32)(t3)`
- `fsw f1, label, t3`
  - `fsw f1,label, t3` → `auipc t3, pcrel_hi(label)`; `fsw f1, pcrel_lo(label)(t3)`

- `fsw f1, %lo(label)(t2)` · Store to Address
  - `fsw f1,%lo(label)(t2)` → `fsw f1, lo(label)(t2)`

## Operands

- `f1`: Any floating-point register, `f0` to `f31`, or its named alias, such as `ft0`, `fa0` or `ft11`.
- `imm12`: A signed 12-bit immediate, `-2048` to `2047`.
- `t1`: Any integer register, `x0` to `x31`, or its named alias, such as `zero`, `t0` or `t6`.
- `t2`: An integer register. It may be the same register as `t1`.
- `imm32`: A 32-bit immediate, `-2147483648` to `4294967295`.
- `t3`: An integer register. It may be the same register as `t1`.
- `label`: A named address in the program, such as the start of a loop or a variable in `.data`.

## Example

```riscv
# value is initialized and naturally aligned for this operation.
.data
value: .word 0
.text
la t0, value
li t1, 42
fcvt.s.w f1, t1
# Store 42.0 (bytes 00 00 28 42) at value; inspect Memory.
fsw f1, 0(t0)
```
