RISC-V: Control fence.i and csr instructions by zifencei and zicsr.
authorNelson Chu <nelson.chu@sifive.com>
Wed, 2 Dec 2020 09:18:35 +0000 (17:18 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Thu, 10 Dec 2020 02:37:43 +0000 (10:37 +0800)
commit729a53530e86972d1143553a415db34e6e01d5d2
treee8a27c9d6d7f0cd468a089616450dca0ef0e7e4e
parentcd6b05c1b2321cafe3ad9335aaa734a28f2a058e
RISC-V: Control fence.i and csr instructions by zifencei and zicsr.

bfd/
    * elfxx-riscv.c (riscv_ext_dont_care_version): New function.  Return
    TRUE if we don't care the versions of the extensions.  These extensions
    are added to the subset list for special purposes, with the explicit
    versions or the RISCV_UNKNOWN_VERSION versions.
    (riscv_parse_add_subset): If we do care the versions of the extension,
    and the versions are unknown, then report errors for the non-implicit
    extensions, and return directly for the implicit one.
    (riscv_arch_str1): Do not output i extension after e, and the extensions
    which versions are unknown.
gas/
    * config/tc-riscv.c (riscv_multi_subset_supports): Handle INSN_CLASS_ZICSR
    and INSN_CLASS_ZIFENCEI.
    * testsuite/gas/riscv/march-imply-i.s: New testcase.
    * testsuite/gas/riscv/march-imply-i2p0-01.d: New testcase.  The version
    of i is less than 2.1, and zi* are supported in the chosen spec, so
    enable the fence.i and csr instructions, also output the implicit zi* to
    the arch string.
    * testsuite/gas/riscv/march-imply-i2p0-02.d: Likewise, but the zi* are
    not supported in the spec 2.2.  Enable the related instructions since
    i's version is less than 2.1, but do not output them.
    * testsuite/gas/riscv/march-imply-i2p1-01.d: New testcase.  The version
    of i is 2.1, so don't add it's implicit zi*, and disable the related
    instructions.
    * testsuite/gas/riscv/march-imply-i2p1-01.l: Likewise.
    * testsuite/gas/riscv/march-imply-i2p1-02.d: Likewise, and set the zi*
    explicitly, so enable the related instructions.
    * testsuite/gas/riscv/march-imply-i2p0.d: Removed.
    * testsuite/gas/riscv/march-imply-i2p1.d: Removed.
include/
    * opcode/riscv.h: Add INSN_CLASS_ZICSR and INSN_CLASS_ZIFENCEI.
opcodes/
    * riscv-opc.c (riscv_opcodes): Control fence.i and csr instructions by
    zifencei and zicsr.
16 files changed:
bfd/ChangeLog
bfd/elfxx-riscv.c
gas/ChangeLog
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/march-imply-i.s [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p0-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p0-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p0.d [deleted file]
gas/testsuite/gas/riscv/march-imply-i2p1-01.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p1-01.l [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p1-02.d [new file with mode: 0644]
gas/testsuite/gas/riscv/march-imply-i2p1.d [deleted file]
include/ChangeLog
include/opcode/riscv.h
opcodes/ChangeLog
opcodes/riscv-opc.c