diff options
author | Mo, Zewei <zewei.mo@intel.com> | 2023-12-28 01:06:40 +0000 |
---|---|---|
committer | Cui, Lili <lili.cui@intel.com> | 2023-12-28 11:41:45 +0000 |
commit | 08a98d4c1331cc726c8c76c14d9db34d6f0aadd6 (patch) | |
tree | d9d3b9fb83d173f0cdc20ec55063ed582145cdd2 /gas/config | |
parent | 3083f376435662c747ab946bb84e6e6698985610 (diff) | |
download | gdb-08a98d4c1331cc726c8c76c14d9db34d6f0aadd6.zip gdb-08a98d4c1331cc726c8c76c14d9db34d6f0aadd6.tar.gz gdb-08a98d4c1331cc726c8c76c14d9db34d6f0aadd6.tar.bz2 |
Support APX Push2/Pop2
PPX functionality for PUSH/POP is not implemented in this patch
and will be implemented separately.
gas/ChangeLog:
2023-12-28 Zewei Mo <zewei.mo@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
Lili Cui <lili.cui@intel.com>
* config/tc-i386.c: (enum i386_error):
New unsupported_rsp_register and invalid_src_register_set.
(md_assemble): Add handler for unsupported_rsp_register and
invalid_src_register_set.
(check_APX_operands): Add invalid check for push2/pop2.
(match_template): Handle check_APX_operands.
* testsuite/gas/i386/i386.exp: Add apx-push2pop2 tests.
* testsuite/gas/i386/x86-64.exp: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2.d: New test.
* testsuite/gas/i386/x86-64-apx-push2pop2.s: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-intel.d: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-inval.l: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-inval.s: Ditto.
* testsuite/gas/i386/apx-push2pop2-inval.s: Ditto.
* testsuite/gas/i386/apx-push2pop2-inval.d: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Added bad
testcases for POP2.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Ditto.
opcodes/ChangeLog:
* i386-dis-evex-reg.h: Add REG_EVEX_MAP4_8F.
* i386-dis-evex-w.h: Add EVEX_W_MAP4_8F_R_0 and EVEX_W_MAP4_FF_R_6
* i386-dis-evex.h: Add REG_EVEX_MAP4_8F.
* i386-dis.c (PUSH2_POP2_Fixup): Add special handling for PUSH2/POP2.
(get_valid_dis386): Add handler for vector length and address_mode for
APX-Push2/Pop2 insn.
(nd): define nd as b for EVEX-promoted instrutions.
(OP_VEX): Add handler of 64-bit vvvv register for APX-Push2/Pop2 insn.
* i386-gen.c: Add Push2Pop2 bitfield.
* i386-opc.h: Regenerated.
* i386-opc.tbl: Regenerated.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index e828b3c..1aa887b 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -250,6 +250,7 @@ enum i386_error invalid_vector_register_set, invalid_tmm_register_set, invalid_dest_and_src_register_set, + invalid_dest_register_set, invalid_pseudo_prefix, unsupported_vector_index_register, unsupported_broadcast, @@ -259,6 +260,7 @@ enum i386_error no_default_mask, unsupported_rc_sae, unsupported_vector_size, + unsupported_rsp_register, internal_error, }; @@ -5511,6 +5513,9 @@ md_assemble (char *line) case invalid_dest_and_src_register_set: err_msg = _("destination and source registers must be distinct"); break; + case invalid_dest_register_set: + err_msg = _("two dest registers must be distinct"); + break; case invalid_pseudo_prefix: err_msg = _("rex2 pseudo prefix cannot be used"); break; @@ -5539,6 +5544,9 @@ md_assemble (char *line) as_bad (_("vector size above %u required for `%s'"), 128u << vector_size, pass1_mnem ? pass1_mnem : insn_name (current_templates.start)); return; + case unsupported_rsp_register: + err_msg = _("'rsp' register cannot be used"); + break; case internal_error: err_msg = _("internal error"); break; @@ -7175,6 +7183,35 @@ check_EgprOperands (const insn_template *t) return 0; } +/* Check if APX operands are valid for the instruction. */ +static bool +check_APX_operands (const insn_template *t) +{ + /* Push2* and Pop2* cannot use RSP and Pop2* cannot pop two same registers. + */ + switch (t->mnem_off) + { + case MN_pop2: + case MN_pop2p: + if (register_number (i.op[0].regs) == register_number (i.op[1].regs)) + { + i.error = invalid_dest_register_set; + return 1; + } + /* fall through */ + case MN_push2: + case MN_push2p: + if (register_number (i.op[0].regs) == 4 + || register_number (i.op[1].regs) == 4) + { + i.error = unsupported_rsp_register; + return 1; + } + break; + } + return 0; +} + /* Helper function for the progress() macro in match_template(). */ static INLINE enum i386_error progress (enum i386_error new, enum i386_error last, @@ -7675,6 +7712,13 @@ match_template (char mnem_suffix) continue; } + /* Check if APX operands are valid. */ + if (check_APX_operands (t)) + { + specific_error = progress (i.error); + continue; + } + /* Check whether to use the shorter VEX encoding for certain insns where the EVEX encoding comes first in the table. This requires the respective AVX-* feature to be explicitly enabled. |