# `fsflags`

[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/fsflags

**Swap FP exception flags** · Pseudo-instruction

Category: Floating point

Swaps the second register into the FP exception flags, storing the old flags in the first, or, when given one register, only writes that register.

[RISC-V manual: csrrw](https://docs.riscv.org/reference/isa/v20260120/unpriv/zicsr.html#norm:csrrw_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

- `fsflags t1, t2`
  - `fsflags t1, t2` → `csrrw t1, fflags, t2`

- `fsflags t1` · Write FP exception flags
  - `fsflags t1` → `csrrw zero, fflags, t1`

## Operands

- `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`.

## Example

```riscv
# Initialize fflags, then use fsflags to read its old value or update it.
.text
li t3, 0
csrw t3, fflags
li t0, 1
fsflags t1, t0
# t1=0 is the old value; fflags becomes 1.
```
