fsrm

Swap FP rounding mode Pseudo-instruction

Swaps t2 into the FP rounding mode, storing the old mode in t1, or only writes t1 when given one register.

RISC-V manual: csrrw

Forms

  • Write FP rounding mode

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.
# Initialize frm, then use fsrm to read its old value or update it.
.text
li t3, 0
csrw t3, frm
li t0, 1
fsrm t1, t0
# t1=0 is the old value; frm becomes 1.