From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>
Subject: [PATCH 4/4] x86: rework of match_template()'s suffix checking
Date: Wed, 30 Nov 2022 09:56:52 +0100 [thread overview]
Message-ID: <787c0eff-5b73-ed04-6e06-e3f49d5a3ce1@suse.com> (raw)
In-Reply-To: <b309d824-01de-72fd-6eaf-f82475acfc02@suse.com>
(Ab)using i386_opcode_modifier for this has been overkill, as the logic
doesn't really require the full structure. With the removal of
LONG_DOUBLE_MNEM_SUFFIX and No_ldSuf there's no good reason at all
anymore to pull out such a loop invariant: We're dealing a check of a
bit in the loop for a simple comparison. Do the original compares inside
the loop, thus also making it easier to understand what is actually
being checked.
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -6461,7 +6461,6 @@ match_template (char mnem_suffix)
i386_operand_type overlap0, overlap1, overlap2, overlap3;
i386_operand_type overlap4;
unsigned int found_reverse_match;
- i386_opcode_modifier suffix_check;
i386_operand_type operand_types [MAX_OPERANDS];
int addr_prefix_disp;
unsigned int j, size_match, check_register, errline = __LINE__;
@@ -6475,27 +6474,6 @@ match_template (char mnem_suffix)
found_reverse_match = 0;
addr_prefix_disp = -1;
- /* Prepare for mnemonic suffix check. */
- memset (&suffix_check, 0, sizeof (suffix_check));
- switch (mnem_suffix)
- {
- case BYTE_MNEM_SUFFIX:
- suffix_check.no_bsuf = 1;
- break;
- case WORD_MNEM_SUFFIX:
- suffix_check.no_wsuf = 1;
- break;
- case SHORT_MNEM_SUFFIX:
- suffix_check.no_ssuf = 1;
- break;
- case LONG_MNEM_SUFFIX:
- suffix_check.no_lsuf = 1;
- break;
- case QWORD_MNEM_SUFFIX:
- suffix_check.no_qsuf = 1;
- break;
- }
-
for (t = current_templates->start; t < current_templates->end; t++)
{
addr_prefix_disp = -1;
@@ -6543,11 +6521,11 @@ match_template (char mnem_suffix)
/* Check the suffix. */
specific_error = progress (invalid_instruction_suffix);
- if ((t->opcode_modifier.no_bsuf && suffix_check.no_bsuf)
- || (t->opcode_modifier.no_wsuf && suffix_check.no_wsuf)
- || (t->opcode_modifier.no_lsuf && suffix_check.no_lsuf)
- || (t->opcode_modifier.no_ssuf && suffix_check.no_ssuf)
- || (t->opcode_modifier.no_qsuf && suffix_check.no_qsuf))
+ if ((t->opcode_modifier.no_bsuf && mnem_suffix == BYTE_MNEM_SUFFIX)
+ || (t->opcode_modifier.no_wsuf && mnem_suffix == WORD_MNEM_SUFFIX)
+ || (t->opcode_modifier.no_lsuf && mnem_suffix == LONG_MNEM_SUFFIX)
+ || (t->opcode_modifier.no_ssuf && mnem_suffix == SHORT_MNEM_SUFFIX)
+ || (t->opcode_modifier.no_qsuf && mnem_suffix == QWORD_MNEM_SUFFIX))
continue;
specific_error = progress (operand_size_mismatch);
next prev parent reply other threads:[~2022-11-30 8:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 8:53 [PATCH 0/4] x86: get rid of LONG_DOUBLE_MNEM_SUFFIX and No_ldSuf Jan Beulich
2022-11-30 8:54 ` [PATCH 1/4] x86/Intel: restrict use of LONG_DOUBLE_MNEM_SUFFIX Jan Beulich
2022-11-30 8:55 ` [PATCH 2/4] x86/Intel: drop LONG_DOUBLE_MNEM_SUFFIX Jan Beulich
2022-11-30 8:55 ` [PATCH 3/4] x86: drop No_ldSuf Jan Beulich
2022-11-30 8:56 ` Jan Beulich [this message]
2022-11-30 22:25 ` [PATCH 0/4] x86: get rid of LONG_DOUBLE_MNEM_SUFFIX and No_ldSuf H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=787c0eff-5b73-ed04-6e06-e3f49d5a3ce1@suse.com \
--to=jbeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).