From patchwork Fri May 19 13:31:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 96422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1238410vqo; Fri, 19 May 2023 06:32:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dG0u0LXsH5M29OM8TuNPYsJU5nwHor7gHmnG6v/37Pu9igFNeCZ8t/aCRA6+ajfINk5r7 X-Received: by 2002:a05:6402:517:b0:50d:fba2:7265 with SMTP id m23-20020a056402051700b0050dfba27265mr1604255edv.16.1684503130280; Fri, 19 May 2023 06:32:10 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o23-20020a056402039700b0050bc9828c33si336242edv.136.2023.05.19.06.32.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 06:32:10 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kfaw03hk; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1149F3858401 for ; Fri, 19 May 2023 13:32:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1149F3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684503129; bh=ZRjm62ECAlCP89tQN6uK9eei6LuEi4vgCR7ypQbklVM=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=kfaw03hksmaB4cMqthkQeI08BtKjYN0av0lw27vtEc9B9+uphAVR19YjCauJdA5xK p84Ubipq2clbFk2SMMNbuPKu6FUNqiQaq3TU2eynIfnDkH0tABvFtADEzjNMkvZGXD VPVRdG5yPWEvA2+ucgM/aV6QlSxfXxZ2i5ucGaxc= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2043.outbound.protection.outlook.com [40.107.103.43]) by sourceware.org (Postfix) with ESMTPS id 9E3CD3858C30 for ; Fri, 19 May 2023 13:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E3CD3858C30 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HFexecwE+CapdJmRPlQg9bunHQSPacaHFlVb7V1oj6+m97r+6qk1erjLJ8EbouoLOH2KA4gKNaEqfo8KzPEBXKwCnqIkRrkPWq9aSAW6bw+4iSSf5cMlkavNlTdHKoniB7lbIiJIhQLZRz+bybvpP1Q234ldeav8BbubQ6l3lOS6Cg0hIDr0n1lPGj2+zEa14hB3CooygyvYk5Tn0sZIlIvnb+QK/Tcw9DS7LwlQQjFq3ieTuxIvyMxZcfz4h8ZaVOjqwNgSJLeOV979puKPQuH+T/Lmrmg9KhoEtvK6i8qXTtY+TOT0O9YEmx9R2etgGaSnu+qNNNnpsAMEMDV0lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZRjm62ECAlCP89tQN6uK9eei6LuEi4vgCR7ypQbklVM=; b=aNllPFl7usEquhkg8OO6T0jRfLQKPh1Wrpg3WCWA6TNVNqF+mZFU7xvRCmQKq624G6ZeOADjJ+Ige7slmlQRzr1FFOQTtdMlx9GyVPP7NIrYjGUzx4eJ+37716VQMNFyu63AC62tXN3/WNyO65ybMG5hWwlnOq02VToKHfLCuET5b3uYfaRC7+kJoihhgad7rMIZb7++oMRvQG4wYDOVWlJH0mE4GcvnGs0I9DmqF7P2XqETK/SFmk3pxbwSUpir1cV2Yq6RCH9GvJDXlpyBZtfj/sw5eL9lG/cI7k5Cj5i5y1WaiKQitZrcQB86ZE5luhePFY3hIm6ecftXMpTqWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM9PR04MB7601.eurprd04.prod.outlook.com (2603:10a6:20b:285::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 13:31:30 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::e442:306f:7711:e24c]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::e442:306f:7711:e24c%5]) with mapi id 15.20.6411.021; Fri, 19 May 2023 13:31:30 +0000 Message-ID: <83c328ec-3eab-767c-e65c-0d83183fd18a@suse.com> Date: Fri, 19 May 2023 15:31:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: [PATCH 2/2] x86: figure braces aren't really part of mnemonics Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR2P281CA0064.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:93::12) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM9PR04MB7601:EE_ X-MS-Office365-Filtering-Correlation-Id: 92099ee6-ad00-4a76-a574-08db586d5ad5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YBOwgd8qzfiNfDt+DoJZmfjtpVzdrbb7tilnNUbyb0naPFO9tTNpZy6B4lRGX7xlAdIMeY3O8yAcmUl7d9ifqgbOX3jpLKZR8MzaTgkkTOExYpmaSM1nkpK9xg8jDN7KJyOmnf0ylUAs6WyqOcfJbswx38zR1LHm1e/p0hqLZOColO7IVoTaJ/7U2zYi56Sd5n3+tTiH8p1HI65NlMP/6GorVTHH6LEBWfVW38L+zbUgbogGiqmE8ttP1PR2HvCJM7UFTww7dQ31wpERQDyFAhh56i0jLlVGlQdiymjZWblT8KZgC4bca5XjV/QETYUj2Uh2Ms3lujrQ8OxAywov1hrZT2qtkV5a1jrUSmfp9ZULoYNcadmLeZzz3X/zT/DyGVwg4KkHMtPWIncLtlDEwvO+ECAfPOAaTyrdtyzmwO78ouTEZtLN4UeU/OauZLLLPuzhrGFhNu9HhqES09WZHYc61zsDBUZLmAaEBon8s37mx5B4u2bvZQUPSshmopiQ0yYRGhGBtrztEmgrQEw1QPrvweOU33XcGYyu8y/0kZaJC1zlm00QgCN7N66ecJCDcqbD3MuO7vhrgXT3c627XKb0lKqrYJWpeV+l9MFNmmsHPc+Uoh1t2TLUQuD0sSDxHQUd+vD+8VHxUAU/UK8Jrg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(376002)(136003)(396003)(39860400002)(366004)(451199021)(41300700001)(6486002)(38100700002)(6512007)(6506007)(26005)(36756003)(5660300002)(2616005)(186003)(2906002)(86362001)(31696002)(8936002)(8676002)(4326008)(6916009)(66556008)(66476007)(66946007)(478600001)(31686004)(316002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gct8+EByvt6BNpJg0uGp0mwuxQpq?= =?utf-8?q?YPgbCZOqOrBwuiT5xU34zOEEmXih8vxylugvf7fB8/EGejSLkgeX/GondK32TlegU?= =?utf-8?q?r6IwfsM48xPlDgroznAOvgM85g6seGUs+BWpid52BV4Rc6CAPFWDqMN7/bLLKHFQX?= =?utf-8?q?rjRZvjNjQSsU65pqUjE6qs0fUwVJ/UJi+16AXB56SxUa3l2r3fkTr6A6KCH0IdGhk?= =?utf-8?q?Y4tc+FVqTCjHeCzNKzQAs0XSarrOGnCIe61uKl2AGBOK0dc66/0Z17k4hE2lSZXAP?= =?utf-8?q?xgjSaEd1rlRhR5pqhRNHxvqbm4KTpvqIqdfjKElmhnZ+mvwxv6SZDksjTxJnE22TB?= =?utf-8?q?LelsSQ1ZzlHVaw5y65Tv/sHNNNjwmYdvCpumP06xHcsP0S6I4UCbI6Qg1RUPo/1e0?= =?utf-8?q?evHoHH7Z+sYuy9YqiJhSuWJwqKDyWL4aQqTItDuVB8FML0FKNEMjA+vx+va4PK2Ml?= =?utf-8?q?U60FKevhmSyyRwhMKw44KiIFxEG9apfn61RO7TXcUPDmdz9ObZax8zIyp44EoMYk7?= =?utf-8?q?z9dnG3cxTbRlCZfKpecS3sJ2bEV4VueZ2Mmp6mxkpqqLhyeJrck28QKGFGcclfKnL?= =?utf-8?q?0Y6KaDknv3tr7xJJWKslyE3z7mmiT2qPQTMFvF77rhQhLszHzgW7414NuA+8iq8/F?= =?utf-8?q?X5/Q8AILL+yA/aQ/w5VXjV9YOwpZdmSzuHrPUNUy/rdZipphlXU8bJjZU3CGgMNEs?= =?utf-8?q?NN/RbBiu64keJMjgfSb2iIKEt5/zIzpo4iG2RCOveQB+lEyxqthVHnH3Rkc7fKAJS?= =?utf-8?q?+UUPVuI80PwBGzDpRrQk6/X82YW2K7xDuQQYGq1rea6wCT2QGa6t6tdp9G9aFxi5A?= =?utf-8?q?zQlWDd7heNOerlUj1+p/aiIh2ENIxKPRV8MCysa1tJX7jWajIinBqi+gEJ0XzMVer?= =?utf-8?q?v3mwEAnIQiYCuNp6jYI2aLXk3XvbCrlicSWcAcT5JJ6Eb+an0EEtEv9TLVjK06y7K?= =?utf-8?q?7CcNp2K+Hd62DZEgf3dJfbrtQQLGEjmwJ7XISmEQ0o3Y0Jjdz8dbvXJ37JdwN7zrZ?= =?utf-8?q?/a1suyxWK1lJsfWVAbIhfyISSxwJM4EEFXkqxc6xLfRKTX27CbmyLR2c1xKUmaudP?= =?utf-8?q?NHQPsnvSaHzZ5KJpAM4E7nOQACG5Z0ycL5Qo2ILQx5XhlEy2UtHK7UToZbppBNsLj?= =?utf-8?q?KHD6hq0AagDKqVCydEWo5x4eMSy+cQzciFQC5XPjsbh36gWkYENtfTXLuRiob+ady?= =?utf-8?q?bwyFzqYjRrp777mpUgJXD/yXvHZe80PoZBlaVOq1akLylGbZgN+2XFy/PwY4osCv3?= =?utf-8?q?b3urdQnZSOZ82E+W/qAhfjDUs84VEWzfC8AvpGVKlo4oO5su2tPquQOjYSGI8HCyt?= =?utf-8?q?t2gX52WvkiCWT/hitGDx7skkjeYmSC1pL7z/L+E+Qsl/y+iw1YkOsZf3qm5ClXjbP?= =?utf-8?q?OSZL67l89JsNtvcGSLLmXUAd06nAVDFwwMbQjcw9KZ5fLbHF36TObbQ+y5yPE1+8H?= =?utf-8?q?aST+ri3l2bnRCCLm7todwDK+URoIrd7iASMUNJs11ngqPkxM1n9F722s8pQzVHmka?= =?utf-8?q?RXJgitRPYtdP?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92099ee6-ad00-4a76-a574-08db586d5ad5 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 13:31:30.3055 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jvsw2/2l5De2tnMgy1341RqFXRlgdXjcd/uLVzuhn74xB7JHx6zHQ6qxLxg8Va3g3LJZmk7Cl+QUZiXUwg/k/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7601 X-Spam-Status: No, score=-3027.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766329554604407759?= X-GMAIL-MSGID: =?utf-8?q?1766329554604407759?= 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). Drop the unused is_mnemonic_char() at this occasion. --- 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]; /* 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) == ' ') @@ -3085,8 +3084,6 @@ md_begin (void) register_chars[c] = mnemonic_chars[c]; operand_chars[c] = c; } - else if (c == '{' || c == '}') - mnemonic_chars[c] = c; #ifdef SVR4_COMMENT_CHARS else if (c == '\\' && strchr (i386_comment_chars, '/')) operand_chars[c] = c; @@ -5476,6 +5473,12 @@ parse_insn (const char *line, char *mnem while (1) { mnem_p = mnemonic; + /* Pseudo-prefixes start with an opening figure brace. */ + if ((*mnem_p = *l) == '{') + { + ++mnem_p; + ++l; + } while ((*mnem_p = mnemonic_chars[(unsigned char) *l]) != 0) { if (*mnem_p == '.') @@ -5483,16 +5486,29 @@ parse_insn (const char *line, char *mnem mnem_p++; if (mnem_p >= mnemonic + MAX_MNEM_SIZE) { + too_long: as_bad (_("no such instruction: `%s'"), token_start); return NULL; } l++; } - if (!is_space_char (*l) - && *l != END_OF_INSN - && (intel_syntax - || (*l != PREFIX_SEPARATOR - && *l != ','))) + /* Pseudo-prefixes end with a closing figure brace. */ + if (*mnemonic == '{' && *l == '}') + { + *mnem_p++ = *l++; + if (mnem_p >= mnemonic + MAX_MNEM_SIZE) + goto too_long; + *mnem_p = '\0'; + + /* Point l at the closing brace if there's no other separator. */ + if (*l != END_OF_INSN && !is_space_char (*l) + && *l != PREFIX_SEPARATOR) + --l; + } + else if (!is_space_char (*l) + && *l != END_OF_INSN + && (intel_syntax + || (*l != PREFIX_SEPARATOR && *l != ','))) { if (prefix_only) break;