From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1386) id 47C433882670; Fri, 26 May 2023 07:42:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47C433882670 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jan Beulich To: bfd-cvs@sourceware.org Subject: [binutils-gdb] x86: figure braces aren't really part of mnemonics X-Act-Checkin: binutils-gdb X-Git-Author: Jan Beulich X-Git-Refname: refs/heads/master X-Git-Oldrev: d2b1a14de3214084892a6ec902301d8fda8885cf X-Git-Newrev: 778415f5975f5acb7c7527770c07f5ec55145385 Message-Id: <20230526074218.47C433882670@sourceware.org> Date: Fri, 26 May 2023 07:42:18 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 May 2023 07:42:18 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D778415f5975f= 5acb7c7527770c07f5ec55145385 commit 778415f5975f5acb7c7527770c07f5ec55145385 Author: Jan Beulich Date: Fri May 26 09:42:03 2023 +0200 x86: figure braces aren't really part of mnemonics =20 Instead they're separators for pseudo-prefixes. Don't insert them in mnemonic_chars[], handling them explicitly in parse_insn() instead. Note that this eliminates the need for another separator after a pseudo- prefix. While maybe not overly interesting for a following real mnemonic, I view this as quite desirable between multiple successive pseudo-prefixes (bringing things in line with the other use of figure braces in AVX512's zeroing-masking). =20 Drop the unused is_mnemonic_char() at this occasion. Diff: --- gas/config/tc-i386.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 613a15082d7..74b2d252381 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -541,7 +541,6 @@ static char register_chars[256]; static char operand_chars[256]; =20 /* Lexical macros. */ -#define is_mnemonic_char(x) (mnemonic_chars[(unsigned char) x]) #define is_operand_char(x) (operand_chars[(unsigned char) x]) #define is_register_char(x) (register_chars[(unsigned char) x]) #define is_space_char(x) ((x) =3D=3D ' ') @@ -3087,8 +3086,6 @@ md_begin (void) register_chars[c] =3D mnemonic_chars[c]; operand_chars[c] =3D c; } - else if (c =3D=3D '{' || c =3D=3D '}') - mnemonic_chars[c] =3D c; #ifdef SVR4_COMMENT_CHARS else if (c =3D=3D '\\' && strchr (i386_comment_chars, '/')) operand_chars[c] =3D c; @@ -5478,6 +5475,12 @@ parse_insn (const char *line, char *mnemonic, bool p= refix_only) while (1) { mnem_p =3D mnemonic; + /* Pseudo-prefixes start with an opening figure brace. */ + if ((*mnem_p =3D *l) =3D=3D '{') + { + ++mnem_p; + ++l; + } while ((*mnem_p =3D mnemonic_chars[(unsigned char) *l]) !=3D 0) { if (*mnem_p =3D=3D '.') @@ -5485,16 +5488,29 @@ parse_insn (const char *line, char *mnemonic, bool = prefix_only) mnem_p++; if (mnem_p >=3D mnemonic + MAX_MNEM_SIZE) { + too_long: as_bad (_("no such instruction: `%s'"), token_start); return NULL; } l++; } - if (!is_space_char (*l) - && *l !=3D END_OF_INSN - && (intel_syntax - || (*l !=3D PREFIX_SEPARATOR - && *l !=3D ','))) + /* Pseudo-prefixes end with a closing figure brace. */ + if (*mnemonic =3D=3D '{' && *l =3D=3D '}') + { + *mnem_p++ =3D *l++; + if (mnem_p >=3D mnemonic + MAX_MNEM_SIZE) + goto too_long; + *mnem_p =3D '\0'; + + /* Point l at the closing brace if there's no other separator. */ + if (*l !=3D END_OF_INSN && !is_space_char (*l) + && *l !=3D PREFIX_SEPARATOR) + --l; + } + else if (!is_space_char (*l) + && *l !=3D END_OF_INSN + && (intel_syntax + || (*l !=3D PREFIX_SEPARATOR && *l !=3D ','))) { if (prefix_only) break;