回复:Re: 回复: Re: RISCV: Support Zilsd and Zcmlsd extensions.

孙东亚 sundongya@nucleisys.com
Thu Dec 19 09:55:07 GMT 2024


Thanks for your suggestions, and based on your advice, we have made the following adjustments to the code:
1. Fixed the error where the register operands of the Zclsd insn did not meet the even number constraint.
2. Instead of using the new operands Gd and Gt, we have created new functions such as match_rd_even​, match_rs2_even​, and match_crs2s_even​ to constrain the register operands, as suggested.
3. We've combined the insns from the same extension into groups to improve the efficiency of testcases .




bfd/ChangeLog:


        * elfxx-riscv.c (riscv_parse_check_conflicts):"zclsd" conflict with the “c+f'/ zcf”extension.
        (riscv_multi_subset_supports):Handle zilsd and zclsd.
        (riscv_multi_subset_supports_ext):Handle zilsd and zclsd.


gas/ChangeLog:


        * testsuite/gas/riscv/zclsd-fail.d: New test.
        * testsuite/gas/riscv/zclsd-fail.l: New test.
        * testsuite/gas/riscv/zclsd-fail.s: New test.
        * testsuite/gas/riscv/zclsd.d: New test.
        * testsuite/gas/riscv/zclsd.s: New test.
        * testsuite/gas/riscv/zilsd-fail.d: New test.
        * testsuite/gas/riscv/zilsd-fail.l: New test.
        * testsuite/gas/riscv/zilsd-fail.s: New test.
        * testsuite/gas/riscv/zilsd.d: New test.
        * testsuite/gas/riscv/zilsd.s: New test.


include/ChangeLog:


        * opcode/riscv.h (enum riscv_insn_class):Add INSN_CLASS_ZILSD and INSN_CLASS_ZCLSD.


opcodes/ChangeLog:


        * riscv-opc.c (MASK_CRS2S):Define the crs2s register operand mask.
        (match_rd_even):Constrain the rd register operand.
        (match_rs2_even):Constrain the rs2 register operand.
        (match_rd_even_nonzero):Constrain the rd register operand.
        (match_rs1_nonzero_rs2_even):Constrain the rs1 and rs2 register operand.
        (match_crs2s_even):Constrain the crs2s register operand.
        (match_crs2_even):Constrain the crs2 register operand.


---
 bfd/elfxx-riscv.c                    | 20 ++++++++++++++++++++
 gas/testsuite/gas/riscv/zclsd-fail.d |  3 +++
 gas/testsuite/gas/riscv/zclsd-fail.l | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gas/testsuite/gas/riscv/zclsd-fail.s | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gas/testsuite/gas/riscv/zclsd.d      | 27 +++++++++++++++++++++++++++
 gas/testsuite/gas/riscv/zclsd.s      | 18 ++++++++++++++++++
 gas/testsuite/gas/riscv/zilsd-fail.d |  3 +++
 gas/testsuite/gas/riscv/zilsd-fail.l | 22 ++++++++++++++++++++++
 gas/testsuite/gas/riscv/zilsd-fail.s | 22 ++++++++++++++++++++++
 gas/testsuite/gas/riscv/zilsd.d      | 20 ++++++++++++++++++++
 gas/testsuite/gas/riscv/zilsd.s      | 11 +++++++++++
 include/opcode/riscv.h               |  2 ++
 opcodes/riscv-opc.c                  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 306 insertions(+)




                    Jan Beulich<jbeulich@suse.com> 在 2024年11月27日 周三 16:06 写道:

On 27.11.2024 08:20, 孙东亚 wrote:
> Thanks for your advise and based on the provided suggestions, the following modifications have been made:
> 1.&nbsp;Renamed zcmlsd to zclsd according to upstream changes : https://github.com/riscv/riscv-zilsd.
> 
> 2.&nbsp;Re-adapted the patch on the master branch based on the latest version of binutils.
> 3.&nbsp;Modified the indentation of the patch to make it more standardized.
> 4.&nbsp;For all new instructions, a test case has been added.

Why is it that the Zilsd insns have their register operands properly constrained
to even numbers, but the Zclsd ones don't? You even appear to have wrong uses of
the insns in the supposedly-valid testcases.

I further wonder why you introduce new Gd and Gt operand forms, when Zacas handles
the quite similar situation for the pair AMOCAS forms differently, without
consuming another precious letter ('G'). Consistency in handling is an imo
worthwhile goal.

As to the splitting of testcases: Each test comes with some overhead. Therefore
I'd like to recommend that testcases for the different insns of the same
extension be combined, resulting in slightly better time and space efficiency.

Also please take care of the various "\ No newline at end of file" in the patch.

Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20241219/7e14b6d1/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zilsd-zclsd.patch
Type: application/octet-stream
Size: 17447 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20241219/7e14b6d1/attachment-0001.obj>


More information about the Binutils mailing list