diff options
author | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-06-27 11:03:43 +0900 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2022-07-07 16:23:54 +0800 |
commit | 045f385d9a1ee7269d3fa50657c4c7d1d7ba6c0f (patch) | |
tree | 4f6fa706342e870026e593973e25edffc0a459cd /bfd | |
parent | 1bb1f55d648e9c32bbead00afc95761646a6d050 (diff) | |
download | gdb-045f385d9a1ee7269d3fa50657c4c7d1d7ba6c0f.zip gdb-045f385d9a1ee7269d3fa50657c4c7d1d7ba6c0f.tar.gz gdb-045f385d9a1ee7269d3fa50657c4c7d1d7ba6c0f.tar.bz2 |
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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elfxx-riscv.c | 97 |
1 files changed, 52 insertions, 45 deletions
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 7d08254..0b2021f 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1099,14 +1099,14 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] = {"zvl128b", "zvl64b", check_implicit_always}, {"zvl64b", "zvl32b", check_implicit_always}, {"d", "f", check_implicit_always}, + {"zfh", "zfhmin", check_implicit_always}, + {"zfhmin", "f", check_implicit_always}, {"f", "zicsr", check_implicit_always}, - {"zfh", "f", check_implicit_always}, - {"zfh", "zicsr", check_implicit_always}, {"zqinx", "zdinx", check_implicit_always}, {"zdinx", "zfinx", check_implicit_always}, + {"zhinx", "zhinxmin", check_implicit_always}, + {"zhinxmin", "zfinx", check_implicit_always}, {"zfinx", "zicsr", check_implicit_always}, - {"zhinx", "zfinx", check_implicit_always}, - {"zhinx", "zicsr", check_implicit_always}, {"zk", "zkn", check_implicit_always}, {"zk", "zkr", check_implicit_always}, {"zk", "zkt", check_implicit_always}, @@ -1187,10 +1187,12 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] = {"zifencei", ISA_SPEC_CLASS_20190608, 2, 0, 0 }, {"zihintpause", ISA_SPEC_CLASS_DRAFT, 2, 0, 0 }, {"zfh", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"zfhmin", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zfinx", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zdinx", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zqinx", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zhinx", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"zhinxmin", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zbb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zba", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zbc", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, @@ -1878,7 +1880,7 @@ riscv_parse_check_conflicts (riscv_parse_subset_t *rps) && riscv_lookup_subset (rps->subset_list, "f", &subset)) { rps->error_handler - (_("`zfinx' is conflict with the `f/d/q' extension")); + (_("`zfinx' is conflict with the `f/d/q/zfh/zfhmin' extension")); no_conflict = false; } @@ -2336,21 +2338,24 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps, case INSN_CLASS_Q_OR_ZQINX: return (riscv_subset_supports (rps, "q") || riscv_subset_supports (rps, "zqinx")); - case INSN_CLASS_ZFH: - return riscv_subset_supports (rps, "zfh"); case INSN_CLASS_ZFH_OR_ZHINX: - return riscv_subset_supports (rps, "zfh") - || riscv_subset_supports (rps, "zhinx"); - case INSN_CLASS_D_AND_ZFH_INX: - return (riscv_subset_supports (rps, "d") - && riscv_subset_supports (rps, "zfh")) - || (riscv_subset_supports (rps, "zdinx") - && riscv_subset_supports (rps, "zhinx")); - case INSN_CLASS_Q_AND_ZFH_INX: - return (riscv_subset_supports (rps, "q") - && riscv_subset_supports (rps, "zfh")) - || (riscv_subset_supports (rps, "zqinx") - && riscv_subset_supports (rps, "zhinx")); + return (riscv_subset_supports (rps, "zfh") + || riscv_subset_supports (rps, "zhinx")); + case INSN_CLASS_ZFHMIN: + return riscv_subset_supports (rps, "zfhmin"); + case INSN_CLASS_ZFHMIN_OR_ZHINXMIN: + return (riscv_subset_supports (rps, "zfhmin") + || riscv_subset_supports (rps, "zhinxmin")); + case INSN_CLASS_ZFHMIN_AND_D: + return ((riscv_subset_supports (rps, "zfhmin") + && riscv_subset_supports (rps, "d")) + || (riscv_subset_supports (rps, "zhinxmin") + && riscv_subset_supports (rps, "zdinx"))); + case INSN_CLASS_ZFHMIN_AND_Q: + return ((riscv_subset_supports (rps, "zfhmin") + && riscv_subset_supports (rps, "q")) + || (riscv_subset_supports (rps, "zhinxmin") + && riscv_subset_supports (rps, "zqinx"))); case INSN_CLASS_ZBA: return riscv_subset_supports (rps, "zba"); case INSN_CLASS_ZBB: @@ -2456,6 +2461,34 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps, return _("d' or `zdinx"); case INSN_CLASS_Q_OR_ZQINX: return _("q' or `zqinx"); + case INSN_CLASS_ZFH_OR_ZHINX: + return _("zfh' or `zhinx"); + case INSN_CLASS_ZFHMIN: + return "zfhmin"; + case INSN_CLASS_ZFHMIN_OR_ZHINXMIN: + return _("zfhmin' or `zhinxmin"); + case INSN_CLASS_ZFHMIN_AND_D: + if (riscv_subset_supports (rps, "zfhmin")) + return "d"; + else if (riscv_subset_supports (rps, "d")) + return "zfhmin"; + else if (riscv_subset_supports (rps, "zhinxmin")) + return "zdinx"; + else if (riscv_subset_supports (rps, "zdinx")) + return "zhinxmin"; + else + return _("zfhmin' and `d', or `zhinxmin' and `zdinx"); + case INSN_CLASS_ZFHMIN_AND_Q: + if (riscv_subset_supports (rps, "zfhmin")) + return "q"; + else if (riscv_subset_supports (rps, "q")) + return "zfhmin"; + else if (riscv_subset_supports (rps, "zhinxmin")) + return "zqinx"; + else if (riscv_subset_supports (rps, "zqinx")) + return "zhinxmin"; + else + return _("zfhmin' and `q', or `zhinxmin' and `zqinx"); case INSN_CLASS_ZBA: return "zba"; case INSN_CLASS_ZBB: @@ -2492,32 +2525,6 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps, return _("v' or `zve64d' or `zve64f' or `zve32f"); case INSN_CLASS_SVINVAL: return "svinval"; - case INSN_CLASS_ZFH: - return "zfh"; - case INSN_CLASS_ZFH_OR_ZHINX: - return _("zfh' or 'zhinx"); - case INSN_CLASS_D_AND_ZFH_INX: - if (riscv_subset_supports (rps, "zfh")) - return "d"; - else if (riscv_subset_supports (rps, "d")) - return "zfh"; - else if (riscv_subset_supports (rps, "zhinx")) - return "zdinx"; - else if (riscv_subset_supports (rps, "zdinx")) - return "zhinx"; - else - return _("zfh' and `d', or `zhinx' and `zdinx"); - case INSN_CLASS_Q_AND_ZFH_INX: - if (riscv_subset_supports (rps, "zfh")) - return "q"; - else if (riscv_subset_supports (rps, "q")) - return "zfh"; - else if (riscv_subset_supports (rps, "zhinx")) - return "zqinx"; - else if (riscv_subset_supports (rps, "zqinx")) - return "zhinx"; - else - return _("zfh' and `q', or `zhinx' and `zqinx"); case INSN_CLASS_H: return _("h"); default: |