fsflagsi

RISC-V fsflagsi Pseudo-Instruction Details

Assembler pseudo-instruction

RISC-V fsflagsi uses CSRRWI to write fflags with a five-bit zero-extended immediate. It reads and returns the old value only when rd is not x0.

What You Write
fsflagsi rd, imm fsflagsi imm
Expansion By Form
fsflagsi rd, imm
csrrwi rd, fflags, imm
fsflagsi imm
csrrwi x0, fflags, imm

What This Pseudo Instruction Is Saving You From Writing

fsflagsi rd, imm reads the old fflags value and returns it in rd only when rd is not x0. With rd=x0, including the one-operand form, it writes without reading fflags.

Availability And Extension Conditions

Base Conditions
  • Applies where the described fflags field is implemented.

How The Two Forms Differ

Form 1
fsflagsi rd, imm expands to csrrwi rd, fflags, imm; it reads and returns the old fflags value only when rd is not x0.
Form 2
fsflagsi imm uses CSRRWI with rd=x0 to write fflags and does not read that CSR.

Assembly Forms And Real Instructions

This page records the official expansion only; the RISC-V Assembly Programmer's Manual lists these spellings as pseudoinstructions.

Official References And Reading Order

This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.

When To Think Of It First

Use the two-operand form with rd other than x0 to write fflags and keep the old value.
Use the one-operand form to write fflags.

Pitfalls / Common Confusions

The CSRRWI immediate is a five-bit unsigned value zero-extended to XLEN.
The two-operand form can also specify rd=x0; CSRRWI then does not read fflags or cause CSR-read side effects.

FAQ

Is fsflagsi a separate hardware opcode?

No. the RISC-V Assembly Programmer's Manual lists fsflagsi as an assembler pseudoinstruction; behavior comes from the listed CSR expansion.

What is the official fsflagsi expansion?

the RISC-V Assembly Programmer's Manual lists: csrrwi rd, fflags, imm; csrrwi x0, fflags, imm.

Does the two-operand fsflagsi form always keep the old value?

CSRRWI reads the old fflags value and returns it in rd only when rd is not x0. With rd=x0, the two-operand form, like the one-operand form, does not read fflags or cause CSR-read side effects.