[PATCH 0/1] RISC-V: Fix mask for some fcvt instructions

Tsukasa OI research_trasio@irq.a4lg.com
Mon Jan 10 08:22:10 GMT 2022


This patch fixes wrong mask used in following RISC-V instructions:

-   fcvt.s.wu
-   fcvt.s.lu
-   fcvt.d.lu
-   fcvt.q.lu

For instance, 'fcvt.s.wu' instruction should have mask value
"MASK_FCVT_S_WU|MASK_RM", not "MASK_FCVT_S_W|MASK_RM".  Fortunately,
this kind of error will not cause functional problem since MASK_FCVT_S_W
and MASK_FCVT_S_WU have exactly the same value of 0xfff0007f.

However, it's always good to fix this kind of stuff because it's
definately an error and can be a code clarity problem.

... More of that, it can grow.  Actually, I found this issue while
implementing 'Zfh' and 'Zfhmin' instructions (yes, I copied 'F'
instructions to make 'fcvt.h.wu' and 'fcvt.h.lu' instructions and found
something is wrong).

This is not hypothetical situation and happened before.  For first three
instructions ('fcvt.s.wu', 'fcvt.s.lu' and 'fcvt.d.lu'), it contained
errors from very first (commit e23eba971dd409b999dd83d8df0f842680c1c642;
the first time RISC-V is merged into GNU Binutils) and 'fcvt.q.lu' with
an error is added in commit cc917fd93d2a836adfd61b91df021cf835e88fd1
(apparently, the author copied the 'D' instructions code without
realizing a problem behind it).

I machine-checked the entire riscv_opcodes and it should be the first
**and** the last.




Tsukasa OI (1):
  RISC-V: Fix mask for some fcvt instructions

 opcodes/riscv-opc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


base-commit: 4cfa9e3f28c8c5156b9773cc94192233947d351c
-- 
2.32.0



More information about the Binutils mailing list