[v1] RISC-V: Let fcvt.* recognize rounding mode != 0

Message ID 20241015093025.1644019-1-hau.hsu@sifive.com
State New
Headers
Series [v1] RISC-V: Let fcvt.* recognize rounding mode != 0 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Hau Hsu Oct. 15, 2024, 9:30 a.m. UTC
  For those floating point convert instructions that convert from lower
precisions to higher precisions, although the rounding mode has no
effects, the spec doesn’t forbid them to be values other than zero.

fcvt.q.l and fcvt.q.lu were fixed by 1d1595b. This patch also adds
test for them.

gas/ChangeLog:

	* testsuite/gas/riscv/fp-zfh-insns.d: New test for rounding mode.
	* testsuite/gas/riscv/fp-zfh-insns.s: Likewise.
	* testsuite/gas/riscv/zdinx.d: Likewise.
	* testsuite/gas/riscv/zdinx.s: Likewise.
	* testsuite/gas/riscv/zfbfmin.d: Likewise.
	* testsuite/gas/riscv/zfbfmin.s: Likewise.
	* testsuite/gas/riscv/zqinx.d: Likewise.
	* testsuite/gas/riscv/zqinx.s: Likewise.

opcode/ChangeLog:
	* riscv-opc.c (riscv_opcodes): Add opcodes for fcvt.* with
	rounding mode.

---
 gas/testsuite/gas/riscv/fp-zfh-insns.d |  3 +++
 gas/testsuite/gas/riscv/fp-zfh-insns.s |  3 +++
 gas/testsuite/gas/riscv/zdinx.d        |  2 ++
 gas/testsuite/gas/riscv/zdinx.s        |  2 ++
 gas/testsuite/gas/riscv/zfbfmin.d      |  1 +
 gas/testsuite/gas/riscv/zfbfmin.s      |  1 +
 gas/testsuite/gas/riscv/zqinx.d        |  6 ++++++
 gas/testsuite/gas/riscv/zqinx.s        |  6 ++++++
 opcodes/riscv-opc.c                    | 11 +++++++++++
 9 files changed, 35 insertions(+)
  

Comments

Jan Beulich Oct. 15, 2024, 12:42 p.m. UTC | #1
On 15.10.2024 11:30, Hau Hsu wrote:
> For those floating point convert instructions that convert from lower
> precisions to higher precisions, although the rounding mode has no
> effects, the spec doesn’t forbid them to be values other than zero.

Yet what's the point of permitting the use of misleading operands? In the
commit you refer to below I specifically said that the non-standard 3-
operand forms are left merely to avoid breaking existing code. At some
point I think use of them should actually be warned about, to allow their
removal at a yet later point.

Or is this just for the sake of disassembly, when some of the RM bits are
set? In that cases I'm inclined to request that measures be taken to avoid
their use when assembling code.

> fcvt.q.l and fcvt.q.lu were fixed by 1d1595b. This patch also adds
> test for them.

You add tests for the 3-operand forms, whereas the mentioned commit fixed
the 2-operand ones.

Jan
  
Nelson Chu Oct. 15, 2024, 3:17 p.m. UTC | #2
On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com> wrote:

> On 15.10.2024 11:30, Hau Hsu wrote:
> > For those floating point convert instructions that convert from lower
> > precisions to higher precisions, although the rounding mode has no
> > effects, the spec doesn’t forbid them to be values other than zero.
>
> Yet what's the point of permitting the use of misleading operands? In the
> commit you refer to below I specifically said that the non-standard 3-
> operand forms are left merely to avoid breaking existing code. At some
> point I think use of them should actually be warned about, to allow their
> removal at a yet later point.
>

Hey Jan,

Personally, I agree and support that permitting the use of misleading
operands looks weird, even though the random test generator people are
always not happy about it.  Anway, I found this old discussion,
https://github.com/riscv/riscv-isa-manual/issues/603.  So...

Hey Andrew,

Seems that this patch is trying to do the things that the above link
mentioned - allow the unaffected rm field of fp widening conversion
instructions.  Is this still valid now?  If that is so, then not only
instructions in this patch need to be fixed.

Thanks
Nelson
  
Jeff Law Oct. 15, 2024, 3:24 p.m. UTC | #3
On 10/15/24 9:17 AM, Nelson Chu wrote:
> 
> 
> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com 
> <mailto:jbeulich@suse.com>> wrote:
> 
>     On 15.10.2024 11:30, Hau Hsu wrote:
>      > For those floating point convert instructions that convert from lower
>      > precisions to higher precisions, although the rounding mode has no
>      > effects, the spec doesn’t forbid them to be values other than zero.
> 
>     Yet what's the point of permitting the use of misleading operands?
>     In the
>     commit you refer to below I specifically said that the non-standard 3-
>     operand forms are left merely to avoid breaking existing code. At some
>     point I think use of them should actually be warned about, to allow
>     their
>     removal at a yet later point.
> 
> 
> Hey Jan,
> 
> Personally, I agree and support that permitting the use of misleading 
> operands looks weird, even though the random test generator people are 
> always not happy about it.  Anway, I found this old discussion, https:// 
> github.com/riscv/riscv-isa-manual/issues/603 <https://github.com/riscv/ 
> riscv-isa-manual/issues/603>.  So...
Funny, I've got a complaint from our DV folks for the same issue.  I've 
punted it so far, but I don't think they're particularly happy about it.

jeff
  
Palmer Dabbelt Oct. 15, 2024, 3:56 p.m. UTC | #4
On Tue, 15 Oct 2024 08:24:25 PDT (-0700), jeffreyalaw@gmail.com wrote:
>
>
> On 10/15/24 9:17 AM, Nelson Chu wrote:
>>
>>
>> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com
>> <mailto:jbeulich@suse.com>> wrote:
>>
>>     On 15.10.2024 11:30, Hau Hsu wrote:
>>      > For those floating point convert instructions that convert from lower
>>      > precisions to higher precisions, although the rounding mode has no
>>      > effects, the spec doesn’t forbid them to be values other than zero.
>>
>>     Yet what's the point of permitting the use of misleading operands?
>>     In the
>>     commit you refer to below I specifically said that the non-standard 3-
>>     operand forms are left merely to avoid breaking existing code. At some
>>     point I think use of them should actually be warned about, to allow
>>     their
>>     removal at a yet later point.
>>
>>
>> Hey Jan,
>>
>> Personally, I agree and support that permitting the use of misleading
>> operands looks weird, even though the random test generator people are
>> always not happy about it.  Anway, I found this old discussion, https://
>> github.com/riscv/riscv-isa-manual/issues/603 <https://github.com/riscv/
>> riscv-isa-manual/issues/603>.  So...
> Funny, I've got a complaint from our DV folks for the same issue.  I've
> punted it so far, but I don't think they're particularly happy about it.

I thought we just told them to use `.insn` for this sort of stuff?  Did 
that not work out?
  
Jeff Law Oct. 15, 2024, 5:18 p.m. UTC | #5
On 10/15/24 9:56 AM, Palmer Dabbelt wrote:
> On Tue, 15 Oct 2024 08:24:25 PDT (-0700), jeffreyalaw@gmail.com wrote:
>>
>>
>> On 10/15/24 9:17 AM, Nelson Chu wrote:
>>>
>>>
>>> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com
>>> <mailto:jbeulich@suse.com>> wrote:
>>>
>>>     On 15.10.2024 11:30, Hau Hsu wrote:
>>>      > For those floating point convert instructions that convert 
>>> from lower
>>>      > precisions to higher precisions, although the rounding mode 
>>> has no
>>>      > effects, the spec doesn’t forbid them to be values other than 
>>> zero.
>>>
>>>     Yet what's the point of permitting the use of misleading operands?
>>>     In the
>>>     commit you refer to below I specifically said that the non- 
>>> standard 3-
>>>     operand forms are left merely to avoid breaking existing code. At 
>>> some
>>>     point I think use of them should actually be warned about, to allow
>>>     their
>>>     removal at a yet later point.
>>>
>>>
>>> Hey Jan,
>>>
>>> Personally, I agree and support that permitting the use of misleading
>>> operands looks weird, even though the random test generator people are
>>> always not happy about it.  Anway, I found this old discussion, https://
>>> github.com/riscv/riscv-isa-manual/issues/603 <https://github.com/riscv/
>>> riscv-isa-manual/issues/603>.  So...
>> Funny, I've got a complaint from our DV folks for the same issue.  I've
>> punted it so far, but I don't think they're particularly happy about it.
> 
> I thought we just told them to use `.insn` for this sort of stuff?  Did 
> that not work out?
I think that's what they're using.  But I don't think they're 
particularly happy about it.

jeff
  
Andrew Waterman Oct. 15, 2024, 8:24 p.m. UTC | #6
On Tue, Oct 15, 2024 at 8:17 AM Nelson Chu <nelson@rivosinc.com> wrote:
>
>
>
> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 15.10.2024 11:30, Hau Hsu wrote:
>> > For those floating point convert instructions that convert from lower
>> > precisions to higher precisions, although the rounding mode has no
>> > effects, the spec doesn’t forbid them to be values other than zero.
>>
>> Yet what's the point of permitting the use of misleading operands? In the
>> commit you refer to below I specifically said that the non-standard 3-
>> operand forms are left merely to avoid breaking existing code. At some
>> point I think use of them should actually be warned about, to allow their
>> removal at a yet later point.
>
>
> Hey Jan,
>
> Personally, I agree and support that permitting the use of misleading operands looks weird, even though the random test generator people are always not happy about it.  Anway, I found this old discussion, https://github.com/riscv/riscv-isa-manual/issues/603.  So...
>
> Hey Andrew,
>
> Seems that this patch is trying to do the things that the above link mentioned - allow the unaffected rm field of fp widening conversion instructions.  Is this still valid now?  If that is so, then not only instructions in this patch need to be fixed.

Using a nonzero rm field is definitely legal at the ISA level.

I don't have a strong opinion on this one.  It's benign to allow
these, but they're only useful for DV, not application software.  If
that is (or isn't) deemed to be a good enough reason, fine by me, but
we should stay philosophically consistent going forward.

>
> Thanks
> Nelson
  
Hau Hsu Oct. 16, 2024, 2:06 a.m. UTC | #7
More context:
Previously LLVM generated instructions to use DYN rounding mode for fcvt.s.bf16.
We got errors when using gas to assemble the code generated by LLVM.
The LLVM codegen is mysterious and Craig had a PR to fix it:
https://github.com/llvm/llvm-project/pull/106948/commits/90aa61e0dbbf2442dfd49bb645c31f7debf0f4e0 
But still he reported this issue and I had this patch.

Hau






> On Oct 16, 2024, at 4:24 AM, Andrew Waterman <andrew@sifive.com> wrote:
> 
> On Tue, Oct 15, 2024 at 8:17 AM Nelson Chu <nelson@rivosinc.com <mailto:nelson@rivosinc.com>> wrote:
>> 
>> 
>> 
>> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com> wrote:
>>> 
>>> On 15.10.2024 11:30, Hau Hsu wrote:
>>>> For those floating point convert instructions that convert from lower
>>>> precisions to higher precisions, although the rounding mode has no
>>>> effects, the spec doesn’t forbid them to be values other than zero.
>>> 
>>> Yet what's the point of permitting the use of misleading operands? In the
>>> commit you refer to below I specifically said that the non-standard 3-
>>> operand forms are left merely to avoid breaking existing code. At some
>>> point I think use of them should actually be warned about, to allow their
>>> removal at a yet later point.
>> 
>> 
>> Hey Jan,
>> 
>> Personally, I agree and support that permitting the use of misleading operands looks weird, even though the random test generator people are always not happy about it.  Anway, I found this old discussion, https://github.com/riscv/riscv-isa-manual/issues/603.  So...
>> 
>> Hey Andrew,
>> 
>> Seems that this patch is trying to do the things that the above link mentioned - allow the unaffected rm field of fp widening conversion instructions.  Is this still valid now?  If that is so, then not only instructions in this patch need to be fixed.
> 
> Using a nonzero rm field is definitely legal at the ISA level.
> 
> I don't have a strong opinion on this one.  It's benign to allow
> these, but they're only useful for DV, not application software.  If
> that is (or isn't) deemed to be a good enough reason, fine by me, but
> we should stay philosophically consistent going forward.
> 
>> 
>> Thanks
>> Nelson
  
Craig Topper Oct. 16, 2024, 2:13 a.m. UTC | #8
Here's an older related LLVM patch from Alex Bradbury
https://github.com/llvm/llvm-project/pull/67555 for fcvt.d.s and other
instructions.

On Tue, Oct 15, 2024 at 7:06 PM Hau Hsu <hau.hsu@sifive.com> wrote:

> More context:
> Previously LLVM generated instructions to use DYN rounding mode for
> fcvt.s.bf16.
> We got errors when using gas to assemble the code generated by LLVM.
> The LLVM codegen is mysterious and Craig had a PR to fix it:
>
> https://github.com/llvm/llvm-project/pull/106948/commits/90aa61e0dbbf2442dfd49bb645c31f7debf0f4e0
>
> But still he reported this issue and I had this patch.
>
> Hau
>
>
>
>
>
>
> On Oct 16, 2024, at 4:24 AM, Andrew Waterman <andrew@sifive.com> wrote:
>
> On Tue, Oct 15, 2024 at 8:17 AM Nelson Chu <nelson@rivosinc.com> wrote:
>
>
>
>
> On Tue, Oct 15, 2024 at 8:42 PM Jan Beulich <jbeulich@suse.com> wrote:
>
>
> On 15.10.2024 11:30, Hau Hsu wrote:
>
> For those floating point convert instructions that convert from lower
> precisions to higher precisions, although the rounding mode has no
> effects, the spec doesn’t forbid them to be values other than zero.
>
>
> Yet what's the point of permitting the use of misleading operands? In the
> commit you refer to below I specifically said that the non-standard 3-
> operand forms are left merely to avoid breaking existing code. At some
> point I think use of them should actually be warned about, to allow their
> removal at a yet later point.
>
>
>
> Hey Jan,
>
> Personally, I agree and support that permitting the use of misleading
> operands looks weird, even though the random test generator people are
> always not happy about it.  Anway, I found this old discussion,
> https://github.com/riscv/riscv-isa-manual/issues/603.  So...
>
> Hey Andrew,
>
> Seems that this patch is trying to do the things that the above link
> mentioned - allow the unaffected rm field of fp widening conversion
> instructions.  Is this still valid now?  If that is so, then not only
> instructions in this patch need to be fixed.
>
>
> Using a nonzero rm field is definitely legal at the ISA level.
>
> I don't have a strong opinion on this one.  It's benign to allow
> these, but they're only useful for DV, not application software.  If
> that is (or isn't) deemed to be a good enough reason, fine by me, but
> we should stay philosophically consistent going forward.
>
>
> Thanks
> Nelson
>
>
>
  

Patch

diff --git a/gas/testsuite/gas/riscv/fp-zfh-insns.d b/gas/testsuite/gas/riscv/fp-zfh-insns.d
index 054e628ef66..476b40367fb 100644
--- a/gas/testsuite/gas/riscv/fp-zfh-insns.d
+++ b/gas/testsuite/gas/riscv/fp-zfh-insns.d
@@ -67,8 +67,11 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+e4058553[ 	]+fmv.x.h[ 	]+a0,fa1
 [ 	]+[0-9a-f]+:[ 	]+f4058553[ 	]+fmv.h.x[ 	]+fa0,a1
 [ 	]+[0-9a-f]+:[ 	]+40258553[ 	]+fcvt.s.h[ 	]+fa0,fa1
+[ 	]+[0-9a-f]+:[ 	]+4025f553[ 	]+fcvt.s.h[ 	]+fa0,fa1,dyn
 [ 	]+[0-9a-f]+:[ 	]+42258553[ 	]+fcvt.d.h[ 	]+fa0,fa1
+[ 	]+[0-9a-f]+:[ 	]+4225f553[ 	]+fcvt.d.h[ 	]+fa0,fa1,dyn
 [ 	]+[0-9a-f]+:[ 	]+46258553[ 	]+fcvt.q.h[ 	]+fa0,fa1
+[ 	]+[0-9a-f]+:[ 	]+4625f553[ 	]+fcvt.q.h[ 	]+fa0,fa1,dyn
 [ 	]+[0-9a-f]+:[ 	]+4405f553[ 	]+fcvt.h.s[ 	]+fa0,fa1
 [ 	]+[0-9a-f]+:[ 	]+44058553[ 	]+fcvt.h.s[ 	]+fa0,fa1,rne
 [ 	]+[0-9a-f]+:[ 	]+4415f553[ 	]+fcvt.h.d[ 	]+fa0,fa1
diff --git a/gas/testsuite/gas/riscv/fp-zfh-insns.s b/gas/testsuite/gas/riscv/fp-zfh-insns.s
index 3619e72d252..14710bcf63d 100644
--- a/gas/testsuite/gas/riscv/fp-zfh-insns.s
+++ b/gas/testsuite/gas/riscv/fp-zfh-insns.s
@@ -53,8 +53,11 @@ 
 	fmv.h.x		fa0, a1
 
 	fcvt.s.h	fa0, fa1
+	fcvt.s.h	fa0, fa1, dyn
 	fcvt.d.h	fa0, fa1
+	fcvt.d.h	fa0, fa1, dyn
 	fcvt.q.h	fa0, fa1
+	fcvt.q.h	fa0, fa1, dyn
 	fcvt.h.s	fa0, fa1
 	fcvt.h.s	fa0, fa1, rne
 	fcvt.h.d	fa0, fa1
diff --git a/gas/testsuite/gas/riscv/zdinx.d b/gas/testsuite/gas/riscv/zdinx.d
index 18d3fa3c41c..81f4d700ed0 100644
--- a/gas/testsuite/gas/riscv/zdinx.d
+++ b/gas/testsuite/gas/riscv/zdinx.d
@@ -35,7 +35,9 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+c235f553[ 	]+fcvt.lu.d[ 	]+a0,a1
 [ 	]+[0-9a-f]+:[ 	]+c2358553[ 	]+fcvt.lu.d[ 	]+a0,a1,rne
 [ 	]+[0-9a-f]+:[ 	]+d2058553[ 	]+fcvt.d.w[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+d205f553[ 	]+fcvt.d.w[ 	]+a0,a1,dyn
 [ 	]+[0-9a-f]+:[ 	]+d2158553[ 	]+fcvt.d.wu[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+d215f553[ 	]+fcvt.d.wu[ 	]+a0,a1,dyn
 [ 	]+[0-9a-f]+:[ 	]+d225f553[ 	]+fcvt.d.l[ 	]+a0,a1
 [ 	]+[0-9a-f]+:[ 	]+d2258553[ 	]+fcvt.d.l[ 	]+a0,a1,rne
 [ 	]+[0-9a-f]+:[ 	]+d235f553[ 	]+fcvt.d.lu[ 	]+a0,a1
diff --git a/gas/testsuite/gas/riscv/zdinx.s b/gas/testsuite/gas/riscv/zdinx.s
index 3cff27e1458..c22db36f697 100644
--- a/gas/testsuite/gas/riscv/zdinx.s
+++ b/gas/testsuite/gas/riscv/zdinx.s
@@ -29,7 +29,9 @@  target:
 	fcvt.lu.d	a0, a1
 	fcvt.lu.d	a0, a1, rne
 	fcvt.d.w	a0, a1
+	fcvt.d.w	a0, a1, dyn
 	fcvt.d.wu	a0, a1
+	fcvt.d.wu	a0, a1, dyn
 	fcvt.d.l	a0, a1
 	fcvt.d.l	a0, a1, rne
 	fcvt.d.lu	a0, a1
diff --git a/gas/testsuite/gas/riscv/zfbfmin.d b/gas/testsuite/gas/riscv/zfbfmin.d
index 7cacc0bd684..88156909dc8 100644
--- a/gas/testsuite/gas/riscv/zfbfmin.d
+++ b/gas/testsuite/gas/riscv/zfbfmin.d
@@ -9,3 +9,4 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+4485f553[ 	]+fcvt.bf16.s[ 	]+fa0,fa1
 [ 	]+[0-9a-f]+:[ 	]+44858553[ 	]+fcvt.bf16.s[ 	]+fa0,fa1,rne
 [ 	]+[0-9a-f]+:[ 	]+40658553[ 	]+fcvt.s.bf16[ 	]+fa0,fa1
+[ 	]+[0-9a-f]+:[ 	]+4065f553[ 	]+fcvt.s.bf16[ 	]+fa0,fa1,dyn
diff --git a/gas/testsuite/gas/riscv/zfbfmin.s b/gas/testsuite/gas/riscv/zfbfmin.s
index c9a9af3e394..a586efd58f4 100644
--- a/gas/testsuite/gas/riscv/zfbfmin.s
+++ b/gas/testsuite/gas/riscv/zfbfmin.s
@@ -4,3 +4,4 @@  target:
 	fcvt.bf16.s	fa0, fa1, rne
 	# fcvt.s.bf16
 	fcvt.s.bf16	fa0, fa1
+	fcvt.s.bf16	fa0, fa1, dyn
diff --git a/gas/testsuite/gas/riscv/zqinx.d b/gas/testsuite/gas/riscv/zqinx.d
index 28142654ca1..a2520684ba5 100644
--- a/gas/testsuite/gas/riscv/zqinx.d
+++ b/gas/testsuite/gas/riscv/zqinx.d
@@ -35,11 +35,17 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+c6367553[ 	]+fcvt.lu.q[ 	]+a0,a2
 [ 	]+[0-9a-f]+:[ 	]+c6360553[ 	]+fcvt.lu.q[ 	]+a0,a2,rne
 [ 	]+[0-9a-f]+:[ 	]+d6060553[ 	]+fcvt.q.w[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+d6067553[ 	]+fcvt.q.w[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+d6160553[ 	]+fcvt.q.wu[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+d6167553[ 	]+fcvt.q.wu[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+d6260553[ 	]+fcvt.q.l[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+d6267553[ 	]+fcvt.q.l[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+d6360553[ 	]+fcvt.q.lu[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+d6367553[ 	]+fcvt.q.lu[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+46060553[ 	]+fcvt.q.s[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+46067553[ 	]+fcvt.q.s[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+46160553[ 	]+fcvt.q.d[ 	]+a0,a2
+[ 	]+[0-9a-f]+:[ 	]+46167553[ 	]+fcvt.q.d[ 	]+a0,a2,dyn
 [ 	]+[0-9a-f]+:[ 	]+40367553[ 	]+fcvt.s.q[ 	]+a0,a2
 [ 	]+[0-9a-f]+:[ 	]+40360553[ 	]+fcvt.s.q[ 	]+a0,a2,rne
 [ 	]+[0-9a-f]+:[ 	]+42367553[ 	]+fcvt.d.q[ 	]+a0,a2
diff --git a/gas/testsuite/gas/riscv/zqinx.s b/gas/testsuite/gas/riscv/zqinx.s
index 84d045feb4d..d1070eb621a 100644
--- a/gas/testsuite/gas/riscv/zqinx.s
+++ b/gas/testsuite/gas/riscv/zqinx.s
@@ -29,12 +29,18 @@  target:
 	fcvt.lu.q	a0, a2
 	fcvt.lu.q	a0, a2, rne
 	fcvt.q.w	a0, a2
+	fcvt.q.w	a0, a2, dyn
 	fcvt.q.wu	a0, a2
+	fcvt.q.wu	a0, a2, dyn
 	fcvt.q.l	a0, a2
+	fcvt.q.l	a0, a2, dyn
 	fcvt.q.lu	a0, a2
+	fcvt.q.lu	a0, a2, dyn
 
 	fcvt.q.s	a0, a2
+	fcvt.q.s	a0, a2, dyn
 	fcvt.q.d	a0, a2
+	fcvt.q.d	a0, a2, dyn
 	fcvt.s.q	a0, a2
 	fcvt.s.q	a0, a2, rne
 	fcvt.d.q	a0, a2
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
index 8d5c574da6e..8ff65a1bd42 100644
--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -847,8 +847,11 @@  const struct riscv_opcode riscv_opcodes[] =
 {"fcvt.h.wu",  0, INSN_CLASS_ZFH_INX,   "D,s",       MATCH_FCVT_H_WU|MASK_RM, MASK_FCVT_H_WU|MASK_RM, match_opcode, 0 },
 {"fcvt.h.wu",  0, INSN_CLASS_ZFH_INX,   "D,s,m",     MATCH_FCVT_H_WU, MASK_FCVT_H_WU, match_opcode, 0 },
 {"fcvt.s.h",   0, INSN_CLASS_ZFHMIN_INX, "D,S",     MATCH_FCVT_S_H, MASK_FCVT_S_H|MASK_RM, match_opcode, 0 },
+{"fcvt.s.h",   0, INSN_CLASS_ZFHMIN_INX, "D,S,m",    MATCH_FCVT_S_H, MASK_FCVT_S_H, match_opcode, 0 },
 {"fcvt.d.h",   0, INSN_CLASS_ZFHMIN_AND_D_INX,     "D,S",       MATCH_FCVT_D_H, MASK_FCVT_D_H|MASK_RM, match_opcode, 0 },
+{"fcvt.d.h",   0, INSN_CLASS_ZFHMIN_AND_D_INX,     "D,S,m",     MATCH_FCVT_D_H, MASK_FCVT_D_H, match_opcode, 0 },
 {"fcvt.q.h",   0, INSN_CLASS_ZFHMIN_AND_Q_INX,     "D,S",       MATCH_FCVT_Q_H, MASK_FCVT_Q_H|MASK_RM, match_opcode, 0 },
+{"fcvt.q.h",   0, INSN_CLASS_ZFHMIN_AND_Q_INX,     "D,S,m",     MATCH_FCVT_Q_H, MASK_FCVT_Q_H, match_opcode, 0 },
 {"fcvt.h.s",   0, INSN_CLASS_ZFHMIN_INX, "D,S",     MATCH_FCVT_H_S|MASK_RM, MASK_FCVT_H_S|MASK_RM, match_opcode, 0 },
 {"fcvt.h.s",   0, INSN_CLASS_ZFHMIN_INX, "D,S,m",   MATCH_FCVT_H_S, MASK_FCVT_H_S, match_opcode, 0 },
 {"fcvt.h.d",   0, INSN_CLASS_ZFHMIN_AND_D_INX,     "D,S",       MATCH_FCVT_H_D|MASK_RM, MASK_FCVT_H_D|MASK_RM, match_opcode, 0 },
@@ -874,6 +877,7 @@  const struct riscv_opcode riscv_opcodes[] =
 {"fcvt.bf16.s", 0, INSN_CLASS_ZFBFMIN, "D,S",   MATCH_FCVT_BF16_S|MASK_RM, MASK_FCVT_BF16_S|MASK_RM, match_opcode, 0 },
 {"fcvt.bf16.s", 0, INSN_CLASS_ZFBFMIN, "D,S,m", MATCH_FCVT_BF16_S, MASK_FCVT_BF16_S, match_opcode, 0 },
 {"fcvt.s.bf16", 0, INSN_CLASS_ZFBFMIN, "D,S",   MATCH_FCVT_S_BF16, MASK_FCVT_S_BF16|MASK_RM, match_opcode, 0 },
+{"fcvt.s.bf16", 0, INSN_CLASS_ZFBFMIN, "D,S,m", MATCH_FCVT_S_BF16, MASK_FCVT_S_BF16, match_opcode, 0 },
 
 /* Single-precision floating-point instruction subset.  */
 {"frcsr",      0, INSN_CLASS_F_INX,   "d",         MATCH_FRCSR, MASK_FRCSR, match_opcode, INSN_ALIAS },
@@ -993,8 +997,11 @@  const struct riscv_opcode riscv_opcodes[] =
 {"fcvt.wu.d",  0, INSN_CLASS_D_INX,   "d,S",       MATCH_FCVT_WU_D|MASK_RM, MASK_FCVT_WU_D|MASK_RM, match_opcode, 0 },
 {"fcvt.wu.d",  0, INSN_CLASS_D_INX,   "d,S,m",     MATCH_FCVT_WU_D, MASK_FCVT_WU_D, match_opcode, 0 },
 {"fcvt.d.w",   0, INSN_CLASS_D_INX,   "D,s",       MATCH_FCVT_D_W, MASK_FCVT_D_W|MASK_RM, match_opcode, 0 },
+{"fcvt.d.w",   0, INSN_CLASS_D_INX,   "D,s,m",     MATCH_FCVT_D_W, MASK_FCVT_D_W, match_opcode, 0 },
 {"fcvt.d.wu",  0, INSN_CLASS_D_INX,   "D,s",       MATCH_FCVT_D_WU, MASK_FCVT_D_WU|MASK_RM, match_opcode, 0 },
+{"fcvt.d.wu",  0, INSN_CLASS_D_INX,   "D,s,m",     MATCH_FCVT_D_WU, MASK_FCVT_D_WU, match_opcode, 0 },
 {"fcvt.d.s",   0, INSN_CLASS_D_INX,   "D,S",       MATCH_FCVT_D_S, MASK_FCVT_D_S|MASK_RM, match_opcode, 0 },
+{"fcvt.d.s",   0, INSN_CLASS_D_INX,   "D,S,m",     MATCH_FCVT_D_S, MASK_FCVT_D_S, match_opcode, 0 },
 {"fcvt.s.d",   0, INSN_CLASS_D_INX,   "D,S",       MATCH_FCVT_S_D|MASK_RM, MASK_FCVT_S_D|MASK_RM, match_opcode, 0 },
 {"fcvt.s.d",   0, INSN_CLASS_D_INX,   "D,S,m",     MATCH_FCVT_S_D, MASK_FCVT_S_D, match_opcode, 0 },
 {"fclass.d",   0, INSN_CLASS_D_INX,   "d,S",       MATCH_FCLASS_D, MASK_FCLASS_D, match_opcode, 0 },
@@ -1050,9 +1057,13 @@  const struct riscv_opcode riscv_opcodes[] =
 {"fcvt.wu.q",  0, INSN_CLASS_Q_INX,   "d,S",       MATCH_FCVT_WU_Q|MASK_RM, MASK_FCVT_WU_Q|MASK_RM, match_opcode, 0 },
 {"fcvt.wu.q",  0, INSN_CLASS_Q_INX,   "d,S,m",     MATCH_FCVT_WU_Q, MASK_FCVT_WU_Q, match_opcode, 0 },
 {"fcvt.q.w",   0, INSN_CLASS_Q_INX,   "D,s",       MATCH_FCVT_Q_W, MASK_FCVT_Q_W|MASK_RM, match_opcode, 0 },
+{"fcvt.q.w",   0, INSN_CLASS_Q_INX,   "D,s,m",     MATCH_FCVT_Q_W, MASK_FCVT_Q_W, match_opcode, 0 },
 {"fcvt.q.wu",  0, INSN_CLASS_Q_INX,   "D,s",       MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU|MASK_RM, match_opcode, 0 },
+{"fcvt.q.wu",  0, INSN_CLASS_Q_INX,   "D,s,m",     MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU, match_opcode, 0 },
 {"fcvt.q.s",   0, INSN_CLASS_Q_INX,   "D,S",       MATCH_FCVT_Q_S, MASK_FCVT_Q_S|MASK_RM, match_opcode, 0 },
+{"fcvt.q.s",   0, INSN_CLASS_Q_INX,   "D,S,m",     MATCH_FCVT_Q_S, MASK_FCVT_Q_S, match_opcode, 0 },
 {"fcvt.q.d",   0, INSN_CLASS_Q_INX,   "D,S",       MATCH_FCVT_Q_D, MASK_FCVT_Q_D|MASK_RM, match_opcode, 0 },
+{"fcvt.q.d",   0, INSN_CLASS_Q_INX,   "D,S,m",     MATCH_FCVT_Q_D, MASK_FCVT_Q_D, match_opcode, 0 },
 {"fcvt.s.q",   0, INSN_CLASS_Q_INX,   "D,S",       MATCH_FCVT_S_Q|MASK_RM, MASK_FCVT_S_Q|MASK_RM, match_opcode, 0 },
 {"fcvt.s.q",   0, INSN_CLASS_Q_INX,   "D,S,m",     MATCH_FCVT_S_Q, MASK_FCVT_S_Q, match_opcode, 0 },
 {"fcvt.d.q",   0, INSN_CLASS_Q_INX,   "D,S",       MATCH_FCVT_D_Q|MASK_RM, MASK_FCVT_D_Q|MASK_RM, match_opcode, 0 },