RISC-V: Added Zfhmin and Zhinxmin.
authorTsukasa OI <research_trasio@irq.a4lg.com>
Mon, 27 Jun 2022 02:03:43 +0000 (11:03 +0900)
committerNelson Chu <nelson.chu@sifive.com>
Thu, 7 Jul 2022 08:23:54 +0000 (16:23 +0800)
commit045f385d9a1ee7269d3fa50657c4c7d1d7ba6c0f
tree4f6fa706342e870026e593973e25edffc0a459cd
parent1bb1f55d648e9c32bbead00afc95761646a6d050
RISC-V: Added Zfhmin and Zhinxmin.

This commit adds Zfhmin and Zhinxmin extensions (subsets of Zfh and
Zhinx extensions, respectively).  In the process supporting Zfhmin and
Zhinxmin extension, this commit also changes how instructions are
categorized considering Zfhmin, Zhinx and Zhinxmin extensions.

Detailed changes,

* From INSN_CLASS_ZFH to INSN_CLASS_ZFHMIN:

flh, fsh, fmv.x.h and fmv.h.x.

* From INSN_CLASS_ZFH to INSN_CLASS_ZFH_OR_ZHINX:

fmv.h.

* From INSN_CLASS_ZFH_OR_ZHINX to INSN_CLASS_ZFH_OR_ZHINX:

fneg.h, fabs.h, fsgnj.h, fsgnjn.h, fsgnjx.h,
fadd.h, fsub.h, fmul.h, fdiv.h, fsqrt.h, fmin.h, fmax.h,
fmadd.h, fnmadd.h, fmsub.h, fnmsub.h,
fcvt.w.h, fcvt.wu.h, fcvt.h.w, fcvt.h.wu,
fcvt.l.h, fcvt.lu.h, fcvt.h.l, fcvt.h.lu,
feq.h, flt.h, fle.h, fgt.h, fge.h,
fclass.h.

* From INSN_CLASS_ZFH_OR_ZHINX to INSN_CLASS_ZFHMIN_OR_ZHINXMIN:

fcvt.s.h and fcvt.h.s.

* From INSN_CLASS_D_AND_ZFH_INX to INSN_CLASS_ZFHMIN_AND_D:

fcvt.d.h and fcvt.h.d.

* From INSN_CLASS_Q_AND_ZFH_INX to INSN_CLASS_ZFHMIN_AND_Q:

fcvt.q.h and fcvt.h.q.

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): Change implicit
subsets.  Zfh->Zicsr is not needed and Zfh->F is replaced with
Zfh->Zfhmin and Zfhmin->F.  Zhinx->Zicsr is not needed and
Zhinx->Zfinx is replaced with Zhinx->Zhinxmin and
Zhinxmin->Zfinx.
(riscv_supported_std_z_ext): Added zfhmin and zhinxmin.
(riscv_multi_subset_supports):  Rewrite handling for new
instruction classes.
(riscv_multi_subset_supports_ext): Updated.
(riscv_parse_check_conflicts): Change error message to include
zfh and zfhmin extensions.

gas/ChangeLog:

* testsuite/gas/riscv/zfhmin-d-insn-class-fail.s: New complex
error handling test.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.d: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.l: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.d: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.l: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.d: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.l: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.d: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.l: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.d: Likewise.
* testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.l: Likewise.
* testsuite/gas/riscv/zhinx.d: Renamed from fp-zhinx-insns.d
and refactored.
* testsuite/gas/riscv/zhinx.s: Likewise.

include/ChangeLog:

* opcode/riscv.h (enum riscv_insn_class): Removed INSN_CLASS_ZFH,
INSN_CLASS_D_AND_ZFH_INX and INSN_CLASS_Q_AND_ZFH_INX.  Added
INSN_CLASS_ZFHMIN, INSN_CLASS_ZFHMIN_OR_ZHINXMIN,
INSN_CLASS_ZFHMIN_AND_D and INSN_CLASS_ZFHMIN_AND_Q.

opcodes/ChangeLog:

* riscv-opc.c (riscv_opcodes): Change instruction classes for
Zfh and Zfhmin instructions.  Fix `fcvt.h.lu' instruction
(two operand variant) mask.
18 files changed:
bfd/elfxx-riscv.c
gas/testsuite/gas/riscv/fp-zhinx-insns.d [deleted file]
gas/testsuite/gas/riscv/fp-zhinx-insns.s [deleted file]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.l [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.l [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.l [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.l [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.l [new file with mode: 0644]
gas/testsuite/gas/riscv/zfhmin-d-insn-class-fail.s [new file with mode: 0644]
gas/testsuite/gas/riscv/zhinx.d [new file with mode: 0644]
gas/testsuite/gas/riscv/zhinx.s [new file with mode: 0644]
include/opcode/riscv.h
opcodes/riscv-opc.c