Bugfix: FS dirty on fcvt.{w,wu,l,lu}.[sdq] and FP compares
The RISC-V Privileged Architectures V1.11-draft says:
"The FS[1:0] read/write field and the XS[1:0] read-only field are
used to reduce the cost of context save and restore by setting and
tracking the current state of the floating-point unit and any other
user-mode extensions respectively. The FS field encodes the status
of the floating-point unit, including the CSR fcsr and
floating-point data registers f0–f31.."
As fcvt.{w,wu,l,lu}.[sdq] and FP compares _could_ potentially set the
NV (Invalid Op) exception bit in FCSR, we must mark the state as dirty
in FS. I'm assuming it's ok to be conservative here and mark it dirty
even if no new bit was actually set. It's clearly not ok, to _not_
mark it dirty if one was set.
There is still one FP instruction that doesn't set FS (fclass), though
it would probably be acceptible to set the FS bit there as well.
parent
94623d6f
Please register or sign in to comment