As D113439's discussion, I would like to propose adding
a roundmode operand to instructions that implicitly use VXRM.
And this would allow us to provide intrinsics that are IntrNoMem and pass down a round mode imm. to the backend which will then be able to change the round mode accordingly.
This patch implements single intrinsic int.riscv.vaadd.rm and a naive pass to insert WriteVXRM by iterating through each instruction and check the roundmode operand.
Current implementation conservatively keeps the incoming VXRM value and restores it back before affecting other VXRM users, because the ABI doesn't specify it is preserved or volatile across calls.
It can be improved further if the ABI is updated.
I think both sets of intrinsics (1) and (2) will coexist in the meantime until we all agree to replace (1) with (2)
(1) int.riscv.vaadd.*
(2) int.riscv.vaadd.rm.*
Is it worth saying with mask and rounding-mode operand to help people differentiate between the intrinsics?
Also this one is defined after the no-roundmode version, but RISCVSaturatingBinaryRMAAXNoMask is defined before its counterpart. I find that quite confusing.