[libre-riscv-dev] SV Prefix questions

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Jun 26 09:57:22 BST 2019

btw, also, reminder: another not-exactly-horrible trick: in a loop, if
P48 or P64 instructions need to use a different SUBVL or VL/MVL from
the rest of the loop (rare for VL/MVL but not so rare for SUBVL), *if
needed* a sequence of 3 instructions can:

*  capture STATE with a CSRR STATE, t0
* do the P48/P64 instruction
* put STATE back into t0 with CSRRW STATE, t0

it... actually works, because the use of STATE is, on every new
instruction, reset back to "known good" as far as the offsets are
concerned (srcoffs, destoffs and subvl equivalents).

the only circumstances where those offsets are *not* zero is when
someone actually manually writes to the STATE CSR, whether in
user-space on in a trap to (x)eSTATE and the return from the trap
swaps that into STATE.


More information about the libre-riscv-dev mailing list