From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60053.outbound.protection.outlook.com [40.107.6.53]) by sourceware.org (Postfix) with ESMTPS id C02D8385828E for ; Wed, 5 Oct 2022 07:22:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C02D8385828E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c92kFaC0h6YpM2+f2ZhpWbfJtNLLlkkJ18BfIhfB3+C3CIbf6xyhtWzHzZmDmQyHh1TK3ACyaBbtdBN6M0iKU2p8Zf616mHbRGA/N3OsC5foedPlQjXxETJ3JiG+0m0quUnjqEhK8AbrwTAfWtuLkXaKbPfgs83+IchVb2ICFGufLiobHz5HiVbL88GLb9R/OogILHode5FO/I8oa1gN3XddBVayX0zfWCjyNwgXWGCXT8P1VLwodB/udbgLwCeOCg27at0ulYzAccpgFArP2jP4GcMggyPsbfQMvCUiDEJg9fu83S8e+AAUA5sUcDJJjX86WAAGFnM6StXS+792kA== 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=kYqcHG1dEDgRBH5nFSNg/W8o6s/kNFqWsPWYl7CGkow=; b=Cl9j/k92lxcrciN+r72yUtW1yHMnD81eliJwH+bYeARC6/WryVBBEPtNbc/cU5y6f44WP0FLkA6TwNBzOWnqaaGyNinNw+mIGFvUPDIl+qm4ZJtaiwddWzEXXEHoq/5sHtxPPrwph5k+JKGzfogto+5dzOrHSEwNFucFXUeoOZTr1lZhLTqRvOactQyKtIkb+Y/2g9e5IYaLKJTS8S66E67xBjLfzBe6uI9UO/mpC2VreUhqZLTsOenlBUc3IGrR8UhSYFYSN8OqyZQL28Ni8kuOUJTqehJvFz+CjT6jYG3/wlY0uwHP80Ka5hSYm1+gM7TXRVNL70AfIDkNsGezqQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kYqcHG1dEDgRBH5nFSNg/W8o6s/kNFqWsPWYl7CGkow=; b=Lobtj674iQSf0/MPdGTn98aisqN5XcT5Iue9rZ0E8aqqai0uhI6UUKuWOHUANPfCQC80rDtWOBMKSIO11MOrEU5scqbyn5XfElpNexaQszhlzsOXMvJiPEQ28p0aU18xs15HoemWgbtV2Tnkpj5QkuOHwGbsVMbd/9Wf7+aHytyQR2enAH0WZExobWjPYXmneWWnQEQ96eoOzNiUPKHwllK/trNaw8WyAj3PwWTa9PfrnINa4m4jr8eIAHfQGhPqkX3DVCRoNhKJkGExDCtzVSsH/AiuaWzmxfgT4UAa8JMgx1R/29gS06vTlyiNx2hzph1fnORXPuyppe870DY1WA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS8PR04MB7751.eurprd04.prod.outlook.com (2603:10a6:20b:2a2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Wed, 5 Oct 2022 07:22:23 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2459:15ae:e6cb:218a]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2459:15ae:e6cb:218a%7]) with mapi id 15.20.5676.031; Wed, 5 Oct 2022 07:22:21 +0000 Message-ID: <925cb740-4e1b-abc4-8526-aaab6faae5e1@suse.com> Date: Wed, 5 Oct 2022 09:22:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: [PATCH v3 2/7] x86: introduce Pass2 insn attribute Content-Language: en-US To: Binutils References: <20e2773a-2e47-869b-1900-709f8ad4cd6b@suse.com> Cc: "H.J. Lu" From: Jan Beulich In-Reply-To: <20e2773a-2e47-869b-1900-709f8ad4cd6b@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS9PR04CA0062.eurprd04.prod.outlook.com (2603:10a6:20b:48b::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_|AS8PR04MB7751:EE_ X-MS-Office365-Filtering-Correlation-Id: 892d5112-207e-4381-fb9b-08daa6a257ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OVNKTv9KqN6OozdEWMs7bEb+yqjFKPE4nafhuc5Od1gzHi5AdCaKQWjSWu8yr3ttAKxq+e0FsRUEI0u7N2ffuyo/iNqcdkRnvIbyoT+pQHBZ4szC9cO1utyzUahdSo7sG+JqpXF1cfe16TrKWSIe+TKnZAdtENLp2703RIxCBB7yNSHAdS6TV6prs8h2DDpDEja2bUVENyT6BTKZe++DhN2K0LW1QgQShJQVMl25V65S4hMgtkSJQ+Ev9igNWihYxsRsYnI+9bWIHYPOJ8hoctkTwBBP/1UgKmTokCVq8QOsNmqJjSlLudh/mCxVybcHKPhiE9X2gWTTEuG2uXMZ6mnRy5Q9J/aQOowYaax0Ysqb4GPOph4QK0swGC7MRkgG2/+QHOenObnWbbwX54FBWFsLIdh/XyiykzRR3YV0hZGS0SWuQ7gpWE1UvM5SSnrO1HeBKTVxhmWP64OukoyoCheZAaT3AxFRASaW+fgOegunUpbcAx6tqACKwfFpwp7mVOkZZr8g1Vohs9jZK6dIJb4EShOz9voBaAo1H6AJsJTaTtejxDgOqN+wSBGC9xKcWSxPYGm4HYjnAAYhfqhGsfX9GHzzvIp+nnsfblhgcQGAsMPAWZnDFvU7wzhZ+Zr7vZrHsxLLuhwduwg3cqTtCZ5Yx6A3qFUaew55t6nFy+doMYtpopDTUR1D5RtRnDxueSOQZd4Yr6OwpZsBH6t6bKD9WDnxREWXm2GGFAw2RznKQU8vOLdBbaI5xB3f3y/EEXBUArTIlwQStqSeOg3AaFnTnoG7dr06inrPOrZ4278= 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:(13230022)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199015)(31686004)(36756003)(31696002)(2906002)(5660300002)(2616005)(83380400001)(38100700002)(186003)(6506007)(6512007)(6486002)(478600001)(26005)(66946007)(66476007)(4326008)(316002)(86362001)(8676002)(66556008)(41300700001)(8936002)(6916009)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?elhTWTdyMDRtcHdmK3B4TjJkRGxwSUwxNXRiWHYzZ01WR1Qvd1B4cUtCQjVF?= =?utf-8?B?VkVta0hHdXIrMHNJRDlwbE5OdDlsMDBNUExCUkNRZHgyK294aG1vQlVCdXBw?= =?utf-8?B?N0pjWnk3TlJwcjNmekRWaW45cmFyaE83V1VtRHB3RVN4cHc3ampmUkNpT21G?= =?utf-8?B?L2o3VmRyeVhWVnlCMDdTZ3BMV2JoN1ZvMVBreHFDcWJHcU5NL09Hc1h2bmUr?= =?utf-8?B?b292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2dGxw?= =?utf-8?B?K3YvVEVwb0hRY25ibnJMdmpaak1idHI5ano4L3hOdWdZeWFoZjFubFdibVE5?= =?utf-8?Q?qqdtkFq2JciP7sFNfYTTM8Dnv?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 892d5112-207e-4381-fb9b-08daa6a257ae X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2022 07:22:21.4219 (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: fk8gdnzYrNZZzNuTEMdRbPfYMOEDHl/lGb/bFX68+qHstHCz7mrDvNphhgAtnjXEEDQZBCGcthUwr2J6K7LSDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7751 X-Spam-Status: No, score=-3029.9 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Subsequently we will want to mark templates for mnemonics which, due to their last character also possibly being a suffix, are "shadowing" other templates (and hence may require a second parsing pass). Introduce this attribute in a standalone patch, largely to ease looking at the actual later change. To simplify logic the later change is going to look for the new attribute only on the first template of a group. Make i386-gen warn about misplaced Pass2 (redundant ones are okay). While there convert "active_isstring" to bool, matching the new static variable. --- As to redundant attributes: An open question is whether - to avoid surprises when e.g. templates are re-ordered - it wouldn't be desirable to add Pass2 on all templates of a group. --- v3: New. --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -18,6 +18,7 @@ MA 02110-1301, USA. */ #include "sysdep.h" +#include #include #include #include "getopt.h" @@ -702,6 +703,7 @@ static bitfield opcode_modifiers[] = BITFIELD (FWait), BITFIELD (IsString), BITFIELD (RegMem), + BITFIELD (Pass2), BITFIELD (BNDPrefixOk), BITFIELD (RegKludge), BITFIELD (Implicit1stXmm0), @@ -801,7 +803,7 @@ static bitfield operand_types[] = static const char *filename; static i386_cpu_flags active_cpu_flags; -static int active_isstring; +static bool active_isstring, active_pass2; struct template_arg { const struct template_arg *next; @@ -1169,7 +1171,8 @@ process_i386_opcode_modifier (FILE *tabl char *str, *next, *last; bitfield modifiers [ARRAY_SIZE (opcode_modifiers)]; - active_isstring = 0; + active_isstring = false; + active_pass2 = false; /* Copy the default opcode modifier. */ memcpy (modifiers, opcode_modifiers, sizeof (modifiers)); @@ -1192,8 +1195,11 @@ process_i386_opcode_modifier (FILE *tabl set_bitfield (str, modifiers, val, ARRAY_SIZE (modifiers), lineno); + if (strcasecmp(str, "IsString") == 0) - active_isstring = 1; + active_isstring = true; + if (strcasecmp(str, "Pass2") == 0) + active_pass2 = true; if (strcasecmp(str, "W") == 0) have_w = 1; @@ -1868,6 +1874,7 @@ process_i386_opcodes (FILE *table) for (j = 0; j < i; j++) { struct opcode_hash_entry *next; + bool first_pass2 = false; for (next = opcode_array[j]; next; next = next->next) { @@ -1876,6 +1883,14 @@ process_i386_opcodes (FILE *table) lineno = next->lineno; last = str + strlen (str); output_i386_opcode (table, name, str, last, lineno); + + if (next == opcode_array[j]) + first_pass2 = active_pass2; + else if (!first_pass2 && active_pass2) + fprintf (stderr, + "Warning: %s:%d: %s: " + "'Pass2' is recognized only on the first template in a group\n", + filename, lineno, name); } } --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -504,6 +504,9 @@ enum Normally, it will be encoded in the reg field. We add a RegMem flag to indicate that it should be encoded in the regmem field. */ RegMem, + /* The (unsuffixed) mnemonic represents itself the suffixed form of another + mnemonic, potentially requiring a second parsing pass. */ + Pass2, /* quick test if branch instruction is MPX supported */ BNDPrefixOk, /* fake an extra reg operand for clr, imul and special register @@ -732,6 +735,7 @@ typedef struct i386_opcode_modifier unsigned int fwait:1; unsigned int isstring:2; unsigned int regmem:1; + unsigned int pass2:1; unsigned int bndprefixok:1; unsigned int regkludge:1; unsigned int implicit1stxmm0:1;