[RISCV][MC] Recognise that fcvt.d.s with frm != 0b000 is valid (#67555)
This seems to be an issue common to both GCC and LLVM. There are various RISC-V FCVT instructions where the frm field makes no difference to the output as the result is always exact (e.g. fcvt.d.s, fcvt.s.h, fcvt.d.h). As with GCC, we always generate a form of these fcvt instructions where frm=0b000. However, the ISA manual _doesn't_ state that frm values are invalid, and we should ensure we can accept them. This patch does so by adding the frm field to fcvt.d.s and adding an InstAlias so that if no frm is specified, it defaults to rne (0b000). This patch just corrects fcvt.d.s in order to allow the approach to be reviewed, before applying it to the other affected instructions. I haven't added tests to llvm/test/MC/Disassembler/RISCV, because it doesn't seem necessary to test there in addition to our usual round-trip tests in llvm/test/MC/RISCV. But feedback is welcome. Recently added tests ensure that the default `rne` rounding mode is printed as desired.
parent
a5686c2b
Please register or sign in to comment