From patchwork Fri Nov 4 10:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp316894wru; Fri, 4 Nov 2022 03:51:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OhFuTnF78xDq0qt6Kdsn6peH6uRT1RT894EsE2sFINu2VBrvoBvD/JMEaYNJiyNA3MS2r X-Received: by 2002:a05:6402:754:b0:463:67da:3dc with SMTP id p20-20020a056402075400b0046367da03dcmr25775935edy.386.1667559071361; Fri, 04 Nov 2022 03:51:11 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bb6-20020a1709070a0600b007835897050esi5221396ejc.404.2022.11.04.03.51.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:51:11 -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=DGG64TUD; 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 5D2623858288 for ; Fri, 4 Nov 2022 10:51:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D2623858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559070; bh=87IFQvyu4nCd7AsTCbao7eH5zSQH8HLcIOiQeYvwxmY=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=DGG64TUDxR9qfASnMqfdSwes1Dyr0c7MWZMb1B/9n4Nf8hpUPL960Cn5nDEDR+BvZ QCZpqrhOQ2GfCY/M69sZ9lUioJK+XXzjxpz7d3K8iGvDkvego5NJMf21L9cRQNpPiC v7ZvcqAzqHlYEk8h2w+E+TqVE/QZeZvd9lCYXyeM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) by sourceware.org (Postfix) with ESMTPS id 4FEB33858425 for ; Fri, 4 Nov 2022 10:50:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FEB33858425 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFpTMWynwd8XquHyK+VYHK4AEY8G0jH1hgkh94btv+BR7QklEHQHlc++aDPRDKUoHUrpVmpQBmBgvJLbz8KoaXeZv0V7VuyPT8HGcg9EYLbu+0UqDBm/4NpiewcevMeWQeyiwlPJRX8saK6U0t7ZOFTk/Q9Y/tcVcDzgSjThj4JafK+wH8EG7Lhe2BUJXujkk/wGgExjfX8VRLDZtu5aG5NJzkgI2KN21XZDThGt7PYGXsdrNxqnKwiBwd0PDtIWAed3qxO84xVrXOebRckStar9/D8zIBC363ZIY8ZauWipYvdk6Dzi7lLoXuu4LBvru90s3TA/ZpA6ft4ULE9VVQ== 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=87IFQvyu4nCd7AsTCbao7eH5zSQH8HLcIOiQeYvwxmY=; b=Jw31ej8Ma7tI0JLTlkE6sU26WNoZ0ig53nRMeDAWXGqUkTnNVsvDCCZ0Fr2a+2NZxtM1/CP2RLshgQ4QqnT+aHpxHvYYvOgAbqxSn9kqvctUjspUF1mAfqjFnbbyf8LKp2JY8s8HTbRKouiGCQHpcQg0whaCrDRN5BjioAiWhOJ63rIW3jtbxJCDda8gdrIoU6w7zfVs05y0xxmh9/TjcIXAwC+SSs5f62oaBBNSUkQ20j5QCcPhDYpFI4uqJJu+6ePdQt9gmX43fhPwC/P5g41+ND7ByTOH7EZwsEDkB5YWx8yHXaorhvfaDa54R2iP5cyVoFUsfPx7b4wkNkr0sw== 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 DB9PR04MB8378.eurprd04.prod.outlook.com (2603:10a6:10:25f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 10:50:40 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:50:40 +0000 Message-ID: <926e5154-b40b-9df8-d770-a8bf7d40e40e@suse.com> Date: Fri, 4 Nov 2022 11:50:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 1/7] x86: constify parse_insn()'s input Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: FR3P281CA0087.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::9) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8378:EE_ X-MS-Office365-Filtering-Correlation-Id: e1d773b0-8d5b-4ac7-0246-08dabe5269fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50rEFy2MXopln8Kbk+9qnudnKeBLn0J9I8TBINq0ZS/7fkBP7ZnVy3c1RC/DOkrrU5A9VT6tIxLeMHvL9WqY2nDk9LMsdFxy7QVEvcBluwaX+Io5WqAfy+rFySuhTc5DQLokd8u9n/jipuSLvOfjG3pTfV4LXDPjx+ov/D7BDWk6XprmIjA/tZii5s4JQADcq5RTT9inQl9gfT4nqkcxNguy14FOF8dgm0GEy2Vwv2VKO3ZT2BcOZp7CneVrKZqogFSU/DTx4nwrdGFsn/g00Juk3A1ETDtafxndfMAbYDxPjcVQsNVEUNIS2evh6VHXfI/nNNPeZ7aSduQU2prOjKFLXnAgx49uuhSxUqYQ8NqTy+WKUB2W0imDKqgWjIoyNql7XkNioh2EsuV4ToU5TWy1v7l8DvGTZNV13BksQ25GDomvc1mG3RCdBFAS0BpWhE2VadPgPEPjeXvu9IgTDRgY2Ted/9/jgKWuXP5+zTIUhC5KJqH/jOJ/faLY5+dtkZJuFxK2dUI9FgBBRMfN/2gqWfbkZ4E/UoEOZgMm4H4udG19mNqCEvCgr/3v26jgST9kLK48rSyISd0GVudBYkmEhQa73Y620T+IchyluZfv4a3CEmEigWIUxxzMfRhou5LDG7TRHaj8AJM8go7eK6LCHFnatEgnN+peIyDA5YhQGISwiZ9fSi4OQgfoN2JQn+Pd4bk0nnMdXS6fRbpaeyxpNlNKJiKEXaChZsh0ngZtGL8kDdRB1qrfj12iFND6ivuT/9Md77kckdIAbfQ6FVTCazV8X+T3ZOgJOfYG2Yk= 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)(346002)(366004)(39860400002)(136003)(396003)(376002)(451199015)(36756003)(31696002)(86362001)(31686004)(83380400001)(38100700002)(186003)(6486002)(478600001)(6512007)(6506007)(26005)(66476007)(8936002)(316002)(41300700001)(66946007)(8676002)(2906002)(66556008)(4326008)(6916009)(5660300002)(2616005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?byR6z4Sj6B1Zfnu5RijYy51BMGnw?= =?utf-8?q?qgJHTIYOyceO0rJxH4NuQuYuFH0w8LtISiSuMRH0dUE9kg3U5Xz47PR1mtmILbFtQ?= =?utf-8?q?I/tkEAhOMNZJXnTCqIEPxNJw757vDHYXuHPnXnnPK3k5DoIqVR/qmVtYbuq3LiryO?= =?utf-8?q?FxfSYKHXzNBUyDsCxcmXRQH/laJ6Mof6Gfnh4S2VNQ9JhM/SWSnw0hCOmRjyDD6fX?= =?utf-8?q?c+FmQYgzVWmqtO1SRB3xsglSlcbms1W0aGsc5cMsDgSfANAIUwgFqcUUUr4fzkV7m?= =?utf-8?q?1GQWpVSXRSaAYwbQJeStz/N04JO3Te6r32QpCjl5RjVdTI2QdvaNPaOK6RzpfLWIc?= =?utf-8?q?Sco9xyQpBdYA2K4u/l6IOWHiQfL3j4+9n0y7bDXk4K81ZHuS/iMsygBRT/0rrugi+?= =?utf-8?q?baWQoy+ieQcEUkbmNvoL2XMIgGDZPyCAnKzQJYP+T69SUhN5ltK/BJahvw7NZNge0?= =?utf-8?q?anyoc59wOATt1976fOyrI8VSjzW3Wx7Vu7EwWY2HcpsmDqcLfJJugqG8psqGxMQOP?= =?utf-8?q?NejImLWwwO5IbQJBTHlYkv/vmKCJt4dn1Y+2R7aNJ8/SROTwsFMs/E0oEOhgdR0OY?= =?utf-8?q?u/Ne3E+4D7jOyS4A4Grw3ctowU4Nyx1SV4uAwc24kMHvghYouV31aV6vB7pGNrmmx?= =?utf-8?q?Ox9LorLetdz7XjXSYWMH3NdxDbyzI0cQkZS+ztnLF207AvpK7f00Ya/CKYzq91wfc?= =?utf-8?q?kVsMfDXGClpH5NY2a5A308dIgwH3mKVrPQ2A4HgfAJVarQ14d9enfPo+iaUQEXI4E?= =?utf-8?q?BdoGIov4Qh9xAaOpp1mcVhgM/ri2QhiolZX+PE4gS2pDMmGfvdug3xIilAt6EZH7h?= =?utf-8?q?17Qqo2+tJIhsO6BcJDRdDiOiMEowmjR+tg02pcFwd05m8I/gwk2TQ88Ut1TYpDw/W?= =?utf-8?q?Km6veleesvQ/RaekXzM46aUwC/8K12/ZQV7Kb4H5GRA6M3+gdwcVI14TjCQZcx0eS?= =?utf-8?q?f0XW+q+UqznReOHi5vqfjU3YVjYpF3DdGAYBZ/h5v8OmzjhZwlUQsUBWEvpJEI7ON?= =?utf-8?q?wSYXESQKvPoK8Vdu9Hhm3LKUCPg61dHZpO2MFITjpQfReaOlZgtUF3encfSxpWc9Z?= =?utf-8?q?f4liDgviDyORfrF2EstsOgW+g9L513BHk/e0Yc8z/6X8g7X4TCQ/UMcw37SdJ32/R?= =?utf-8?q?JHusufUmt4Ha2MKrWbtiYSxGCKnm0LkqYS8SADH4CX+rzLraMqfcVgG/VKdeBMRGX?= =?utf-8?q?HYUx9taESITa4JGTXipyR+TdZB3bKUx8djK6Xm6Pel7lmMm24yby6Qdjt4MtD3nro?= =?utf-8?q?nQaD6QB5RbcRQkCkkMBep/h0G0HAsNa64s3Lq8RP6C39O+c35bJ4YPVNfwdaT+6Jm?= =?utf-8?q?4IV4cnnYvorF2sdSCDMxUf0ia3Vrf1cP1NLbht3LrVW0tFWjAx70ay84PuuGbfHYL?= =?utf-8?q?64dAEieJsIqjUu4ed8kxF8jNZxC+l6vpwGksQhAsO9kycCvtF5LDfYmBwcLHJ8UpJ?= =?utf-8?q?aL/ailLZAcCO4rFHPEJT4icWShhnDHFQb6xzP1oUFs0ESUvufeEx361y+923hkpdY?= =?utf-8?q?po7/IlJ2Tc2c?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1d773b0-8d5b-4ac7-0246-08dabe5269fa X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:50:40.2496 (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: Zy8fXuHrjAwBXKMBvc2DFaMirw0IpnHDWGT8EQ0BLgIQkqIgqsqqhINXFw9f6rhcoch1mcuC2ydJDGpgvHD5Bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8378 X-Spam-Status: No, score=-3029.5 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 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?1748562420743972584?= X-GMAIL-MSGID: =?utf-8?q?1748562420743972584?= The function doesn't alter its input buffer: Reflect this in its prototype. To avoid using any kind of cast, simply calculate the update of "line" from the function's input and output. --- Avoiding a cast the way it's done here is going to be useful in subsequent patches (there'll be code added between the call and the update of "line"), so switching to a cast is not really an option. --- v3: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -157,7 +157,7 @@ static int i386_intel_operand (char *, i static int i386_intel_simplify (expressionS *); static int i386_intel_parse_name (const char *, expressionS *); static const reg_entry *parse_register (char *, char **); -static char *parse_insn (char *, char *); +static const char *parse_insn (const char *, char *); static char *parse_operands (char *, const char *); static void swap_operands (void); static void swap_2_operands (unsigned int, unsigned int); @@ -4839,6 +4839,7 @@ md_assemble (char *line) { unsigned int j; char mnemonic[MAX_MNEM_SIZE], mnem_suffix; + const char *end; const insn_template *t; /* Initialize globals. */ @@ -4854,9 +4855,10 @@ md_assemble (char *line) We assume that the scrubber has arranged it so that line[0] is the valid start of a (possibly prefixed) mnemonic. */ - line = parse_insn (line, mnemonic); - if (line == NULL) + end = parse_insn (line, mnemonic); + if (end == NULL) return; + line += end - line; mnem_suffix = i.suffix; line = parse_operands (line, mnemonic); @@ -5241,11 +5243,10 @@ md_assemble (char *line) last_insn.kind = last_insn_other; } -static char * -parse_insn (char *line, char *mnemonic) +static const char * +parse_insn (const char *line, char *mnemonic) { - char *l = line; - char *token_start = l; + const char *l = line, *token_start = l; char *mnem_p; int supported; const insn_template *t; From patchwork Fri Nov 4 10:51:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp317278wru; Fri, 4 Nov 2022 03:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lsZjlWYUwKnVrQCjHcvHAppK79AIZpjSlSn4ILMb4RXAJI1uWTUXf0muaYuookWKCNJ+g X-Received: by 2002:a50:ee0a:0:b0:463:4055:9db4 with SMTP id g10-20020a50ee0a000000b0046340559db4mr29285085eds.421.1667559118962; Fri, 04 Nov 2022 03:51:58 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id nc27-20020a1709071c1b00b0078d4b9428cdsi4944610ejc.389.2022.11.04.03.51.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:51:58 -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=J+HWc8mh; 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 03D5C3857C4C for ; Fri, 4 Nov 2022 10:51:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03D5C3857C4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559114; bh=rdZqiPclZTNtG7ChWTqUmqXI9hR05S361HzIDYY3k+g=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=J+HWc8mhDJIyWvkga8XH71sBkLg98t/CVnhe8Rx47MZAwpoedcTIFdHRHPrmUkPVv 56r7hPW4YA83kok8qVaEeuLCFoWUnbexP2I01CTGCIPCJGkerrh/S4PKQX/qxOtnh3 SIZdKWSegjiMWsuVEuSnmQmw70e8sMpHCwR80PNU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) by sourceware.org (Postfix) with ESMTPS id 44DA73858001 for ; Fri, 4 Nov 2022 10:51:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 44DA73858001 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pmrg0Jhhx9aoOJDah0DFTOZx9Tl/9X569REpWirGks4UyZi/ABPLAHwC5Da/VObP/nAdkiNyCZ72wgYyH7U/dF7IVpNGV5bNH3UR/vvxuaEghlZ8fCD1P33BAZ2ETrKxzuSkuFBiy1g1lI62l98uZA88erjVGzhddkc8lbkkpNCwg3N9C9htB06YUp2q0AjjjGT2+ek+Psm6PHpNBnQTud/cpMhMep9mLrsvY3AyoHfpASfLr7TZ+FLXuH3lH7yuescHhOP1UYzdZwTZiTuLyj5IGGCD56FvW27LD7nnC7U/PsWog3uySuUqMgqROCWsIZbTAcDJBBaAXfsjTo2L6A== 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=rdZqiPclZTNtG7ChWTqUmqXI9hR05S361HzIDYY3k+g=; b=S0gnOri2rFx9+18nYwEPqIceubPPGh7e5fJHzhQvbuoR0/JkjbjmkPsk7V305rsTEcIgjpXSMPxTrKNbs8x1QS4IJUJyG2hX0y+IFhL2C7O982THGjrPgRNHEifs8M5FfOpAD0s22EM0L95aeTR+ZgSzdTpNrudf7v2zdnhVFrs/0+1aPS4tyFPEGRqfFFZSNbxn9sPcVFG2wbCBJlWBoH6/mjPyb6A913Amyj1yB5+CAW+LPvi5EezJlxlovAkyPOblDcS59FDZbacBEVcBTOdeGHTOG7yKcpgQo9xcvDO3czDY8FC5uCOIzr00J9RfAk9BjNDjxhbyX2pg6EvXrg== 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 DB9PR04MB8378.eurprd04.prod.outlook.com (2603:10a6:10:25f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 10:51:36 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:51:35 +0000 Message-ID: <07ef67fd-752c-ad1f-b8cb-4eaec1f420fc@suse.com> Date: Fri, 4 Nov 2022 11:51:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 2/7] x86: re-work insn/suffix recognition Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: FR3P281CA0090.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::6) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8378:EE_ X-MS-Office365-Filtering-Correlation-Id: f2d88038-d67b-48c6-1694-08dabe528b2d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nJGTbSf5NFecRMHEAGYURCX+eZmDvUN5YgT2NqbfhkYX5qRgPD4dwl7YezpkQ0tpk5WMkNbX9kitdbplEZJCRepwdb0UKFFpU8g2b3Zl7PoHIEjNmxN0VZeJWMhRPadhdf/dJ7hIzGqqZacz+mSfLtguskccvLJcTP9+QD4lO4SW5wwk9zpdsDL1oGJDhPD4WiaWQtwiB3Thc+QPnXHeSqpkKdRvcNZbQozyQk03zszQ97szDv0sm1j9PU6B+POgKe+LBjqVhABZ7vir7RcS9chh+R7n/tQDNGHqnqNS2qvP1D0SK6S8Ky4YbVS0orq3/jyAZm0RnxMlzirP9SFiBaHSDQOe3l8sEjI4YzjPmK/Rq45BzawHpPO8hdiFkl2U3/PYgOF663R6+1mADNNBlxqLPlqE2YTnRSP+0KwAgaWzIFuUo7s8GtXzsMlTeLn8XtuTk1GSaR4dl32MYH7/Qbawz013eeRssryM4MlG60hkn1EInZbBawXB56HXHMgVyNIBYsK3zHYYYH8JslZlQ3+/nmvnPSLQNPWirvsRYdp+9PyJRFPWRQStsyTJ7E+RqVlu/cPYhu2B/0CD0LB/eOSgm8XEV27BOTpuMKOrI/lKVMZg6qpDo6j/ZkcQe4RQUccZav8plma/tqIGuu2VxCp7ODeyl8Kfm0Bg/qSYhznMhbQoftvd29NTwhLt9CzcknWxKEocNlmUNYYgEYJRIKpTRIizjtK2fGTBLuLACd8oT8Nhr3gTz+1k2EvL8ctAbsjzUH97tlR7wWqHphuYM8E91Q+Ibh3g0euTExw6LLA= 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)(346002)(366004)(39860400002)(136003)(396003)(376002)(451199015)(36756003)(31696002)(86362001)(31686004)(83380400001)(38100700002)(186003)(6486002)(478600001)(6512007)(6506007)(26005)(66476007)(8936002)(316002)(41300700001)(66946007)(8676002)(2906002)(66556008)(4326008)(30864003)(6916009)(5660300002)(2616005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pS+b30ByLol5ZToZ/8R+8fK3V7II?= =?utf-8?q?QP77jKYtV3ZImnAUtbZzboFLNhSFbSrnpI9DvMmRs5fzuaxfh6fbwGcE54PoIVcfB?= =?utf-8?q?3DgpyqV/jhZ5drX/V63Z8BZygCq5XyFcTFgimLaY5Clt11mCOkA5l1iIBi3Yl2Pnk?= =?utf-8?q?9Mns47lW3e1i3rDCiT8SbzpWg7uTM21UWdzHq8h0ViNOCUHFrXX3VGe8Y50B9ZcO5?= =?utf-8?q?35BJ2rduKBW7/OZFuGRTmzekq5l9JItCKG+BcnryxyB/8ODYh/3KAeJUmSzWPwLKo?= =?utf-8?q?bwwx8z06aXUFgXGtG33pDbW5rHFLz+MIV7S5TBN8N9JEhQHD3pNictX2YBT44268V?= =?utf-8?q?QN16svHsPsEnCJ8oUxkpWc7mPdde3IzdTuvqm+ksixBlj4jTtEUEk93Xgn94zyeU0?= =?utf-8?q?JrmNn63OK3W3HiMveJdu3yoUbsE0c0goL8cTGlcAvMDGPhXQh3ory9sgWIqQbFMmP?= =?utf-8?q?3h36ujUIvHuM7P6e3T5Zkl4xZ4iWeNZczNblfRmYtjyqaJfP6l1lZr9OVs7Q7GWsh?= =?utf-8?q?z1BVbjtsH69Q5IDXa8atgdl0BnYlj0sqbPErC+Pj8EIEyrzHO/i8Ih5tfCo99U3wj?= =?utf-8?q?7MTT5HkzPfCytVCKdLNzn14dXWvcyb+pGDoLGEfI+AQyAEptg+GlJHArERapV5ktK?= =?utf-8?q?DRCJjKQbKXPsgxPV0KpIkHdrGPhp8Kh/gnP2Hh6CoFTKzH0nB04w12VMCvnn5tqlU?= =?utf-8?q?enp1EfiRagl8g4a2p2YIuts4FcAYrh1dgBOmLZCrTkz/vlh3pXwcuHgHud/PfWPr6?= =?utf-8?q?EUxXkX95UJLU8UtDS1e6QGLDeTXJ0ltj5Djp2oOLaFo2U+lddwEquHrnEG4ukZBl7?= =?utf-8?q?ivmPZPUnz1koF1Zv1mrPRLdHei+40B72ldAzQyO4e0fznjk6w9Yrpx107kKaJTxy0?= =?utf-8?q?mFrnxmDst7axqyf5dRw8Qtu9Ur9iQT31GQVI0sNPhFpMTKvwOGFKh+rS5xp8K1dRp?= =?utf-8?q?C1ZW6OtLkLV3JwqhVHHjT3KwbbTjKiPsw3Xto6qWTWsE7QcvPJ3e+WYc+E/VLtb9L?= =?utf-8?q?SMQhXfdJz4XfXDj9u3ocZiRPZURxx4RtwnUuwCOFSBBhnFi86IBHlTrHLksKTXrgT?= =?utf-8?q?1PelwmeSaS9yVEXa6skWNAETJGcjYBDkqkhRc9SL30eINAcw6E4WoLQoVSrg88WZJ?= =?utf-8?q?/csIRNrJUceyGBUg0iCUPybqooNgKbsY9G0iVrTY2yarVFsVzgoZMv7cERzCEvZsq?= =?utf-8?q?l0TM++68phYLjDOaFCiuLBnPA5fW3ilISogiNifvbR3rWpNYL3SkDXLHcOsB8UVk5?= =?utf-8?q?Qwz7JhG4oVpBRqPlwAazrlZygTX95iHLLZb6IooxELFM2uCeV2shjsOYfTTHcwjzy?= =?utf-8?q?0FjFFrAmdLGLr+uHP45/l2xP2d/FH9wJ/AH8RXE/ui8DACGdMAnQZqbU+yOWrXSQs?= =?utf-8?q?HKIYqzlWNl8csNPuhZampzdBD5gZDcXWrSqNcsPy3c484PU17DiIZbP6nUZL6M6RA?= =?utf-8?q?8GVNCXtHmO/KhKzFVq6rw3+cocCBF34wIvtd2ie5CrizGA3Pib6xa8rUpj3VKdI/1?= =?utf-8?q?kPwTQkXK9xbE?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2d88038-d67b-48c6-1694-08dabe528b2d X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:51:35.9336 (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: GATvrjYp1MVdoHQjtFw0C633eTgKvcZrvfVXKOjM7WlUaTzh80JVvLiGSSJn4SjK1Mjny/YJgfiBkxYm9lhxTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8378 X-Spam-Status: No, score=-3029.5 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 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?1748562470635518674?= X-GMAIL-MSGID: =?utf-8?q?1748562470635518674?= Having templates with a suffix explicitly present has always been quirky. Introduce a 2nd matching pass in case the 1st one couldn't find a suitable template _and_ didn't itself already need to trim off a suffix to find a match at all. This requires error reporting adjustments (albeit luckily fewer than I was afraid might be necessary), as errors previously reported during matching now need deferring until after the 2nd pass (because, obviously, we must not emit any error if the 2nd pass succeeds). While also related to PR gas/29524, it was requested that move-with-sign-extend be left as broken as it always was. PR gas/29525 Note that with the dropped CMPSD and MOVSD Intel Syntax string insn templates taking operands, mixed IsString/non-IsString template groups (with memory operands) cannot occur anymore. With that maybe_adjust_templates() becomes unnecessary (and is hence being removed). PR gas/29526 Note further that while the additions to the intel16 testcase aren't really proper Intel syntax, we've been permitting all of those except for the MOVD variant. The test therefore is to avoid re-introducing such an inconsistency. --- To limit code churn I'm using "goto" for the retry loop, but I'd be happy to make this a proper loop either right here or in a follow-on change doing just the necessary re-indentation. The "too many memory references" errors which are being deleted weren't fully consistent anyway - even the majority of IsString insns accepts only a single memory operand. If we wanted to retain that, it would need re-introducing in md_assemble(), latching the error into i.error just like match_template() does. As an unrelated observation: Why is "MOVQ $imm64, %reg64" being optimized but "MOVABS $imm64, %reg64" is not? --- v6: Re-base over dropping of Pass2 attribute. v5: Split off move-with-sign-extend changes. v4: Retain support for operand-less MOVSD and CMPSD. v3: Limit xstrdup() to just the templates where a 2nd pass actually makes sense (new Pass2 attribute). --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -297,9 +297,6 @@ struct _i386_insn explicit segment overrides are given. */ const reg_entry *seg[2]; - /* Copied first memory operand string, for re-checking. */ - char *memop1_string; - /* PREFIX holds all the given prefix opcodes (usually null). PREFIXES is the number of prefix opcodes. */ unsigned int prefixes; @@ -4293,7 +4290,20 @@ optimize_encoding (void) movq $imm31, %r64 -> movl $imm31, %r32 movq $imm32, %r64 -> movl $imm32, %r32 */ - i.tm.opcode_modifier.norex64 = 1; + i.tm.opcode_modifier.size = SIZE32; + if (i.imm_operands) + { + i.types[0].bitfield.imm32 = 1; + i.types[0].bitfield.imm32s = 0; + i.types[0].bitfield.imm64 = 0; + } + else + { + i.types[0].bitfield.dword = 1; + i.types[0].bitfield.qword = 0; + } + i.types[1].bitfield.dword = 1; + i.types[1].bitfield.qword = 0; if (i.tm.base_opcode == 0xb8 || (i.tm.base_opcode | 1) == 0xc7) { /* Handle @@ -4303,11 +4313,6 @@ optimize_encoding (void) i.tm.operand_types[0].bitfield.imm32 = 1; i.tm.operand_types[0].bitfield.imm32s = 0; i.tm.operand_types[0].bitfield.imm64 = 0; - i.types[0].bitfield.imm32 = 1; - i.types[0].bitfield.imm32s = 0; - i.types[0].bitfield.imm64 = 0; - i.types[1].bitfield.dword = 1; - i.types[1].bitfield.qword = 0; if ((i.tm.base_opcode | 1) == 0xc7) { /* Handle @@ -4830,6 +4835,18 @@ insert_lfence_before (void) } } +/* Helper for md_assemble() to decide whether to prepare for a possible 2nd + parsing pass. Instead of introducing a rarely use new insn attribute this + utilizes a common pattern between affected templates. It is deemed + acceptable that this will lead to unnecessary pass 2 preparations in a + limited set of cases. */ +static INLINE bool may_need_pass2 (const insn_template *t) +{ + return t->opcode_modifier.sse2avx + /* Note that all SSE2AVX templates have at least one operand. */ + && t->operand_types[t->operands - 1].bitfield.class == RegSIMD; +} + /* This is the guts of the machine-dependent assembler. LINE points to a machine dependent instruction. This function is supposed to emit the frags/bytes it assembles to. */ @@ -4838,11 +4855,14 @@ void md_assemble (char *line) { unsigned int j; - char mnemonic[MAX_MNEM_SIZE], mnem_suffix; - const char *end; + char mnemonic[MAX_MNEM_SIZE], mnem_suffix, *copy = NULL; + const char *end, *pass1_mnem = NULL; + enum i386_error pass1_err = 0; const insn_template *t; /* Initialize globals. */ + current_templates = NULL; + retry: memset (&i, '\0', sizeof (i)); i.rounding.type = rc_none; for (j = 0; j < MAX_OPERANDS; j++) @@ -4857,16 +4877,26 @@ md_assemble (char *line) end = parse_insn (line, mnemonic); if (end == NULL) - return; + { + if (pass1_mnem != NULL) + goto match_error; + return; + } + if (may_need_pass2 (current_templates->start)) + { + /* Make a copy of the full line in case we need to retry. */ + copy = xstrdup (line); + } line += end - line; mnem_suffix = i.suffix; line = parse_operands (line, mnemonic); this_operand = -1; - xfree (i.memop1_string); - i.memop1_string = NULL; if (line == NULL) - return; + { + free (copy); + return; + } /* Now we've parsed the mnemonic into a set of templates, and have the operands at hand. */ @@ -4942,7 +4972,97 @@ md_assemble (char *line) with the template operand types. */ if (!(t = match_template (mnem_suffix))) - return; + { + const char *err_msg; + + if (copy && !mnem_suffix) + { + line = copy; + copy = NULL; + pass1_err = i.error; + pass1_mnem = current_templates->start->name; + goto retry; + } + free (copy); + match_error: + switch (pass1_mnem ? pass1_err : i.error) + { + default: + abort (); + case operand_size_mismatch: + err_msg = _("operand size mismatch"); + break; + case operand_type_mismatch: + err_msg = _("operand type mismatch"); + break; + case register_type_mismatch: + err_msg = _("register type mismatch"); + break; + case number_of_operands_mismatch: + err_msg = _("number of operands mismatch"); + break; + case invalid_instruction_suffix: + err_msg = _("invalid instruction suffix"); + break; + case bad_imm4: + err_msg = _("constant doesn't fit in 4 bits"); + break; + case unsupported_with_intel_mnemonic: + err_msg = _("unsupported with Intel mnemonic"); + break; + case unsupported_syntax: + err_msg = _("unsupported syntax"); + break; + case unsupported: + as_bad (_("unsupported instruction `%s'"), + pass1_mnem ? pass1_mnem : current_templates->start->name); + return; + case invalid_sib_address: + err_msg = _("invalid SIB address"); + break; + case invalid_vsib_address: + err_msg = _("invalid VSIB address"); + break; + case invalid_vector_register_set: + err_msg = _("mask, index, and destination registers must be distinct"); + break; + case invalid_tmm_register_set: + err_msg = _("all tmm registers must be distinct"); + break; + case invalid_dest_and_src_register_set: + err_msg = _("destination and source registers must be distinct"); + break; + case unsupported_vector_index_register: + err_msg = _("unsupported vector index register"); + break; + case unsupported_broadcast: + err_msg = _("unsupported broadcast"); + break; + case broadcast_needed: + err_msg = _("broadcast is needed for operand of such type"); + break; + case unsupported_masking: + err_msg = _("unsupported masking"); + break; + case mask_not_on_destination: + err_msg = _("mask not on destination operand"); + break; + case no_default_mask: + err_msg = _("default mask isn't allowed"); + break; + case unsupported_rc_sae: + err_msg = _("unsupported static rounding/sae"); + break; + case invalid_register_operand: + err_msg = _("invalid register operand"); + break; + } + as_bad (_("%s for `%s'"), err_msg, + pass1_mnem ? pass1_mnem : current_templates->start->name); + return; + } + + free (copy); if (sse_check != check_none /* The opcode space check isn't strictly needed; it's there only to @@ -5248,6 +5368,7 @@ parse_insn (const char *line, char *mnem { const char *l = line, *token_start = l; char *mnem_p; + bool pass1 = !current_templates; int supported; const insn_template *t; char *dot_p = NULL; @@ -5417,8 +5538,10 @@ parse_insn (const char *line, char *mnem current_templates = (const templates *) str_hash_find (op_hash, mnemonic); } - if (!current_templates) + if (!current_templates || !pass1) { + current_templates = NULL; + check_suffix: if (mnem_p > mnemonic) { @@ -5460,13 +5583,39 @@ parse_insn (const char *line, char *mnem current_templates = (const templates *) str_hash_find (op_hash, mnemonic); } + /* For compatibility reasons accept MOVSD and CMPSD without + operands even in AT&T mode. */ + else if (*l == END_OF_INSN + || (is_space_char (*l) && l[1] == END_OF_INSN)) + { + mnem_p[-1] = '\0'; + current_templates + = (const templates *) str_hash_find (op_hash, mnemonic); + if (current_templates != NULL + /* MOVS or CMPS */ + && (current_templates->start->base_opcode | 2) == 0xa6 + && current_templates->start->opcode_modifier.opcodespace + == SPACE_BASE + && mnem_p[-2] == 's') + { + as_warn (_("found `%sd'; assuming `%sl' was meant"), + mnemonic, mnemonic); + i.suffix = LONG_MNEM_SUFFIX; + } + else + { + current_templates = NULL; + mnem_p[-1] = 'd'; + } + } break; } } if (!current_templates) { - as_bad (_("no such instruction: `%s'"), token_start); + if (pass1) + as_bad (_("no such instruction: `%s'"), token_start); return NULL; } } @@ -6870,81 +7019,7 @@ match_template (char mnem_suffix) if (t == current_templates->end) { /* We found no match. */ - const char *err_msg; - switch (specific_error) - { - default: - abort (); - case operand_size_mismatch: - err_msg = _("operand size mismatch"); - break; - case operand_type_mismatch: - err_msg = _("operand type mismatch"); - break; - case register_type_mismatch: - err_msg = _("register type mismatch"); - break; - case number_of_operands_mismatch: - err_msg = _("number of operands mismatch"); - break; - case invalid_instruction_suffix: - err_msg = _("invalid instruction suffix"); - break; - case bad_imm4: - err_msg = _("constant doesn't fit in 4 bits"); - break; - case unsupported_with_intel_mnemonic: - err_msg = _("unsupported with Intel mnemonic"); - break; - case unsupported_syntax: - err_msg = _("unsupported syntax"); - break; - case unsupported: - as_bad (_("unsupported instruction `%s'"), - current_templates->start->name); - return NULL; - case invalid_sib_address: - err_msg = _("invalid SIB address"); - break; - case invalid_vsib_address: - err_msg = _("invalid VSIB address"); - break; - case invalid_vector_register_set: - err_msg = _("mask, index, and destination registers must be distinct"); - break; - case invalid_tmm_register_set: - err_msg = _("all tmm registers must be distinct"); - break; - case invalid_dest_and_src_register_set: - err_msg = _("destination and source registers must be distinct"); - break; - case unsupported_vector_index_register: - err_msg = _("unsupported vector index register"); - break; - case unsupported_broadcast: - err_msg = _("unsupported broadcast"); - break; - case broadcast_needed: - err_msg = _("broadcast is needed for operand of such type"); - break; - case unsupported_masking: - err_msg = _("unsupported masking"); - break; - case mask_not_on_destination: - err_msg = _("mask not on destination operand"); - break; - case no_default_mask: - err_msg = _("default mask isn't allowed"); - break; - case unsupported_rc_sae: - err_msg = _("unsupported static rounding/sae"); - break; - case invalid_register_operand: - err_msg = _("invalid register operand"); - break; - } - as_bad (_("%s for `%s'"), err_msg, - current_templates->start->name); + i.error = specific_error; return NULL; } @@ -11347,49 +11422,6 @@ RC_SAE_immediate (const char *imm_start) return 1; } -/* Only string instructions can have a second memory operand, so - reduce current_templates to just those if it contains any. */ -static int -maybe_adjust_templates (void) -{ - const insn_template *t; - - gas_assert (i.mem_operands == 1); - - for (t = current_templates->start; t < current_templates->end; ++t) - if (t->opcode_modifier.isstring) - break; - - if (t < current_templates->end) - { - static templates aux_templates; - bool recheck; - - aux_templates.start = t; - for (; t < current_templates->end; ++t) - if (!t->opcode_modifier.isstring) - break; - aux_templates.end = t; - - /* Determine whether to re-check the first memory operand. */ - recheck = (aux_templates.start != current_templates->start - || t != current_templates->end); - - current_templates = &aux_templates; - - if (recheck) - { - i.mem_operands = 0; - if (i.memop1_string != NULL - && i386_index_check (i.memop1_string) == 0) - return 0; - i.mem_operands = 1; - } - } - - return 1; -} - static INLINE bool starts_memory_operand (char c) { return ISDIGIT (c) @@ -11540,17 +11572,6 @@ i386_att_operand (char *operand_string) char *displacement_string_end; do_memory_reference: - if (i.mem_operands == 1 && !maybe_adjust_templates ()) - return 0; - if ((i.mem_operands == 1 - && !current_templates->start->opcode_modifier.isstring) - || i.mem_operands == 2) - { - as_bad (_("too many memory references for `%s'"), - current_templates->start->name); - return 0; - } - /* Check for base index form. We detect the base index form by looking for an ')' at the end of the operand, searching for the '(' matching it, and finding a REGISTER_PREFIX or ',' @@ -11757,8 +11778,6 @@ i386_att_operand (char *operand_string) if (i386_index_check (operand_string) == 0) return 0; i.flags[this_operand] |= Operand_Mem; - if (i.mem_operands == 0) - i.memop1_string = xstrdup (operand_string); i.mem_operands++; } else --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -993,10 +993,7 @@ i386_intel_operand (char *operand_string || intel_state.is_mem) { /* Memory operand. */ - if (i.mem_operands == 1 && !maybe_adjust_templates ()) - return 0; - if ((int) i.mem_operands - >= 2 - !current_templates->start->opcode_modifier.isstring) + if (i.mem_operands) { /* Handle @@ -1041,10 +1038,6 @@ i386_intel_operand (char *operand_string } } } - - as_bad (_("too many memory references for `%s'"), - current_templates->start->name); - return 0; } /* Swap base and index in 16-bit memory operands like @@ -1158,8 +1151,6 @@ i386_intel_operand (char *operand_string return 0; i.flags[this_operand] |= Operand_Mem; - if (i.mem_operands == 0) - i.memop1_string = xstrdup (operand_string); ++i.mem_operands; } else --- a/gas/testsuite/gas/i386/code16.d +++ b/gas/testsuite/gas/i386/code16.d @@ -1,5 +1,6 @@ #objdump: -drw -mi8086 #name: i386 with .code16 +#warning_output: code16.e .*: +file format .* --- /dev/null +++ b/gas/testsuite/gas/i386/code16.e @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:3: Warning: .* `movsd'.*`movsl'.* +.*:4: Warning: .* `cmpsd'.*`cmpsl'.* --- a/gas/testsuite/gas/i386/code16.s +++ b/gas/testsuite/gas/i386/code16.s @@ -2,8 +2,8 @@ .code16 rep; movsd rep; cmpsd - rep movsd %ds:(%si),%es:(%di) - rep cmpsd %es:(%di),%ds:(%si) + rep movsl %ds:(%si),%es:(%di) + rep cmpsl %es:(%di),%ds:(%si) mov %cr2, %ecx mov %ecx, %cr2 --- a/gas/testsuite/gas/i386/intel16.d +++ b/gas/testsuite/gas/i386/intel16.d @@ -20,4 +20,12 @@ Disassembly of section .text: 2c: 8d 02 [ ]*lea \(%bp,%si\),%ax 2e: 8d 01 [ ]*lea \(%bx,%di\),%ax 30: 8d 03 [ ]*lea \(%bp,%di\),%ax - ... +[ ]*[0-9a-f]+: 67 f7 13[ ]+notw[ ]+\(%ebx\) +[ ]*[0-9a-f]+: 66 f7 17[ ]+notl[ ]+\(%bx\) +[ ]*[0-9a-f]+: 67 0f 1f 03[ ]+nopw[ ]+\(%ebx\) +[ ]*[0-9a-f]+: 66 0f 1f 07[ ]+nopl[ ]+\(%bx\) +[ ]*[0-9a-f]+: 67 83 03 05[ ]+addw[ ]+\$0x5,\(%ebx\) +[ ]*[0-9a-f]+: 66 83 07 05[ ]+addl[ ]+\$0x5,\(%bx\) +[ ]*[0-9a-f]+: 67 c7 03 05 00[ ]+movw[ ]+\$0x5,\(%ebx\) +[ ]*[0-9a-f]+: 66 c7 07 05 00 00 00[ ]+movl[ ]+\$0x5,\(%bx\) +#pass --- a/gas/testsuite/gas/i386/intel16.s +++ b/gas/testsuite/gas/i386/intel16.s @@ -18,4 +18,14 @@ lea ax, [di][bx] lea ax, [di][bp] - .p2align 4,0 + notw [ebx] + notd [bx] + + nopw [ebx] + nopd [bx] + + addw [ebx], 5 + addd [bx], 5 + + movw [ebx], 5 + movd [bx], 5 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -135,34 +135,27 @@ mov, 0xa0, None, CpuNo64, D|W|No_sSuf|No_qSuf|No_ldSuf, { Disp16|Disp32|Unspecified|Byte|Word|Dword, Acc|Byte|Word|Dword } mov, 0xa0, None, Cpu64, D|W|No_sSuf|No_ldSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } movabs, 0xa0, None, Cpu64, D|W|No_sSuf|No_ldSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } -movq, 0xa1, None, Cpu64, D|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Disp64|Unspecified|Qword, Acc|Qword } mov, 0x88, None, 0, D|W|CheckRegSize|Modrm|No_sSuf|No_ldSuf|HLEPrefixRelease, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0x89, None, Cpu64, D|Modrm|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|HLEPrefixRelease, { Reg64, Reg64|Unspecified|Qword|BaseIndex } // In the 64bit mode the short form mov immediate is redefined to have // 64bit value. mov, 0xb0, None, 0, W|No_sSuf|No_qSuf|No_ldSuf, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32 } mov, 0xc6, 0, 0, W|Modrm|No_sSuf|No_ldSuf|HLEPrefixRelease|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0xc7, 0, Cpu64, Modrm|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|HLEPrefixRelease|Optimize, { Imm32S, Reg64|Qword|Unspecified|BaseIndex } mov, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|Optimize, { Imm64, Reg64 } movabs, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf, { Imm64, Reg64 } -movq, 0xb8, None, Cpu64, Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Optimize, { Imm64, Reg64 } // The segment register moves accept WordReg so that a segment register // can be copied to a 32 bit register, and vice versa, without using a // size prefix. When moving to a 32 bit register, the upper 16 bits // are set to an implementation defined value (on the Pentium Pro, the // implementation defined value is zero). -mov, 0x8c, None, 0, RegMem|No_bSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { SReg, Reg16|Reg32|Reg64 } +mov, 0x8c, None, 0, RegMem|No_bSuf|No_sSuf|No_ldSuf|NoRex64, { SReg, Reg16|Reg32|Reg64 } mov, 0x8c, None, 0, D|Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { SReg, Word|Unspecified|BaseIndex } -movq, 0x8c, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { SReg, Reg64 } -mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } +mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_ldSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } // Move to/from control debug registers. In the 16 or 32bit modes // they are 32bit. In the 64bit mode they are 64bit. mov, 0xf20, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Control, Reg32 } mov, 0xf20, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Control, Reg64 } -movq, 0xf20, None, Cpu64, D|RegMem|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Control, Reg64 } mov, 0xf21, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Debug, Reg32 } mov, 0xf21, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Debug, Reg64 } -movq, 0xf21, None, Cpu64, D|RegMem|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Debug, Reg64 } mov, 0xf24, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Test, Reg32 } // Move after swapping the bytes @@ -492,9 +485,6 @@ set, 0xf9, 0, Cpu386, Modrm| // String manipulation. cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string compare. -cmpsd, 0xa7, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -cmpsd, 0xa7, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} @@ -509,9 +499,6 @@ slod, 0xac, None, 0, W|No_sSuf|No_ldSuf| slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string move. -movsd, 0xa5, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -movsd, 0xa5, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} @@ -993,6 +980,7 @@ movd, 0x666e, None, CpuAVX, D|Modrm|Vex1 movd, 0x666e, None, CpuAVX|Cpu64, D|Modrm|Vex=1|Space0F|VexW1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64|SSE2AVX, { Reg64|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2, D|Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|BaseIndex, RegXMM } +// The MMX templates have to remain after at least the SSE2AVX ones. movd, 0xf6e, None, CpuMMX, D|Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, RegMMX } movd, 0xf6e, None, CpuMMX|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|BaseIndex, RegMMX } movq, 0xf37e, None, CpuAVX, Load|Modrm|Vex=1|Space0F|VexWIG|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } @@ -1001,6 +989,7 @@ movq, 0x666e, None, CpuAVX|Cpu64, D|Modr movq, 0xf30f7e, None, CpuSSE2, Load|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Unspecified|Qword|BaseIndex|RegXMM, RegXMM } movq, 0x660fd6, None, CpuSSE2, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { RegXMM, Unspecified|Qword|BaseIndex|RegXMM } movq, 0x660f6e, None, CpuSSE2|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|Unspecified|BaseIndex, RegXMM } +// The MMX templates have to remain after at least the SSE2AVX ones. movq, 0xf6f, None, CpuMMX, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Unspecified|Qword|BaseIndex|RegMMX, RegMMX } movq, 0xf6e, None, CpuMMX|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|Unspecified|BaseIndex, RegMMX } packssdw, 0x0f6b, None, , Modrm||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { ||Unspecified|BaseIndex, } From patchwork Fri Nov 4 10:52:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp317521wru; Fri, 4 Nov 2022 03:52:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dbwteKgXj0p45ncKiVgrnCDcVLsiBWDGKnF1EtQoG/Qn772BaI5lvDTrl1rf5OHPCV1zz X-Received: by 2002:a17:906:4917:b0:7ad:f9d6:9435 with SMTP id b23-20020a170906491700b007adf9d69435mr15678279ejq.238.1667559148575; Fri, 04 Nov 2022 03:52:28 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g3-20020a1709065d0300b0076f0940cb28si2696835ejt.175.2022.11.04.03.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:52:28 -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="i8xCj/uY"; 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 2089F385802D for ; Fri, 4 Nov 2022 10:52:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2089F385802D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559142; bh=Jr+W0lUPrJfIROURZVyISsgHZKalDVOpZYhFy/6jvgY=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=i8xCj/uYatzGvu4Y3iHQXxU1irAHCN0m0qcjx9c+sJhGhGB1N3eTaA+V6PMeC/v44 lDAAMa1RD6PsRJCuIAsp3cb1RQn7R6KlVMKaXpPw11USY22MLG3iBN7RI9fhMAQPO9 RsiVi2LB7DWxaE90UA9DX6atwjKJVTssO1Pkj5nI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) by sourceware.org (Postfix) with ESMTPS id 27779385801F for ; Fri, 4 Nov 2022 10:52:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 27779385801F ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCY8Zv/KKU4j3wnq9gUrlihHyUeLQVla9YPA7YBiWwf5SXWJEToXA8Q018wk1BEBOH6c3YrluUce3/1F649c2iCCkJUN3CT6Xckb1ZPKW+unI1gGtB5fTetE9J5jMoEfTqwC8NI9gKW2C4/unNXaU/4Uels6LAGLGbnkj6yVlEcvf7o09fGaKRpZhyqi+y575AGGwIAw+bohpW/htdka9+tM6LpG/UlkZGch5qToqaS7/D2306z41jN4y/ufLxO33Sg8YecCpLK+9zJxxaAcSuYOtSZ7SNXuwmjlmXuhe9AUMVMTz61gg2iQflvTVz3+pOHR4z4ak4j4wE8kuFuo1w== 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=Jr+W0lUPrJfIROURZVyISsgHZKalDVOpZYhFy/6jvgY=; b=MhqUdyrTAqpMhL4+XoCalahr9oN+8OoQLHeZGS9ISUBIDtEDZ5x++YxZ3uAyPSBqVIqYZdHyLDysPWprol1rsBo0b7bKfEqIM0qPf4V84+npPvkU2O6t1ljUIwSYgnMlsuPi0EAxw24igO+8Ps9ghnxVtuZKGIy5r5opCOctNGiuOhNN39QFj7by/11wZ0ek5bMzTOwSVjM1RceG1HXo1+Uj/TEWIfxVzLIhhLbLKu7keJXNK+K6ZTSq+U7FjFyVOvdYG6hT69anEx/Hiklq+M/IOk2a6EBCHfOhgfI1ahioyubE0Tu+lgnOrqF4/orAJwzrbqqqDPmwF8HLFMXMgw== 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 DB9PR04MB8378.eurprd04.prod.outlook.com (2603:10a6:10:25f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 10:52:04 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:52:04 +0000 Message-ID: Date: Fri, 4 Nov 2022 11:52:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 3/7] ix86: don't recognize/derive Q suffix in the common case Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: AS9PR07CA0003.eurprd07.prod.outlook.com (2603:10a6:20b:46c::16) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8378:EE_ X-MS-Office365-Filtering-Correlation-Id: e82a965f-d9ed-4515-a2f4-08dabe529c3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7hNVaZhTAVphSpNAKbzvStBbZMmGEsNFjjmAvN/iDCepHhzcMwsQjD6RZJweWhrfWjAiJTbF9xdHECy0RfDp8067nCRP6z4SUjRN+3D4dOi6dR8xtW2ensBk09A78uKjebWJUTKjAVuRRHQe3cdhPESyYMaPv0lQEBbp3ZryMxsnDfWzkvvenfV8PcDzp/5P+mDU0l93DvNHnh14jOeod4unH0jijB61mcfxSrlAlVjhbM80w9/02OQ08kE0KJPbXKDyNyD85cnbmrSrLJQqsMbmv/bVC1OYvhexOkt5Jf8kH/H3YhG5z/6RjyGF66OB9FYeNr0SvCUu2DfbumTplN6Uadj1NPDt/VlCVwYrkPVqzZ+1Plcg463DvQLgelVLmHTGdI+PuupUtgAUT21T4CecBOF7XtfSwyreKloawknM2R+vRdM0nObxh4miGj0Mq7gEH/zwJTf8cFqDvo7UNpB77/RlRwb6QCavfgxq32ortLPCxZIOiiBYpdQLVjW3XBFQeMGyhWudVVg5df0jGFVq6vBrGet5ECCrEI65ApJTBoUszxU9Ify0QJX4LiLKFrRSbBH26kngF8vo14Yj8wTWQrSpQmggZARMQAEiTvcFlv9q5WbuYStWjCtTcYm7z+A0JS8HNYNx1Xmw90BE2bOEinP5+9PHEg8Zcd24C0aA6u7SLnZrAD0vwYE4AQ6n+uNNx9YTNQjWUMK3P9d+eiZvOWdMFTl2ZZNMgwroCi13UnaPEC14Ps/6EJIvZxKoBhH7uEwuLZTTfli+RmeJoS9uuwkQEe2b0CKNNecGNCk= 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)(346002)(366004)(39860400002)(136003)(396003)(376002)(451199015)(36756003)(31696002)(86362001)(31686004)(83380400001)(38100700002)(186003)(6486002)(478600001)(6512007)(6506007)(26005)(66476007)(8936002)(316002)(41300700001)(66946007)(8676002)(2906002)(66556008)(4326008)(30864003)(6916009)(5660300002)(2616005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ClR6z/VTX3w7Q08Gp1jRJPXi+zIA?= =?utf-8?q?W8Pr3VaXavi7zoqjFlFzLaAsw3qnAtq4MyvbNHbm/Zj0MWAnHqxxFOTr/02LDQ9PI?= =?utf-8?q?xCJSDFjncBzpPhLRrQPw/lSKhAT18ig5pZtfeiC3Iiha0Tr1dBRMnk4eYRZJLOx2c?= =?utf-8?q?9bYmyLEDUsj6UbgZ+ZxAumqgxdwmXXDl2lbYairGGEzFcj/Zyuu2Nc4hmQtT+E6ZQ?= =?utf-8?q?3lM9IGmS0vlclkWO0bKGDqCSOLuhltvjiOImeQTDJEfsVLdEp5K+pPfivrqsdwsvi?= =?utf-8?q?rAHj90hLvzrSzRcbHzSjgODBOGy53JmVrD5GSKGB0iZoD4A3P0q9s4N3lmvbkYgEe?= =?utf-8?q?fIzpBTlj0swfEeJHSVKxRt51Blv/c85J8TjnqzPttqzNdQdVh+KulcA5Hkdkj91U5?= =?utf-8?q?iCxcH//9FSxRtcSZMdCaSLFTJZnfzPXttMMV2UAenVB0U42uWexm4mOHwrkMkI/vP?= =?utf-8?q?YqNDb64INEONVP5hwhcweOCCsn/uVBy5jQXwoWpULXNOENR9RVW0ElCouh3Qxd2FV?= =?utf-8?q?Zhe898EaD5ax2zJZuC+MWk4yi7c/PNZZzkDiRE04sau+QaXPvtJsYuRNQ4VOqROe+?= =?utf-8?q?Kkwk+f7DPkSW1Y9PpymuDB7JqzYGY9W6PWESSW+gbt6NF3LTPOULKtr9n7hmPkPtU?= =?utf-8?q?oU5Z7Rj9tUwSORoGIL6zxfCumKaaoM3pNsbf3Xn4F6iNaW0n3csSDzA/GmuckwQbt?= =?utf-8?q?z7CR+bhhWwZt3wNmmZ8u6BGCzHIe/Px0hClKMiPPa9B0IQzaD1aii1k5clSp5gdmf?= =?utf-8?q?/0/i67H8gVI8V0o8wBLgdgP5KGxvVQgfo4x6wxJJCZJMXDicCXHMfMNXY7Gm3xEMG?= =?utf-8?q?1b/SE5MDjrSkeDu6WLJ7i9HiRZWsW+Wr13XQhAnmLTvKjBoCFzODPf+gVg64Ty9zF?= =?utf-8?q?sZujfLL9gw0D70EezQCUv513QHpg4Wydvz+JPH6x0wgpAFiyDTrcRjS6OI5gkrndc?= =?utf-8?q?Q8xGZF8ADtHREB/SLt6hf0bwUfr7o7/jYjWqwaI2aoP5D+wlOT4cCPt2G70fQ1Gfx?= =?utf-8?q?cs712bZOe7pdnY3s1+ZOnnh5yn5rn2SBWMWbw6k6Qdg+sqgbKC90+b5xcrnonckTN?= =?utf-8?q?B2uga4y0VinVEdZngxozBeq7+xQMXd3VKo5wIXItJZiDU+CHSPRd14ovgI86Q6LCQ?= =?utf-8?q?LTapUoxnfph+wwqycY6LiyotBL8irjQmD7371tGGLPmjGRBp2MZJq4pV5PfsBUXsq?= =?utf-8?q?BS8SOrwJ1xnA7boWw+o9W8vRUPenqBJfMgKdm7onqGHNsHIRIUSM+I0xjzZvj5FgT?= =?utf-8?q?rnsooLNalThqPaoRrrIKz4kOHIo0ypqk1QPxYqG4kIJckSEbOnndImQpzUgBs7ioP?= =?utf-8?q?/fOCL5goT3AsFJgucz/x99lXl4vREHdngN+tVlI6EixjizAAW2oFLcmSri2r2f3Ed?= =?utf-8?q?VnvLrINkyjB/g+1XIPn0zPa1INj2Mj1ugW3YVAPQXu0Y47KT6yny+cG56JxBQIBbv?= =?utf-8?q?eed/FhTx7xo3CVeBjWRz8fDknJdmESlXb4NgU6Zvs22YRWTyYFl3yOQ+EzM+QrNWR?= =?utf-8?q?hUNRuZxYH8ni?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e82a965f-d9ed-4515-a2f4-08dabe529c3c X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:52:04.5567 (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: Es7QzkfJ1SabM+gW8RiugaHAcdKRtP8MMsd2xIwxJ1r/zHSu4KDeIyXi2OzddamvnxKR3/3HH0UBzj+Q15yphg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8378 X-Spam-Status: No, score=-3029.5 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 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?1748562502170914673?= X-GMAIL-MSGID: =?utf-8?q?1748562502170914673?= Have its use, except where actually legitimate, result in the same "only supported in 64-bit mode" diagnostic as emitted for other 64-bit only insns. Also suppress deriving of the suffix in Intel mode except in the legitimate cases. This in exchange allows dropping the respective code from match_template(). To maintain reasonable diagnostics (in particular to avoid "`mov' is only supported in 64-bit mode" on the SIMD forms of MOVQ) we need to defer parse_insn()'s emitting of errors unrelated to prefix parsing. Utilize i.error just like match_template() does. Oddly enough despite gcc's preference towards FILDQ and FIST{,T}Q we had no testcase whatsoever for these. Therefore such tests are being added. Note that the removed line in the x86-64-lfence-load testcase was redundant with the exact same one a few lines up. --- With gcc's preference towards FILDQ / FIST{,T}Q I wonder whether the disassembler wouldn't better emit a Q suffix instead of the LL one. --- v6: Re-base over dropping of Pass2 attribute. v5: Re-base over re-arrangment of patch series, requiring pieces to be moved here. v3: Re-base over changes to earlier patches. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -236,6 +236,8 @@ enum i386_error unsupported_with_intel_mnemonic, unsupported_syntax, unsupported, + unsupported_on_arch, + unsupported_64bit, invalid_sib_address, invalid_vsib_address, invalid_vector_register_set, @@ -4855,7 +4857,7 @@ void md_assemble (char *line) { unsigned int j; - char mnemonic[MAX_MNEM_SIZE], mnem_suffix, *copy = NULL; + char mnemonic[MAX_MNEM_SIZE], mnem_suffix = 0, *copy = NULL; const char *end, *pass1_mnem = NULL; enum i386_error pass1_err = 0; const insn_template *t; @@ -4880,6 +4882,16 @@ md_assemble (char *line) { if (pass1_mnem != NULL) goto match_error; + if (i.error != no_error) + { + gas_assert (current_templates != NULL); + if (may_need_pass2 (current_templates->start) && !i.suffix) + goto no_match; + /* No point in trying a 2nd pass - it'll only find the same suffix + again. */ + mnem_suffix = i.suffix; + goto match_error; + } return; } if (may_need_pass2 (current_templates->start)) @@ -4979,12 +4991,21 @@ md_assemble (char *line) { line = copy; copy = NULL; + no_match: pass1_err = i.error; pass1_mnem = current_templates->start->name; goto retry; } - free (copy); + + /* If a non-/only-64bit template (group) was found in pass 1, and if + _some_ template (group) was found in pass 2, squash pass 1's + error. */ + if (pass1_err == unsupported_64bit) + pass1_mnem = NULL; + match_error: + free (copy); + switch (pass1_mnem ? pass1_err : i.error) { default: @@ -5017,6 +5038,23 @@ md_assemble (char *line) as_bad (_("unsupported instruction `%s'"), pass1_mnem ? pass1_mnem : current_templates->start->name); return; + case unsupported_on_arch: + as_bad (_("`%s' is not supported on `%s%s'"), + pass1_mnem ? pass1_mnem : current_templates->start->name, + cpu_arch_name ? cpu_arch_name : default_arch, + cpu_sub_arch_name ? cpu_sub_arch_name : ""); + return; + case unsupported_64bit: + if (ISLOWER (mnem_suffix)) + as_bad (_("`%s%c' is %s supported in 64-bit mode"), + pass1_mnem ? pass1_mnem : current_templates->start->name, + mnem_suffix, + flag_code == CODE_64BIT ? _("not") : _("only")); + else + as_bad (_("`%s' is %s supported in 64-bit mode"), + pass1_mnem ? pass1_mnem : current_templates->start->name, + flag_code == CODE_64BIT ? _("not") : _("only")); + return; case invalid_sib_address: err_msg = _("invalid SIB address"); break; @@ -5363,6 +5401,23 @@ md_assemble (char *line) last_insn.kind = last_insn_other; } +/* The Q suffix is generally valid only in 64-bit mode, with very few + exceptions: fild, fistp, fisttp, and cmpxchg8b. Note that for fild + and fisttp only one of their two templates is matched below: That's + sufficient since other relevant attributes are the same between both + respective templates. */ +static INLINE bool q_suffix_allowed(const insn_template *t) +{ + return flag_code == CODE_64BIT + || (t->opcode_modifier.opcodespace == SPACE_BASE + && t->base_opcode == 0xdf + && (t->extension_opcode & 1)) /* fild / fistp / fisttp */ + || (t->opcode_modifier.opcodespace == SPACE_0F + && t->base_opcode == 0xc7 + && t->opcode_modifier.opcodeprefix == PREFIX_NONE + && t->extension_opcode == 1) /* cmpxchg8b */; +} + static const char * parse_insn (const char *line, char *mnemonic) { @@ -5658,20 +5713,21 @@ parse_insn (const char *line, char *mnem for (t = current_templates->start; t < current_templates->end; ++t) { supported |= cpu_flags_match (t); + + if (i.suffix == QWORD_MNEM_SUFFIX && !q_suffix_allowed (t)) + supported &= ~CPU_FLAGS_64BIT_MATCH; + if (supported == CPU_FLAGS_PERFECT_MATCH) return l; } - if (!(supported & CPU_FLAGS_64BIT_MATCH)) - as_bad (flag_code == CODE_64BIT - ? _("`%s' is not supported in 64-bit mode") - : _("`%s' is only supported in 64-bit mode"), - current_templates->start->name); - else - as_bad (_("`%s' is not supported on `%s%s'"), - current_templates->start->name, - cpu_arch_name ? cpu_arch_name : default_arch, - cpu_sub_arch_name ? cpu_sub_arch_name : ""); + if (pass1) + { + if (supported & CPU_FLAGS_64BIT_MATCH) + i.error = unsupported_on_arch; + else + i.error = unsupported_64bit; + } return NULL; } @@ -6690,20 +6746,12 @@ match_template (char mnem_suffix) for (j = 0; j < MAX_OPERANDS; j++) operand_types[j] = t->operand_types[j]; - /* In general, don't allow - - 64-bit operands outside of 64-bit mode, - - 32-bit operands on pre-386. */ + /* In general, don't allow 32-bit operands on pre-386. */ specific_error = progress (mnem_suffix ? invalid_instruction_suffix : operand_size_mismatch); j = i.imm_operands + (t->operands > i.imm_operands + 1); - if (((i.suffix == QWORD_MNEM_SUFFIX - && flag_code != CODE_64BIT - && !(t->opcode_modifier.opcodespace == SPACE_0F - && t->base_opcode == 0xc7 - && t->opcode_modifier.opcodeprefix == PREFIX_NONE - && t->extension_opcode == 1) /* cmpxchg8b */) - || (i.suffix == LONG_MNEM_SUFFIX - && !cpu_arch_flags.bitfield.cpui386)) + if (i.suffix == LONG_MNEM_SUFFIX + && !cpu_arch_flags.bitfield.cpui386 && (intel_syntax ? (t->opcode_modifier.mnemonicsize != IGNORESIZE && !intel_float_operand (t->name)) --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -824,7 +824,7 @@ i386_intel_operand (char *operand_string continue; break; case QWORD_MNEM_SUFFIX: - if (t->opcode_modifier.no_qsuf) + if (t->opcode_modifier.no_qsuf || !q_suffix_allowed (t)) continue; break; case SHORT_MNEM_SUFFIX: --- a/gas/testsuite/gas/i386/opcode.d +++ b/gas/testsuite/gas/i386/opcode.d @@ -592,6 +592,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnp -0x6f6f6f70\(%eax\),%edx [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovp -0x6f6f6f70\(%eax\),%dx [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnp -0x6f6f6f70\(%eax\),%dx +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[a-f0-9]+: 82 c3 01 add \$0x1,%bl +[a-f0-9]+: 82 f3 01 xor \$0x1,%bl +[a-f0-9]+: 82 d3 01 adc \$0x1,%bl --- a/gas/testsuite/gas/i386/opcode.s +++ b/gas/testsuite/gas/i386/opcode.s @@ -592,6 +592,11 @@ foo: cmovpe 0x90909090(%eax),%dx cmovpo 0x90909090(%eax),%dx + fildq (%eax) + fildll (%eax) + fistpq (%eax) + fistpll (%eax) + .byte 0x82, 0xc3, 0x01 .byte 0x82, 0xf3, 0x01 .byte 0x82, 0xd3, 0x01 --- a/gas/testsuite/gas/i386/opcode-intel.d +++ b/gas/testsuite/gas/i386/opcode-intel.d @@ -593,6 +593,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnp edx,DWORD PTR \[eax-0x6f6f6f70\] [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovp dx,WORD PTR \[eax-0x6f6f6f70\] [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnp dx,WORD PTR \[eax-0x6f6f6f70\] +[ ]*[a-f0-9]+: df 28 fild QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 28 fild QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 38 fistp QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 38 fistp QWORD PTR \[eax\] +[a-f0-9]+: 82 c3 01 add bl,0x1 +[a-f0-9]+: 82 f3 01 xor bl,0x1 +[a-f0-9]+: 82 d3 01 adc bl,0x1 --- a/gas/testsuite/gas/i386/opcode-suffix.d +++ b/gas/testsuite/gas/i386/opcode-suffix.d @@ -593,6 +593,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnpl -0x6f6f6f70\(%eax\),%edx [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovpw -0x6f6f6f70\(%eax\),%dx [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnpw -0x6f6f6f70\(%eax\),%dx +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[a-f0-9]+: 82 c3 01 addb \$0x1,%bl +[a-f0-9]+: 82 f3 01 xorb \$0x1,%bl +[a-f0-9]+: 82 d3 01 adcb \$0x1,%bl --- a/gas/testsuite/gas/i386/sse3.d +++ b/gas/testsuite/gas/i386/sse3.d @@ -13,29 +13,30 @@ Disassembly of section .text: 10: df 88 90 90 90 90 [ ]*fisttps -0x6f6f6f70\(%eax\) 16: db 88 90 90 90 90 [ ]*fisttpl -0x6f6f6f70\(%eax\) 1c: dd 88 90 90 90 90 [ ]*fisttpll -0x6f6f6f70\(%eax\) - 22: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%ebp\),%xmm4 - 27: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 - 2b: f2 0f 7c 37 [ ]*haddps \(%edi\),%xmm6 - 2f: f2 0f 7c f8 [ ]*haddps %xmm0,%xmm7 - 33: 66 0f 7d c1 [ ]*hsubpd %xmm1,%xmm0 - 37: 66 0f 7d 0a [ ]*hsubpd \(%edx\),%xmm1 - 3b: f2 0f 7d d2 [ ]*hsubps %xmm2,%xmm2 - 3f: f2 0f 7d 1c 24 [ ]*hsubps \(%esp\),%xmm3 - 44: f2 0f f0 2e [ ]*lddqu \(%esi\),%xmm5 - 48: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx - 4b: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx - 4e: f2 0f 12 f7 [ ]*movddup %xmm7,%xmm6 - 52: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 - 56: f3 0f 16 01 [ ]*movshdup \(%ecx\),%xmm0 - 5a: f3 0f 16 ca [ ]*movshdup %xmm2,%xmm1 - 5e: f3 0f 12 13 [ ]*movsldup \(%ebx\),%xmm2 - 62: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 - 66: 0f 01 c9 [ ]*mwait %eax,%ecx - 69: 0f 01 c9 [ ]*mwait %eax,%ecx - 6c: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx - 70: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx - 74: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 - 78: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: dd 88 90 90 90 90 [ ]*fisttpll -0x6f6f6f70\(%eax\) +[ ]*[0-9a-f]+: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%ebp\),%xmm4 +[ ]*[0-9a-f]+: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 +[ ]*[0-9a-f]+: f2 0f 7c 37 [ ]*haddps \(%edi\),%xmm6 +[ ]*[0-9a-f]+: f2 0f 7c f8 [ ]*haddps %xmm0,%xmm7 +[ ]*[0-9a-f]+: 66 0f 7d c1 [ ]*hsubpd %xmm1,%xmm0 +[ ]*[0-9a-f]+: 66 0f 7d 0a [ ]*hsubpd \(%edx\),%xmm1 +[ ]*[0-9a-f]+: f2 0f 7d d2 [ ]*hsubps %xmm2,%xmm2 +[ ]*[0-9a-f]+: f2 0f 7d 1c 24 [ ]*hsubps \(%esp\),%xmm3 +[ ]*[0-9a-f]+: f2 0f f0 2e [ ]*lddqu \(%esi\),%xmm5 +[ ]*[0-9a-f]+: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx +[ ]*[0-9a-f]+: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx +[ ]*[0-9a-f]+: f2 0f 12 f7 [ ]*movddup %xmm7,%xmm6 +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: f3 0f 16 01 [ ]*movshdup \(%ecx\),%xmm0 +[ ]*[0-9a-f]+: f3 0f 16 ca [ ]*movshdup %xmm2,%xmm1 +[ ]*[0-9a-f]+: f3 0f 12 13 [ ]*movsldup \(%ebx\),%xmm2 +[ ]*[0-9a-f]+: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 +[ ]*[0-9a-f]+: 0f 01 c9 [ ]*mwait %eax,%ecx +[ ]*[0-9a-f]+: 0f 01 c9 [ ]*mwait %eax,%ecx +[ ]*[0-9a-f]+: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx +[ ]*[0-9a-f]+: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 [ ]*[0-9a-f]+: 0f 01 c8[ ]+monitor %eax,%ecx,%edx [ ]*[0-9a-f]+: 67 0f 01 c8[ ]+monitor %ax,%ecx,%edx [ ]*[0-9a-f]+: 0f 01 c9[ ]+mwait %eax,%ecx --- a/gas/testsuite/gas/i386/sse3.s +++ b/gas/testsuite/gas/i386/sse3.s @@ -8,6 +8,7 @@ foo: addsubps %xmm4,%xmm3 fisttps 0x90909090(%eax) fisttpl 0x90909090(%eax) + fisttpq 0x90909090(%eax) fisttpll 0x90909090(%eax) haddpd 0x0(%ebp),%xmm4 haddpd %xmm6,%xmm5 --- a/gas/testsuite/gas/i386/sse3-intel.d +++ b/gas/testsuite/gas/i386/sse3-intel.d @@ -14,6 +14,7 @@ Disassembly of section .text: [ ]*[0-9a-f]+: df 88 90 90 90 90[ ]+fisttp WORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: db 88 90 90 90 90[ ]+fisttp DWORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: dd 88 90 90 90 90[ ]+fisttp QWORD PTR \[eax-0x6f6f6f70\] +[ ]*[0-9a-f]+: dd 88 90 90 90 90[ ]+fisttp QWORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: 66 0f 7c 65 00[ ]+haddpd xmm4,(XMMWORD PTR )?\[ebp(\+0x0)\] [ ]*[0-9a-f]+: 66 0f 7c ee[ ]+haddpd xmm5,xmm6 [ ]*[0-9a-f]+: f2 0f 7c 37[ ]+haddps xmm6,(XMMWORD PTR )?\[edi\] --- a/gas/testsuite/gas/i386/x86-64-lfence-load.d +++ b/gas/testsuite/gas/i386/x86-64-lfence-load.d @@ -46,16 +46,21 @@ Disassembly of section .text: +[a-f0-9]+: 0f ae e8 lfence +[a-f0-9]+: db 55 00 fistl 0x0\(%rbp\) +[a-f0-9]+: df 55 00 fists 0x0\(%rbp\) + +[a-f0-9]+: db 5d 00 fistpl 0x0\(%rbp\) + +[a-f0-9]+: df 5d 00 fistps 0x0\(%rbp\) + +[a-f0-9]+: df 7d 00 fistpll 0x0\(%rbp\) +[a-f0-9]+: db 45 00 fildl 0x0\(%rbp\) +[a-f0-9]+: 0f ae e8 lfence +[a-f0-9]+: df 45 00 filds 0x0\(%rbp\) +[a-f0-9]+: 0f ae e8 lfence + +[a-f0-9]+: df 6d 00 fildll 0x0\(%rbp\) + +[a-f0-9]+: 0f ae e8 lfence +[a-f0-9]+: 9b dd 75 00 fsave 0x0\(%rbp\) +[a-f0-9]+: dd 65 00 frstor 0x0\(%rbp\) +[a-f0-9]+: 0f ae e8 lfence - +[a-f0-9]+: df 45 00 filds 0x0\(%rbp\) - +[a-f0-9]+: 0f ae e8 lfence + +[a-f0-9]+: db 4d 00 fisttpl 0x0\(%rbp\) +[a-f0-9]+: df 4d 00 fisttps 0x0\(%rbp\) + +[a-f0-9]+: dd 4d 00 fisttpll 0x0\(%rbp\) +[a-f0-9]+: d9 65 00 fldenv 0x0\(%rbp\) +[a-f0-9]+: 0f ae e8 lfence +[a-f0-9]+: 9b d9 75 00 fstenv 0x0\(%rbp\) --- a/gas/testsuite/gas/i386/x86-64-lfence-load.s +++ b/gas/testsuite/gas/i386/x86-64-lfence-load.s @@ -29,12 +29,17 @@ _start: flds (%rbp) fistl (%rbp) fists (%rbp) + fistpl (%rbp) + fistps (%rbp) + fistpq (%rbp) fildl (%rbp) filds (%rbp) + fildq (%rbp) fsave (%rbp) frstor (%rbp) - filds (%rbp) + fisttpl (%rbp) fisttps (%rbp) + fisttpq (%rbp) fldenv (%rbp) fstenv (%rbp) fadds (%rbp) --- a/gas/testsuite/gas/i386/x86-64-sse3.d +++ b/gas/testsuite/gas/i386/x86-64-sse3.d @@ -13,6 +13,7 @@ Disassembly of section .text: [ ]*[a-f0-9]+: df 88 90 90 90 00 [ ]*fisttps 0x909090\(%rax\) [ ]*[a-f0-9]+: db 88 90 90 90 00 [ ]*fisttpl 0x909090\(%rax\) [ ]*[a-f0-9]+: dd 88 90 90 90 00 [ ]*fisttpll 0x909090\(%rax\) +[ ]*[a-f0-9]+: dd 88 90 90 90 00 [ ]*fisttpll 0x909090\(%rax\) [ ]*[a-f0-9]+: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%rbp\),%xmm4 [ ]*[a-f0-9]+: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 [ ]*[a-f0-9]+: f2 0f 7c 37 [ ]*haddps \(%rdi\),%xmm6 --- a/gas/testsuite/gas/i386/x86-64-sse3.s +++ b/gas/testsuite/gas/i386/x86-64-sse3.s @@ -8,6 +8,7 @@ foo: addsubps %xmm4,%xmm3 fisttps 0x909090(%rax) fisttpl 0x909090(%rax) + fisttpq 0x909090(%rax) fisttpll 0x909090(%rax) haddpd 0x0(%rbp),%xmm4 haddpd %xmm6,%xmm5 --- a/gas/testsuite/gas/i386/x86-64-sse3-intel.d +++ b/gas/testsuite/gas/i386/x86-64-sse3-intel.d @@ -14,6 +14,7 @@ Disassembly of section .text: [ ]*[a-f0-9]+: df 88 90 90 90 00[ ]+fisttp WORD PTR \[rax\+0x909090\] [ ]*[a-f0-9]+: db 88 90 90 90 00[ ]+fisttp DWORD PTR \[rax\+0x909090\] [ ]*[a-f0-9]+: dd 88 90 90 90 00[ ]+fisttp QWORD PTR \[rax\+0x909090\] +[ ]*[a-f0-9]+: dd 88 90 90 90 00[ ]+fisttp QWORD PTR \[rax\+0x909090\] [ ]*[a-f0-9]+: 66 0f 7c 65 00[ ]+haddpd xmm4,(XMMWORD PTR )?\[rbp(\+0x0)\] [ ]*[a-f0-9]+: 66 0f 7c ee[ ]+haddpd xmm5,xmm6 [ ]*[a-f0-9]+: f2 0f 7c 37[ ]+haddps xmm6,(XMMWORD PTR )?\[rdi\] From patchwork Fri Nov 4 10:52:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318016wru; Fri, 4 Nov 2022 03:53:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qshi0oGUlwr8CG7MD3FYPvUUY3micTYF/ouYWqIajP9ldWp/k+XskeeLxnVEujre1vW7/ X-Received: by 2002:a17:906:6a1b:b0:7ad:ba1e:879b with SMTP id qw27-20020a1709066a1b00b007adba1e879bmr30622910ejc.311.1667559223659; Fri, 04 Nov 2022 03:53:43 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x2-20020a05640225c200b0045a1e2373dbsi4369717edb.44.2022.11.04.03.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:53:43 -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="FgeLA/rE"; 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 2628B3858027 for ; Fri, 4 Nov 2022 10:53:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2628B3858027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559213; bh=CFpsqw0CyueuogK3wRKwChsU/YAdjJfeNlKPkt5YrpI=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FgeLA/rEIDvdWkM7VfMxMS/UHtBTj7RNdq1Jkxd+LRXyoQE/NydpWvp4YaYhm2yWM /hIyVojiUfyt1c0parMpz2ZupnahZppnGCHWly5yhBtSG0crEj17iN/iA5FCn8ZgyA 04+hIbhRFRRm0jGiY1qGBwpfGoN0KrjxOU2LDbIY= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by sourceware.org (Postfix) with ESMTPS id 018E13857BA3 for ; Fri, 4 Nov 2022 10:52:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 018E13857BA3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SvQF9M0NYYdeklYdzisNNe76TiosalqJtTwXg9SIHSV7o9Umho1lV3VPF9pysEkflrtrllBZVdm4lB2ke230T6pLpB8FG59C071Dl8kBDsJEjeaOjjRphTzI6ymVI9A0ir0pUFCyLBp1i98FoNAma9p3YnFgMu9VNF3qsNFD0CwyOAd99WJKsUmizKRudFFoagEN3cYQsU+eSEI4alqlqsrT4HlmJtvV9wcSF2ckbeiZEx3Jhen62pvxkg439+DkfqR+28e3l3ewMXc3EU+d+EmidwXp98erF6kLOajwlTzshMPditAHvb+bWqhPYvvHblppqHxTVqdwmIErE6knpg== 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=CFpsqw0CyueuogK3wRKwChsU/YAdjJfeNlKPkt5YrpI=; b=iiOUWeLPsGWUIGCkXbC5EqWi6XQm9Sop+BUD2OXgbMxCndeDcaCjD0lMufZLLaN8Gp9oJiccqlPOwD9f2PcrCYXXN8k/FgAFtdf0xV/o1FPeHoOQwLbSkuxRp1KBWC7QIF5KgkmQrZEsQPtZ6uKJHl8JGd5o23Ebdx66ddrxrjKWvpv9gFmggbW9b8E/irwD3/c7UIr45uIuNL9h1m5R8Bwf9pKuWjRRwnzsSJDl9+Ywm1rX30P3NTvJLbStNX/Z2F12TRlCcHWo/ge6mXMBSpu57SwOtKJ/4teTANmnDriodE3xoY0QwT3PtsEzmbxfGDietd2IG52DtxkwH7bJwA== 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 DBAPR04MB7397.eurprd04.prod.outlook.com (2603:10a6:10:1a9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 10:52:34 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:52:33 +0000 Message-ID: <15ab2cf5-f1ac-e882-c415-6318f1bcc7f0@suse.com> Date: Fri, 4 Nov 2022 11:52:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 4/7] x86-64: allow HLE store of accumulator to absolute 32-bit address Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: AS9PR06CA0168.eurprd06.prod.outlook.com (2603:10a6:20b:45c::20) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DBAPR04MB7397:EE_ X-MS-Office365-Filtering-Correlation-Id: f2ef312f-361f-459b-43d4-08dabe52ad40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EUlOPDZihPJClbiPuGF0TGJ3cRetVRp8G6zOWfr95fL1D1MhyyHZtP1/z/gWSlZJCKTcgcFBHidJ1yyCiG53BWM1Ws02nrAR1U9dxKqLMKIoQkq1rQirw/Td0Y501andFstRGXKol6GKhzizLhARRaYBVRSsald5cVy9iodMzEzWNb7imsq1fWsf7q39YZkawSb51reR+E0c/zwIZurxe09qqJlO6Md6wEjT8vV0UcM8JuSZR95j9HKbhcbjpY0u1QCsQOzkQ2kBx5H95jihdzkh8Xj7v9oMBvbfYHNgsVDpb3BHE1m6I4d0QwWUBW/xH+8R52+rkLKSlkl09cxqSHxHY6G/ymY9R8O4tmnDxasLCrSUbuQeD8kZ/ef6I0Ab5PGw59o8JF/0+SFfxEK2eUn7Kn5Zb6qNSE6FhzZVkhROdWGIvUXVrNdNsj5vdhdV5Tf41F39m8L07Hfvk4xhQ3xkwkc2/z8tzBdbTVF0J39YFBnCTw5sUVWZIqSQV7FfV/QBjA1p187aBOIggu/CPOFp6nmE7KiD5sF4eNOgFZdZ30SgnVrBRBf6ZKvKV45wfzTJt/Zj+98OH6Bwd+/huIFgBwsh087kMBY+DeadVPa80pnYHWZermQthM+60Yloc6mET1JgmjcNP9odBqUn6u1EfwqL8hs4sWnS4uCzkDR2WvFjvHEiTZu1dVPDQe9/XDsqIBlOUP3b3hgXUmJyy9OH2NKz4Esy/Kv3ahnUiuZ3y/xqEmd3wnEww4YYJobTr46703M1ZNpx7IQQEN2Ry9W0GQOFyHiFbMYJirCELJE= 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)(366004)(346002)(136003)(39860400002)(376002)(396003)(451199015)(316002)(478600001)(6512007)(31696002)(86362001)(186003)(6486002)(26005)(83380400001)(6506007)(6916009)(2616005)(36756003)(2906002)(8676002)(8936002)(41300700001)(31686004)(38100700002)(4326008)(5660300002)(66946007)(66476007)(66556008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZGQEloVVaSGgOB5yyJS/H1MMMSLl?= =?utf-8?q?1AcXbWza2vBXpWe7Yk3vUX+yYt+aCFr2OD9hZXHwMpoacq9XoA7DC6ICivxCjd7JT?= =?utf-8?q?oJco7NxXK85sMTbclYmTxN84S6CD/F1LIlQq8u9Wm0VMNa5MTBXmxA61WnX7i6Pd/?= =?utf-8?q?+qHcr1/cKWcysT1WwFe6TL4Qcb/v3ML1S68+vCvGFJDCGfq+JeTwZbRm5jWDZj/o4?= =?utf-8?q?GDKeUXDbDn5e2f+a4GgmPqRvE2QjLMOup6mijh32cEeB+dZzD0tVB8LKDLw11XJFf?= =?utf-8?q?6Lu5Rek4r/gMnXLAzVTQcAW6xQ8BVkF/162jp1nIEf6q/VNbLTqbASYzEnTv/CcrA?= =?utf-8?q?qXU3zB6UPd+Exq12bwC3FMPXWk7E3NYCyzQ3fVUBARuLucviNRlsfQZEtYBVFbjvL?= =?utf-8?q?quGsrMtZECNmgQIV9+zAUSPHi4zCnKJpuwcqYv9i+oLa4DhuGi4DdT7Qa9DtBsrYJ?= =?utf-8?q?Rgq2LrtlztmmM3qKOWzYHDyeapP6T5C7+REGYQi4FVu/MUFVBfg+wS5dzkRpig8gJ?= =?utf-8?q?pJ6WOF44j0Lx63ErlAm3YSM41WQ2I0MafK0okI004pcJsvD+7drwmMUi2R330jKwt?= =?utf-8?q?hBc+KOe7DT36Jag72A5nzsFGC2pwzzumHqnCWufhijvDdj/2NeA/sSeKkQ3f5l6Xm?= =?utf-8?q?EV+MlTtbmDWT/GRxxVWJzTs3tbkKiR9gB96MA39QOadHUYtEcWf8olLMRfY252GMR?= =?utf-8?q?QAhjj8+TJ3dhnir7hRDMn6jkBIqw4XT9hz9BY1e/6DgLtpAnWdNtj20c+AOjEGIWg?= =?utf-8?q?mA0KHn+AxkZ55JakYc0Bf7fxxnTTcyLP60z1GHBIy6F0UiUh0xu1yCLydmkqXL3D2?= =?utf-8?q?TMPMvDY12L7tLMu8rxQMv3WtVu1R7XpjW3jSxoPtLxWoK61uNl9yCc0YW5uWmXn/S?= =?utf-8?q?aSrC6yvV7kaqxwbZzzzfespKEo7zaZKxKmPbN3ELKmBHRco71xiaei/efew7ZvtXv?= =?utf-8?q?iMgEE6SZbwvhuxkIfRH7J78PsiExwyiqcRi4W/kOKucKFjTrxi9LqLCWCcDKejNvB?= =?utf-8?q?/de660XH7cgjPnr1cgKEo+Mta7n6GnoJtXRCV8m5LOEjttwUlR4OyPlmOFSrETm36?= =?utf-8?q?vTlthBZkxO1NmQLArJcBO4HQltK58n/J/+UbnAGtn33/Tjit4yw6wMFElfL5l8uAQ?= =?utf-8?q?PSWgIb1NN7rq+w4QRRdHkzrn6oOnC8Ki0NxRlPRvO9gg/0ZZ1TZ2t4AGCR+a53apW?= =?utf-8?q?krjk4j+cGxXeXsrg16x+ZiFqkQhJ9FVEEd1u0kyF0yrRBikJnqT/oypErdPLRUmH9?= =?utf-8?q?qEc8fkwJtbldj86HgXk7pYJFYP+m9MAqQ5yZQmvPbwCt7YG0a5a9gp3kK0tIxSUk9?= =?utf-8?q?9lyU6p+flSYYrbcIAcBtvbjiaXD6EosQQvYs82wFz2ASqYfLZbcAb+uJO/0kqfEKc?= =?utf-8?q?n/Xg7KKpngfUUk2GTAI0ZuE60cI5w4D7AuAY+99lBOaLm0hR6mGMC3xvdtnybCq6D?= =?utf-8?q?eDY+olhx3nnO5uZGN+FPo/sEnz49qaatssDiR9ovBl4o4aSa/4zHaGkCOix9mMnuk?= =?utf-8?q?F0XDFbJEFrLM?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2ef312f-361f-459b-43d4-08dabe52ad40 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:52:33.1018 (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: aDDEr5SB0mnoDP/BlkeXUg+JAToMFiLh9IZLl/bUHsmX7+wCGDDE7T1r3dvM/8taFXeEyrqT1xaK6b++JGZnog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7397 X-Spam-Status: No, score=-3029.5 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 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?1748562580581263468?= X-GMAIL-MSGID: =?utf-8?q?1748562580581263468?= In commit 1212781b35c9 ("ix86: allow HLE store of accumulator to absolute address") I was wrong to exclude 64-bit code. Dropping the check also leads to better diagnostics in 64-bit code ("MOV", after all, isn't invalid with "XRELEASE"). While there also limit the amount of further checks done: The operand type checks that were there were effectively redundant with other ones anyway, plus it's quite fine to also have "xrelease mov , %eax" look for the next MOV template (in fact again also improving diagnostics). --- v2: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6874,12 +6874,9 @@ match_template (char mnem_suffix) continue; /* xrelease mov %eax, is another special case. It must not match the accumulator-only encoding of mov. */ - if (flag_code != CODE_64BIT - && i.hle_prefix + if (i.hle_prefix && t->base_opcode == 0xa0 - && t->opcode_modifier.opcodespace == SPACE_BASE - && i.types[0].bitfield.instance == Accum - && (i.flags[1] & Operand_Mem)) + && t->opcode_modifier.opcodespace == SPACE_BASE) continue; /* Fall through. */ --- a/gas/testsuite/gas/i386/x86-64-hle.d +++ b/gas/testsuite/gas/i386/x86-64-hle.d @@ -424,6 +424,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and %al,\(%rcx\) [ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and %al,\(%rcx\) [ ]*[a-f0-9]+: f3 88 01 xrelease mov %al,\(%rcx\) +[ ]*[a-f0-9]+: f3 88 04 25 78 56 34 12 xrelease mov %al,0x12345678 +[ ]*[a-f0-9]+: 67 f3 88 04 25 21 43 65 87 xrelease mov %al,0x87654321\(,%eiz,1\) [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%rcx\) [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%rcx\) [ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or %al,\(%rcx\) @@ -475,6 +477,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and %ax,\(%rcx\) [ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and %ax,\(%rcx\) [ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov %ax,\(%rcx\) +[ ]*[a-f0-9]+: 66 f3 89 04 25 78 56 34 12 xrelease mov %ax,0x12345678 +[ ]*[a-f0-9]+: 67 66 f3 89 04 25 21 43 65 87 xrelease mov %ax,0x87654321\(,%eiz,1\) [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%rcx\) [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%rcx\) [ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or %ax,\(%rcx\) @@ -526,6 +530,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and %eax,\(%rcx\) [ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and %eax,\(%rcx\) [ ]*[a-f0-9]+: f3 89 01 xrelease mov %eax,\(%rcx\) +[ ]*[a-f0-9]+: f3 89 04 25 78 56 34 12 xrelease mov %eax,0x12345678 +[ ]*[a-f0-9]+: 67 f3 89 04 25 21 43 65 87 xrelease mov %eax,0x87654321\(,%eiz,1\) [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%rcx\) [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%rcx\) [ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or %eax,\(%rcx\) @@ -577,6 +583,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 48 21 01 lock xacquire and %rax,\(%rcx\) [ ]*[a-f0-9]+: f0 f3 48 21 01 lock xrelease and %rax,\(%rcx\) [ ]*[a-f0-9]+: f3 48 89 01 xrelease mov %rax,\(%rcx\) +[ ]*[a-f0-9]+: f3 48 89 04 25 78 56 34 12 xrelease mov %rax,0x12345678 +[ ]*[a-f0-9]+: 67 f3 48 89 04 25 21 43 65 87 xrelease mov %rax,0x87654321\(,%eiz,1\) [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or %rax,\(%rcx\) [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or %rax,\(%rcx\) [ ]*[a-f0-9]+: f3 f0 48 09 01 xrelease lock or %rax,\(%rcx\) --- a/gas/testsuite/gas/i386/x86-64-hle.s +++ b/gas/testsuite/gas/i386/x86-64-hle.s @@ -442,6 +442,8 @@ _start: .byte 0xf0; .byte 0xf2; andb %al,(%rcx) .byte 0xf0; .byte 0xf3; andb %al,(%rcx) xrelease movb %al,(%rcx) + xrelease movb %al,0x12345678 + xrelease addr32 movb %al,0x87654321 xacquire lock orb %al,(%rcx) lock xacquire orb %al,(%rcx) xrelease lock orb %al,(%rcx) @@ -496,6 +498,8 @@ _start: .byte 0xf0; .byte 0xf2; andw %ax,(%rcx) .byte 0xf0; .byte 0xf3; andw %ax,(%rcx) xrelease movw %ax,(%rcx) + xrelease movw %ax,0x12345678 + xrelease addr32 movw %ax,0x87654321 xacquire lock orw %ax,(%rcx) lock xacquire orw %ax,(%rcx) xrelease lock orw %ax,(%rcx) @@ -550,6 +554,8 @@ _start: .byte 0xf0; .byte 0xf2; andl %eax,(%rcx) .byte 0xf0; .byte 0xf3; andl %eax,(%rcx) xrelease movl %eax,(%rcx) + xrelease movl %eax,0x12345678 + xrelease addr32 movl %eax,0x87654321 xacquire lock orl %eax,(%rcx) lock xacquire orl %eax,(%rcx) xrelease lock orl %eax,(%rcx) @@ -604,6 +610,8 @@ _start: .byte 0xf0; .byte 0xf2; andq %rax,(%rcx) .byte 0xf0; .byte 0xf3; andq %rax,(%rcx) xrelease movq %rax,(%rcx) + xrelease movq %rax,0x12345678 + xrelease addr32 movq %rax,0x87654321 xacquire lock orq %rax,(%rcx) lock xacquire orq %rax,(%rcx) xrelease lock orq %rax,(%rcx) --- a/gas/testsuite/gas/i386/x86-64-hle-intel.d +++ b/gas/testsuite/gas/i386/x86-64-hle-intel.d @@ -425,6 +425,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and BYTE PTR \[rcx\],al [ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and BYTE PTR \[rcx\],al [ ]*[a-f0-9]+: f3 88 01 xrelease mov BYTE PTR \[rcx\],al +[ ]*[a-f0-9]+: f3 88 04 25 78 56 34 12 xrelease mov BYTE PTR (ds:)?0x12345678,al +[ ]*[a-f0-9]+: 67 f3 88 04 25 21 43 65 87 xrelease mov BYTE PTR \[eiz\*1\+0x87654321\],al [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[rcx\],al [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[rcx\],al [ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or BYTE PTR \[rcx\],al @@ -476,6 +478,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and WORD PTR \[rcx\],ax [ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and WORD PTR \[rcx\],ax [ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov WORD PTR \[rcx\],ax +[ ]*[a-f0-9]+: 66 f3 89 04 25 78 56 34 12 xrelease mov WORD PTR (ds:)?0x12345678,ax +[ ]*[a-f0-9]+: 67 66 f3 89 04 25 21 43 65 87 xrelease mov WORD PTR \[eiz\*1\+0x87654321\],ax [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[rcx\],ax [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[rcx\],ax [ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or WORD PTR \[rcx\],ax @@ -527,6 +531,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and DWORD PTR \[rcx\],eax [ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and DWORD PTR \[rcx\],eax [ ]*[a-f0-9]+: f3 89 01 xrelease mov DWORD PTR \[rcx\],eax +[ ]*[a-f0-9]+: f3 89 04 25 78 56 34 12 xrelease mov DWORD PTR (ds:)?0x12345678,eax +[ ]*[a-f0-9]+: 67 f3 89 04 25 21 43 65 87 xrelease mov DWORD PTR \[eiz\*1\+0x87654321\],eax [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[rcx\],eax [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[rcx\],eax [ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or DWORD PTR \[rcx\],eax @@ -578,6 +584,8 @@ Disassembly of section .text: [ ]*[a-f0-9]+: f0 f2 48 21 01 lock xacquire and QWORD PTR \[rcx\],rax [ ]*[a-f0-9]+: f0 f3 48 21 01 lock xrelease and QWORD PTR \[rcx\],rax [ ]*[a-f0-9]+: f3 48 89 01 xrelease mov QWORD PTR \[rcx\],rax +[ ]*[a-f0-9]+: f3 48 89 04 25 78 56 34 12 xrelease mov QWORD PTR (ds:)?0x12345678,rax +[ ]*[a-f0-9]+: 67 f3 48 89 04 25 21 43 65 87 xrelease mov QWORD PTR \[eiz\*1\+0x87654321\],rax [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or QWORD PTR \[rcx\],rax [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or QWORD PTR \[rcx\],rax [ ]*[a-f0-9]+: f3 f0 48 09 01 xrelease lock or QWORD PTR \[rcx\],rax From patchwork Fri Nov 4 10:53:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318528wru; Fri, 4 Nov 2022 03:55:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MI0OUY+hmQIFXMkniw3tvh/2frZN6J31wSRteXGD4a17qcvoQUgARIB7cCC9s4YHPXKGE X-Received: by 2002:a05:6402:50cf:b0:462:352e:f4a7 with SMTP id h15-20020a05640250cf00b00462352ef4a7mr34329810edb.317.1667559302835; Fri, 04 Nov 2022 03:55:02 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b7-20020a056402084700b0045d4b7ad0e4si6180399edz.400.2022.11.04.03.55.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:55:02 -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=m6IbbMI3; 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 07C013857C70 for ; Fri, 4 Nov 2022 10:54:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07C013857C70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559284; bh=TEll+SIR6qsWxiuCdQIbb/1y25xnwWfrLUs6Rdn+PrU=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=m6IbbMI3FqvLnRhgSOm453vMuri3Cw+wH6N0m1XszSn/REs8DgG0Iq0lbeobIrVuZ tndg1ggjwa7H2DBrlBWaULm9mWT2GSba9SeOQO796TVRUKKh7Q0BJKYB59LlFpqA6d D7yn/7wBbd7TGrmP4NaSfFXlkHRfqzd0BzqRvog8= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60062.outbound.protection.outlook.com [40.107.6.62]) by sourceware.org (Postfix) with ESMTPS id 1F3403857C7C for ; Fri, 4 Nov 2022 10:53:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F3403857C7C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZPV/qEVJkpimVKuLtj/USa+gmaOIiAJX072qQ30W4s1mDyQS8U10Qvk54X62JTnRHs/wu9dyxmVyiYKtAYDT4GDaE7HVJATmCHjgP0DtST6nab/3T8hJgG4B5FmayGPpiTnbzXwrtLzjMFxzfjjodFXIVoF2gSay1EveV/7r3jFcg8Cl/AkLP8WQacl/paFzX8Qq7OkisojwU7fiuV6iwEAfU3BMlg9bUjopnGHbSvEkyBku9WrvOg5XCEew9fSkRiKzs/wYCkuN4ayTOIXfo/xCuS+vVbEZWfIjPDu7wvbK1zadjwMY98LjPcD72s8m4ZabACG35je6Kku2GukVw== 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=TEll+SIR6qsWxiuCdQIbb/1y25xnwWfrLUs6Rdn+PrU=; b=oEqbCDzTeQ/HVE4IoWvN/qYjpcabZ3oF9UuytkdQ7DU7xlLmJGVj/e0G9rAEpH0elxLF0EpNqdq0Vh57FcO0ibkCMYlhjsoMeaxXY/gd4McZ6PyA6V/jf33jHs6dFxi210+WbzpSJ7X8wE9CgWGOnS2uP8L1JWt+kO/2nDeW6KMNZO3k9hQ2ViG1FsPPoFy+3yHcRAxRBaTDMaddgV2Z4g8RFFQ/YFLu715IIdLexYcY7RAAIFslXk8la0LZ7mZ/oGY6TtKHWb2yzfXA3tZdpG0fVB/mV5D43xWroD3fdc6MjoqM6lIDoM82nLGJx0tqQz2umC0T1mBshAR9BSlO3g== 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 DBAPR04MB7397.eurprd04.prod.outlook.com (2603:10a6:10:1a9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 10:53:16 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:53:16 +0000 Message-ID: <352d1e49-ac9f-ee86-7e9d-74f79744268b@suse.com> Date: Fri, 4 Nov 2022 11:53:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 5/7] x86: move bad-use-of-TLS-reloc check Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: AM6PR05CA0003.eurprd05.prod.outlook.com (2603:10a6:20b:2e::16) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DBAPR04MB7397:EE_ X-MS-Office365-Filtering-Correlation-Id: f6659512-9263-4cb7-092b-08dabe52c70c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZFmo3+h6pYhx4CFEjKYuvss2h16+30Ip39eePWIeGYt1Uw6oyMUL2K8HfgJwLhy2TN9bPTuJ3VYHNCqY0wztuaZ1Lq+t1iI9t5RuEUsmr0sEHa4skI4vyEZYoR9McSyhON0jQ/m7Lv4thLaBM0ge0zBipX4F0+51exFBfjYTBzK52F8OyOJBYoe3s+l3mY5e+ikURCyLd14fpmQGeFxtt2EblYaCaItvq5J563qs1JQR34rqPC0ogm3POqdb1AudpkudWRDjIh3+ivj/33WHIU76tMANHLWrkzunwQ9sx2ri42OV0i78EV97asuWOZSH29mO98a1k2oB/bvv1KxbXYYrjXPjJ4MGbX+eEQ4vyI6vVhqOYWGWB3tErgCFpjZN+5JgncHjfSeZ0vvt96dF5nDi/Fvq0Wl1sJwv2FJMdTvAp5kbqE+BWQWClgtgS5XF2RVVYr3fRetja+OKX6eSZBOpL5nZ8XvKypNH5GggE1SKWvoW8YXKGU7gSl2ctiVXh8KRMStHaKz1JeyDXxvgXhUNdeMNxgMRu9wOpuSEQRFrsbbtOmRCcq2M3+EPAUgtxa7mD2qPfScgxhaomCjXNTKOac3X/la94dcynN6UlcSdkUQFKvyxAOhmXcyNuRcHa3dSM8JATsud06/+voedSj/WDBW+uOM9hyZAojGRMHRq5O9U3oRHX9p6g6qM2llgd8fiw7gBQc/VpDogt3/ghuGBf2pN5/+dULKoV7O169lETu/hQLJktmXkfdY6rKxjQIaDlcjG91nxGv4T/iiuQ0URnYICB+swvu994YV67XM= 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)(366004)(346002)(136003)(39860400002)(376002)(396003)(451199015)(316002)(478600001)(6512007)(31696002)(86362001)(186003)(6486002)(26005)(6506007)(6916009)(2616005)(36756003)(2906002)(8676002)(8936002)(41300700001)(31686004)(38100700002)(4326008)(5660300002)(66946007)(66476007)(66556008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zoSloQ3qDIwO4HcsLJbMrka/NSBX?= =?utf-8?q?PDzVs/wduUnsR8ocIAr6gsh2gU7POja/VkbGH12naECMv3PE6o2pGzSxXg+cr/Wmj?= =?utf-8?q?4863mCu1R6iVZ66Shzp4pI6lxp+klvLjt5hmAQOp2NKBVZbXxVK68MB4yPmq/5Dus?= =?utf-8?q?YYXZGtrgG+qQGWHPjjagymXI6PWkjsSSOhux+d1QLtY2C2GsZ0QtwXqW1o7OyB5u9?= =?utf-8?q?xgYYs4AcAm/dCwabByaAh5hXerdbBG4RSJP+10GzU/DrSvVZr+/CCoHtBpCIUXSAc?= =?utf-8?q?e7KUAHwTd/hV4a5KQSMIZmf4f+z9hlBQv3j+3lvvtONnEoWbtx7IprS2sbcu07Ldx?= =?utf-8?q?eZ9eFHluMtLFsbNK/RIW9ESFB4slbgFhmMnjK5G7ilVWqoZuXoqy0QFdM0HCSCVQd?= =?utf-8?q?8QiqF8hcB6mPivFetKx0D4XXkgJOGCEnBsY9y22JNjeibuRu6uXEPZBfEjmeJ2prN?= =?utf-8?q?cIExxYUHfFRvpenTpk1NOpg6iuje0eh3pUXt5zybvxQMp24MphFGpO7nv1/3kndwR?= =?utf-8?q?BhcrKUkCRForSHuqpTOELWAhAdvWSK+0f2N8Jz6/oYssKlGoHiTZG6OdKT8yQBCgi?= =?utf-8?q?g2hWU3DCoewws3QaNhq4tbAv6qj43ooP71C2zaKhu5EukEq7x0L/EITLGlSbWYM5k?= =?utf-8?q?hFleKB3lo/t+ahpuOU+AGvgJWhv7nJ1viAxAuUF1gV8+ZbCY9ZFuTY6P99KtJGjuJ?= =?utf-8?q?osg1SoalaM/qw7KI2vilkBVrn8PPLsyaJZR1xuelSehgYWnKXtJ7ZraOHGjSeMOuN?= =?utf-8?q?LIrQ4Ok/MWAfXQhSF2cSvtcaAe8/bhsX6ebsZnJCBYOn1pkRmIW2PfjZUIIi0BOiK?= =?utf-8?q?tidw4r7a5J66INxWbfQYSSfwJBWwaJgLEzOTjScwOF8Mel2B1HazVK87GqCfFQGaw?= =?utf-8?q?QZnqweDv+ZMGwDoDvzsvJ6BSA4UjFq/rdsdojlxftrMVh4E+WtR1W0h9sAQ21WgU9?= =?utf-8?q?C3JdBTaSsUFYpGboTWF8ClQGJ2hUn8fK3/0XJiITIoiyiYS31qTddJrv+WzG3DrCB?= =?utf-8?q?C4ywzUTradYUzClgsJ6TQ1fMywbCJ/0cU/wBMQiLxRli402WRh++b0CANUVwufhh7?= =?utf-8?q?tYpGqufybllaB4heOZNIsM0do/xj+jDX0GdCyrG1RWEslHmDBhS4fQurCh6PYdiol?= =?utf-8?q?q4gRktxS8isLeaW+UoFBflqolZE41tTHzRTzpGCXMo36Y6unt89MGoOAxX6bKUmS2?= =?utf-8?q?8RaZ455I9H7NpQkEEmUz9LPImeMTZBt+BHB+jLlp1v0hq0jkxfXM9wiLMcZkyfjo1?= =?utf-8?q?qraLZqzfrRaPJ+eyBUiW+gJIxx1vBQz5X4vfy361Uj/sET5Sn6O+fUSEfsbsWEVYH?= =?utf-8?q?0tZ2GMrjWzIkqoRb6jEcQTtNODO+/prgFoWqPA6nbLQIjJAypNCXIne8WGueJiLgN?= =?utf-8?q?wzbP6U/VSRBQzpVgKps5a4pwtXiYlZ1mcxQUsC3qFFGXETAYxbDL7T85g3hjnGxQD?= =?utf-8?q?e0xegNsxmgRboWMvNf3AUFm0vwUGHKnLY67olUKMmdZV+ZrnFA6aghKtDBg+CJBTQ?= =?utf-8?q?VijgDawn0H9c?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6659512-9263-4cb7-092b-08dabe52c70c X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:53:16.3646 (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: sgG0FKsKv7Hg+jIeVNZpXZZ6FIQG3zyxbGH2F0PNP6Ss4LrKshq31ycK5p38eyOEJN8so7I/o16nIhgPf/8azQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7397 X-Spam-Status: No, score=-3029.5 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 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?1748562663859498548?= X-GMAIL-MSGID: =?utf-8?q?1748562663859498548?= Having it in match_template() is unhelpful. Neither does looking for the next template to possibly match make any sense in that case, nor is the resulting diagnostic making clear what the problem is. While moving the check, also generalize it to include all SIMD and VEX- encoded insns. This way an existing conditional can be re-used in md_assemble(). Note though that this still leaves a lof of insns which are also wrong to use with these relocations. Further fold the remaining check (BFD_RELOC_386_GOT32) with the XRELEASE related one a few lines down. This again allows re-using an existing conditional. --- Is the set of relocations enumerated here actually complete? --- v2: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -5150,14 +5150,30 @@ md_assemble (char *line) return; } - /* Check for data size prefix on VEX/XOP/EVEX encoded and SIMD insns. */ - if (i.prefix[DATA_PREFIX] - && (is_any_vex_encoding (&i.tm) - || i.tm.operand_types[i.imm_operands].bitfield.class >= RegMMX - || i.tm.operand_types[i.imm_operands + 1].bitfield.class >= RegMMX)) + if (is_any_vex_encoding (&i.tm) + || i.tm.operand_types[i.imm_operands].bitfield.class >= RegMMX + || i.tm.operand_types[i.imm_operands + 1].bitfield.class >= RegMMX) { - as_bad (_("data size prefix invalid with `%s'"), i.tm.name); - return; + /* Check for data size prefix on VEX/XOP/EVEX encoded and SIMD insns. */ + if (i.prefix[DATA_PREFIX]) + { + as_bad (_("data size prefix invalid with `%s'"), i.tm.name); + return; + } + + /* Don't allow e.g. KMOV in TLS code sequences. */ + for (j = i.imm_operands; j < i.operands; ++j) + switch (i.reloc[j]) + { + case BFD_RELOC_386_TLS_GOTIE: + case BFD_RELOC_386_TLS_LE_32: + case BFD_RELOC_X86_64_GOTTPOFF: + case BFD_RELOC_X86_64_TLSLD: + as_bad (_("TLS relocation cannot be used with `%s'"), i.tm.name); + return; + default: + break; + } } /* Check if HLE prefix is OK. */ @@ -6822,26 +6838,6 @@ match_template (char mnem_suffix) } } - switch (i.reloc[0]) - { - case BFD_RELOC_386_GOT32: - /* Force 0x8b encoding for "mov foo@GOT, %eax". */ - if (t->base_opcode == 0xa0 - && t->opcode_modifier.opcodespace == SPACE_BASE) - continue; - break; - case BFD_RELOC_386_TLS_GOTIE: - case BFD_RELOC_386_TLS_LE_32: - case BFD_RELOC_X86_64_GOTTPOFF: - case BFD_RELOC_X86_64_TLSLD: - /* Don't allow KMOV in TLS code sequences. */ - if (t->opcode_modifier.vex) - continue; - break; - default: - break; - } - /* We check register size if needed. */ if (t->opcode_modifier.checkregsize) { @@ -6872,12 +6868,19 @@ match_template (char mnem_suffix) && i.types[1].bitfield.instance == Accum && i.types[1].bitfield.dword) continue; - /* xrelease mov %eax, is another special case. It must not - match the accumulator-only encoding of mov. */ - if (i.hle_prefix - && t->base_opcode == 0xa0 + + if (t->base_opcode == MOV_AX_DISP32 && t->opcode_modifier.opcodespace == SPACE_BASE) - continue; + { + /* Force 0x8b encoding for "mov foo@GOT, %eax". */ + if (i.reloc[0] == BFD_RELOC_386_GOT32) + continue; + + /* xrelease mov %eax, is another special case. It must not + match the accumulator-only encoding of mov. */ + if (i.hle_prefix) + continue; + } /* Fall through. */ case 3: From patchwork Fri Nov 4 10:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318191wru; Fri, 4 Nov 2022 03:54:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4utDGSnllGczMwKb2RWRb6TWdKvCJZTW/AM3Zv4H92Jvz567TvXxTjh4oP+k4DfgBEFfg0 X-Received: by 2002:a17:906:fd8a:b0:75d:c79a:47c8 with SMTP id xa10-20020a170906fd8a00b0075dc79a47c8mr33021485ejb.389.1667559251517; Fri, 04 Nov 2022 03:54:11 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dd11-20020a1709069b8b00b0078e06df0d29si5024655ejc.705.2022.11.04.03.54.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=GWdeu2wI; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 2C51F3858285 for ; Fri, 4 Nov 2022 10:54:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C51F3858285 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559247; bh=1KVDGPvfEc/Sy7WOKItTxfoNkUIbnujkETs3syt8mp4=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GWdeu2wIXOdMwdYo1AC8CASSvKLUUY+bnfnfSyouikVMGcFzFNScIqNem/GkucHVm oEUHiEsThkPTmC3VyfyYvAIwkmI8ukqRdvkleTNNXm2Iz44VE18LG3PQN5rn1AodZF UwoAxE0nRa/0YCyKy2yp1u9jFFXlLXIXr8vsITxk= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) by sourceware.org (Postfix) with ESMTPS id B1A4B3858287 for ; Fri, 4 Nov 2022 10:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1A4B3858287 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aebxWGf6FobohxYLIuKbCJv8pnauHsfaepI4r9uOvOcP13ZugmpBdRhgfpWAvMoS9gjteAxsKf7kXvWxVmmVIvDI+373HfZmrYwjmwfDcidVmwCX6WPOmX1syQxoXGuBdDVqVRMrmrCg3ofIS0jlUwaPobyQzmKP8aqD+4FDPqXfgsrdvIv9KLulRDm0Qk1YPrFnhSfzj80VcpMqao/zumpzVG73N70pRVvwb6vJtx0V8a7e6DS/MvjW+Vl78RpQo0SwFUMoIWHQBsIk+knCvV9LexoLGqK78eg+DRgH+MEfaIAsBp9qAoQE1CKibhofpGRS7mU2yuxsdDkxHgEtZA== 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=1KVDGPvfEc/Sy7WOKItTxfoNkUIbnujkETs3syt8mp4=; b=WesqQIyGOIK7NSY2ppaSZdkxv72eN6FvJDW4btAE8hsjSA/POC2HfRyldK1aRoyUn0TyE48gcZX6p/CJAt09RGPj/PbuR36kdbTNVXRpss0SMGn9O/y8XXZjR6OMvT0gax7XXu6RwiZ9sUjKkABnJdqAg25XAUcDAB0PrXGzY8KJrM4rqJsU+7P4zmayxaYeHiqIUMvhyqUUq5fvb5pzWjamj5SDbwCK8hEejkiwbtQvq+IugeFwPLsGFKF20ZslHPAknj2MwOTFuSSpb5PYmVbJNaHSFvYhOemRSRiXLiIPIH1ipmWUt+Yiv/1lokNLEWF6yXxZxzwgDULe0p0dXw== 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 AS8PR04MB8881.eurprd04.prod.outlook.com (2603:10a6:20b:42c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 10:53:54 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:53:54 +0000 Message-ID: Date: Fri, 4 Nov 2022 11:53:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 6/7] x86: drop (now) stray IsString Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: FR2P281CA0030.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::17) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS8PR04MB8881:EE_ X-MS-Office365-Filtering-Correlation-Id: c1eb6cb3-7123-490d-f04e-08dabe52dd7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5J8w3vzjMOG0ci2KY3h8xQwxmajMrtL7QswrYyNSzu3w1V+32OYy5jGuG1gVUswcuOMkjjC+pK1Z4jABxpwnBu2i+C003tVOEWLfkRPyNypjetPCk7e7uRcI5uxcaeysu7WPlgBBy95AmZ88U6B0CsjjYDspqYSstNawqwpPWoaaTFk3bWpllCKfLb/z6TqS4vzRs3GvVw+sTXhvFsMA+Wx80E8kVNHdnk9bacYi02UKVC6JLgU6ya+92ZaMIcFZnTm39gRvjY2ftm3vSGzKbKICJyJLXcyfgJkHciYPQCFEZl8PclG9rXfAKqxRfZnUUnN7/2wf2ru+SAwVlD5/MPsKo4m15soiplO8ZyChRbnxpHnxT1oCjAUlGvjfmM1GlP7Q4f/rRFw66kwRk4zh6cMCLpK+VM5dLwaq0an8tvs3INAUAkoWufUy945Jq7UqRMPTsmKdavV8rAlQ5wCkQNLFHXxFfqGRaweygREYh8Rxffsaj6KUV137Gjy53hE8rLJll6nv9ivkI3y7IsjoWBlqf/vRLPuut/apvTxR+tDhy1Ox4jpAVmtRRaeWfwgr+Unu3vivEX0JCK2oqNDzsUvfX5n2eVTEizSkkpoF/W5V0hWuhuTbBp5lT/xJH+gOezCO8TQ8tW7fa0ZaHNgs+lblYX+xT3NQLk2bCT1U7JydXnkqcqjzXtckmAJ7vdM3ydMAogycPzBWVmsgeSvoeU0UNImLm6gcnrWj3irZONJ2fYN/NI7+4utsL5rQDIDL3OzpAZOlQtv/n/XP572P3Yq5VPzCewrqEIJjEkjQd+M= 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)(6029001)(396003)(366004)(346002)(376002)(136003)(39860400002)(451199015)(316002)(8676002)(6916009)(30864003)(86362001)(5660300002)(2906002)(38100700002)(31696002)(66476007)(66946007)(186003)(66556008)(2616005)(83380400001)(4326008)(36756003)(8936002)(41300700001)(6486002)(31686004)(6512007)(26005)(6506007)(478600001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1dARnIHrYZtbHNkMgleRVKdxVwWA?= =?utf-8?q?pdwCZagfvJ2mKE/Y95Fik3JQL3e62pQlewp8FUk+Nd1KsLnKYaO17COPpvOS7U3Bu?= =?utf-8?q?7UWAG62Q84gjYE4LMDB4egP/xz/IqAI1w/q4lfh3pvsLP8RsSbw+rz9HJHhkBsCnr?= =?utf-8?q?Z1qynTF7p5+DvyJ1UgjdxIGiA74bEnhGKPgDcDohR90K7d64mlS+f9A7lqf7I/+jW?= =?utf-8?q?/nOH3ZyIithQCk9i2PkGaXZ8Yl18mPR5WiuVxTruXEvkO/lXgh1PZpteriM6We3S5?= =?utf-8?q?/Bxi6uniSdJ4y50hiJKq5kRU2o0eFrbCNRtNqz9DizHYTaXPXSTXilqCDbxWIgrLZ?= =?utf-8?q?mcGle4AEEtpktUcqYvF20sQ5HEAc0b58AE3A9nS7kQC5uH7O4zySb44+eS6oqFv/7?= =?utf-8?q?+GHob44kke8c8mB+zYO/vXTJE8XdvDTVLYiIs4adhJCe1aLAjt9Lf05pH2VSk9Ep3?= =?utf-8?q?mX2wSRVDKp3y+bQfHNUAyD9Ij3F24HhYwhRVlyEme8cfj5wOklvv5e0JSRVd/0qie?= =?utf-8?q?oZpsXYJH+Gg7mbNun68cPLFrJNsuPdW40sG4zZV45Ii0JjefUVdVFBHpP+tgkoMqK?= =?utf-8?q?PsejZMDs77sVzcSHaoDJ/sWHX60dX78IPZEOb7ynIawebEMO29/E7er6rLh2PskBJ?= =?utf-8?q?KQjRWPWvYOTxjrht7/9icX3zyYtjJmq6Emsx2FJM2caIbCuoqoxWHYOzfR8hj2H2j?= =?utf-8?q?SBgaUhp0i4N0XtLZ74Ptr4m2vB7MfijupmhuAux/XebZH/IDtXID/J0pfg/WPFBrC?= =?utf-8?q?HTLS9sjkHU6zy2LqxsGb1kw18PpFwb4jzlpl7QtqJ9qOS9bjx/TUwGlyen7IRBAFo?= =?utf-8?q?1IjwfHKQP7vNCE27XicqkuDMMQf6hQJE7QU/IDDqXaDZUCNIlAu2WwOyyMMjKphcY?= =?utf-8?q?b2bXLammsrlNEMBmmG0qWORG00GXK9ROQ9IktGEZPwZDNoLDllIWxzuumzi9zq78c?= =?utf-8?q?bfbrekSBwx9EI9Hul4SIDdHQtZmxF0sJnddMsR9ahoAIz8dwdD6VS0ESDrK2vDfh2?= =?utf-8?q?vDf/Omufu0OuCwtMMkRROz8t8J6KrWsyKyDFh58oMD7HTsQ3aqUq/3d1pgTfXC5gS?= =?utf-8?q?GtT4YMD+WmPBQnDgFuJ54JvEnjqELg0A1ZSrCC8LtgKEPtmccS0VcORTDL2uQAY2L?= =?utf-8?q?K+wkfPCSgW3jsK71BRF80mlnUMlTIkxyQ7LQtjIciQtA8irdvNerjpdRpkqIwobRt?= =?utf-8?q?4hIH25JltiS7MABfYwhAye1AwzEofFKLi5NQsu3JKJ7zgxYs/fe/QcCnAkJ+JWHkL?= =?utf-8?q?fjTlylXbeSaoe8SACtTUqnsAiOZ7N9La+H3O7aqe1D9sXAkzM8d7D+svJz0cNhTUv?= =?utf-8?q?19aEIgINh71oSuSmhn0Vk3fsw2ZxTbKn6Zvet1LczJZKh9kUIPF2Sk1fdjfxuPZA3?= =?utf-8?q?WwkhzarKqei2rz2ibqjlZ5dEG4KjeJdN4p6A74mxu2rCqYBAJqUmb8816w21GhlJ7?= =?utf-8?q?4CYXKlnVsWcXG981Bkuoz0QL0uad49fX9Bz9WJvhTOf9XRRQc55Kedpr23NAMetaY?= =?utf-8?q?O1WHNwxlTRwJ?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1eb6cb3-7123-490d-f04e-08dabe52dd7f X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:53:54.1591 (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: e7YT5U7Xgo1DcIfLKguEi350J5OgqoJhJXSYZVNc4hqM2P8A9UC13L5xeIbJcS9GnefP8ideKOpP8aAeJmzLWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8881 X-Spam-Status: No, score=-3029.5 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 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?1748562609852683732?= X-GMAIL-MSGID: =?utf-8?q?1748562609852683732?= While I question the original need for IsString on the PadLock insns, the need for them on the operand-less string insns has gone away with the removal of maybe_adjust_templates() and associated logic. Since i386_index_check() needs adjustment then anyway, take the opportunity and also simplify it, possible again as a result of said removal (plus the opcode template adjustments done here). --- v4: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11293,12 +11293,9 @@ i386_index_check (const char *operand_st { const char *kind = "base/index"; enum flag_code addr_mode = i386_addressing_mode (); - const insn_template *t = current_templates->start; + const insn_template *t = current_templates->end - 1; - if (t->opcode_modifier.isstring - && !t->cpu_flags.bitfield.cpupadlock - && (current_templates->end[-1].opcode_modifier.isstring - || i.mem_operands)) + if (t->opcode_modifier.isstring) { /* Memory operands of string insns are special in that they only allow a single register (rDI, rSI, or rBX) as their memory address. */ @@ -11315,14 +11312,12 @@ i386_index_check (const char *operand_st if (t->opcode_modifier.prefixok == PrefixRep) { - int es_op = current_templates->end[-1].opcode_modifier.isstring - - IS_STRING_ES_OP0; + int es_op = t->opcode_modifier.isstring - IS_STRING_ES_OP0; int op = 0; - if (!current_templates->end[-1].operand_types[0].bitfield.baseindex + if (!t->operand_types[0].bitfield.baseindex || ((!i.mem_operands != !intel_syntax) - && current_templates->end[-1].operand_types[1] - .bitfield.baseindex)) + && t->operand_types[1].bitfield.baseindex)) op = 1; expected_reg = (const reg_entry *) str_hash_find (reg_hash, @@ -11365,6 +11360,8 @@ i386_index_check (const char *operand_st } else { + t = current_templates->start; + if (addr_mode != CODE_16BIT) { /* 32-bit/64-bit checks. */ --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -483,37 +483,37 @@ loopne, 0xe0, None, Cpu64, JumpByte|No_b set, 0xf9, 0, Cpu386, Modrm|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex } // String manipulation. -cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { InOutPortReg, Byte|Word|Dword|Unspecified|BaseIndex } -outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Unspecified|BaseIndex, InOutPortReg } -lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Acc|Byte|Word|Dword|Qword, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Acc|Byte|Word|Dword|Qword, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString, {} +xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, {} xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString, { Byte|Unspecified|BaseIndex } // Bit manipulation. @@ -1968,24 +1968,24 @@ lzcnt, 0xf30fbd, None, CpuLZCNT, Modrm|C popcnt, 0xf30fb8, None, CpuPOPCNT, Modrm|CheckRegSize|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } // VIA PadLock extensions. -xstore-rng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-cbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-cfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -montmul, 0xf30fa6c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xsha1, 0xf30fa6c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xsha256, 0xf30fa6d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstore-rng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-cbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-cfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +montmul, 0xf30fa6c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xsha1, 0xf30fa6c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xsha256, 0xf30fa6d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Aliases without hyphens. -xstorerng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptcbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptcfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstorerng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptcbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptcfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Alias for xstore-rng. -xstore, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstore, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Multy-precision Add Carry, rdseed instructions. adcx, 0x660f38f6, None, CpuADX, Modrm|CheckRegSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_ldSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } From patchwork Fri Nov 4 10:54:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 15471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp319091wru; Fri, 4 Nov 2022 03:56:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AggFPry11dPVnAQmpSNRtSS0cE71aLb66hzjt3pYOXgvGabtMArnP8FNGdWT8ehxeUlA8 X-Received: by 2002:a17:907:2bd2:b0:7ad:9ada:a6ca with SMTP id gv18-20020a1709072bd200b007ad9adaa6camr32962236ejc.637.1667559374955; Fri, 04 Nov 2022 03:56:14 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e17-20020a17090658d100b00791a67e4c00si4828363ejs.835.2022.11.04.03.56.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 03:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=X7st5+r9; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 15F6F3858419 for ; Fri, 4 Nov 2022 10:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15F6F3858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667559358; bh=4Y3QRxI9Th/gtOvR8Jc+EbNoI1oUUhvs3u/4FbI14MM=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=X7st5+r9ji1qE4GcfxLxWMUmtvmMplQXtpGuoICTXw+o/43sNnT7IVmg5MfQBwiZ3 kmOEE50+6VdGQrxPyxOvcNHP2pfUh2VtCR+zqEGgkiD/D8WQBfHmWpBhkCBmMtdvp4 fBJAXK3lhk7txhOM/fbSGRY3cGjzOzerqkaIRal8= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 BC3713857C58 for ; Fri, 4 Nov 2022 10:54:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC3713857C58 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fnekcqCACeyEV1inoy7bIKIYfWNS+I72KEy13QqGqLE4O3NPRoJiN3aVXoNbCmE/85KEb2SO+GOvD3ESBoCFLOwkT/1Jxs2DaKPm0y6KC5ZR3KQW9rAIed+62Aape5ECHMqSBrkj9znnRk/2USNwydQ+IuMpL/i11ux99ynFr1/YTHMEzehQoHnfLRpwOIVgTM0/PIVDvcN1MPLAxKXf5/UuNWv+/PJwFEtK/2az10Xtk9k0WFaMZO2MU+kBLrX49P5yFdtDgt0mwMex176Sx3wQvy59pRgGfd2XzrPVeGSBmfsS0woi7cP9ESYyXS4KGa78Ztn/ijODUOs+gfOxHw== 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=4Y3QRxI9Th/gtOvR8Jc+EbNoI1oUUhvs3u/4FbI14MM=; b=N6SXpIx+BiLCuUyFHoIrHALvey9johnCKT2WV6Bhfi9wr6g+40xQUnPofnl3Qtt5RD5OfU2QmT7gvy5zuRNeuKZW0ANzQvMqLXjF/OR3igKc1YGPiXoRSrN+l9UFj9l8zFqE5mQDluR5C3xt4Tpbiv7ctmCAb9YK3lsBxWwx9j2TMCOcDRgReOVV8UfJnvxejs3pv4UFGSbIQIdheDMoicBK66IPJgmveWUmnKLSxPRYOsD33ZzYvC1Bv50H3ohAU7a1Up2OQ+uXOuzKGLNjo4cfAs/1TbnMKApqFcc+2N50tlzhJ9MLynHvc6D/TwAzcH7MCKDpp3S6dLgI3ZdKVQ== 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 AS8PR04MB8881.eurprd04.prod.outlook.com (2603:10a6:20b:42c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 10:54:32 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 10:54:32 +0000 Message-ID: <2baf6a9d-c1bf-660d-bbca-99b1604f5478@suse.com> Date: Fri, 4 Nov 2022 11:54:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v6 7/7] x86: further re-work insn/suffix recognition to also cover MOVSX Content-Language: en-US To: Binutils References: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> In-Reply-To: <6d71dc80-91c8-7bc8-c57f-4f771ca59fab@suse.com> X-ClientProxiedBy: AM6PR0202CA0068.eurprd02.prod.outlook.com (2603:10a6:20b:3a::45) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS8PR04MB8881:EE_ X-MS-Office365-Filtering-Correlation-Id: 02fcd7ff-509b-4c3c-8591-08dabe52f423 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TSA5K18C/QwLpZUNZB610gIAFtHPU/8JAlRYQsI3ddg7njXlHZiDS0ESlfQfDtsXETQJfem+e2M02PUbphHOAShTmLIA8a0i/a84mqwFd2dMYvZANsSUZWDJQseEBUBv4z9Snlcd6fa5WY+gJTD8mPNO92FiXBe+MWrD60YOpL6flYEPqf+1m37V4wDUjR3evh4NSkCnrnnCt6OhRbgMyA3SiA4pIHbL396cTd7+zkEN5z4/fLJW4JiDyHEbOV2QZHj+1CCf6rlqOz5GJ7/uNCRaLGVEO1OS0AHKOusWuRJ9IaEuyc7QY5BCjaPjCivkB72ysW3Xjss0vHN/teStPxH4DuF6MLrtmsBAmNwiUcoqStBOxyX5+OAI6NabzYW8GhFK7LSDnT0CLoD+7860POY4+cdFQVJ4J2Xr8svplRHT/nTtbaziTA405pJesO9qqKSa1GChaG2Wyz9UEYNsp/mhmXJ7jOFFf7bgANxBM0XSMRVTpb2HN7sIk1oMH4PDjHEf9UcZDiVJUhR46FrYZJdAY2I7WOuPKUifTzvRcZMM7NHrOEwUuvHw0/sPywRaX84Kdgjc6peMjXqShpASHEORGxwcwDO5TZr+uzODLIXxn3tuZwPiYUX0Cy90Nw/eYnBqCUBmUzKOewfKOi6mtdAGPvLnmdtvq9ggu7SG/HE5B6b1LsYlmXxXsujaxaU7ZrBXY4J6yu+1IzJeKzRdDdEypmNsJvFH4F3Ad8s25KfR3WZPieh6QWgaG3eqf9SH+VOYFciABPB2qV3V0e2TKWmm8CRrM91pzlHJfpSYMjQ= 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)(396003)(366004)(346002)(376002)(136003)(39860400002)(451199015)(316002)(8676002)(6916009)(30864003)(86362001)(5660300002)(2906002)(38100700002)(31696002)(66476007)(66946007)(186003)(66556008)(2616005)(4326008)(36756003)(8936002)(41300700001)(66899015)(6486002)(31686004)(6512007)(26005)(6506007)(478600001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aYv0lRgFqhSzpEXsQDyaOwtgT6ah?= =?utf-8?q?bxyUxrVQJ5DU+WucSSdug//ZUVvnToqpd6Ag+XEmuC+dgy8tYZP1CpX8IAYi84Xb7?= =?utf-8?q?+j/PQ24CUBHf6aOp1ZmxLiY8weRzDM6qB8FqRqJj/lyLwLRZhdrMXy2r/1ytfo9V3?= =?utf-8?q?iot3BBgC6aa8x6HNCalolTP8VxNvaUoU8UTop/5t28SAJHOBWHQamyf/Vr4nNd13U?= =?utf-8?q?aoPb67ueGe9QvXeH5AI22f/dPaaI0FlskOpIoaEIuoovxQ1u+Wy4nchiiQRZEDgLp?= =?utf-8?q?IP4Lg13ZhjDh6rt9OsbIM4dKMzfap4pHuQJ/MjuRAf2n2asjBv2GgRM9/ZtmPdWpI?= =?utf-8?q?lLZ3yclk6y2JSxHG7/XOXmVGLDqyUxcRBrro3DKSlIrRWlJM7gWsE02Rm7k/AURq5?= =?utf-8?q?rfoQVZM3rbZpzqZh0aN698knl8o96xTh1fEukzGOuMS/5ilseKc3iNcucHPiPl5oX?= =?utf-8?q?yc5mNjKtvarOco87gOlJ3+69loxejGbJ5iiojMzdzoHPYxAPgManX+GZyCg+L1omp?= =?utf-8?q?rzobZ8nHIgUSUQKtFuvFisFNviXxyLmR7Gbob3Ae7CfbDLXYVxSEHBeJ3gzi+GDGt?= =?utf-8?q?7dNd8GAd6VioTmUajR0R0ySs2YaQvCWHem6uonKEqsras6ME8CSK/WqXmxL6FxSMP?= =?utf-8?q?HkN6n0PGDTpQ8KhWrk+qWHHkrf3F3UsW/cecCiW0v4zf19DxNpZVi5Rb3JXcbEpNQ?= =?utf-8?q?OTo/G9wT/zUqcCK7uRIixXQVdHnX+DsTMX3llH8z9BoHlY+20XnVA8ZdNah4hsNLj?= =?utf-8?q?6XcQ/f+dnDNtAhoBP2+txXOYNGn6oJnQiY1asssgZhRHAoBZyck+e+DXYPnvERQHE?= =?utf-8?q?LiQODBiuOCyVmA/+RnJ6YAw+vRh6Qn/1uiM+9YaeksGzzDhwz9mb8rdkntUOiG8S/?= =?utf-8?q?f5GxMmCAAe9zm2Dej8w88229LlOajnuFN4UNrpGw7AMNdTSHuCAkmD821t9ZjdhSJ?= =?utf-8?q?rUNAr6FjLDx7aC8j/+6CEyv65PpXp5tb5xsI4jNsuOosQCkSjO3M6hWUGxQEevjPO?= =?utf-8?q?GHwbKwp8ouNerN+LAy+nY4sKSYI3ErdfRGUSBAaz3ZIBdcE44aNB3ffJWxYsWRXX6?= =?utf-8?q?dIHG7bX2iCEkzAlQaOq7kQR16z8r2csfVTO7clIWBp9ksqhIPfBt/VI4J64xqv2LG?= =?utf-8?q?jfTUi941iGlSohbjpDlchXjfGOlOxfTZ0q3QIKY6ZzrDjeaVIKuXA3cZyOp5eQhc1?= =?utf-8?q?bBU006XXYRxyqQltSuOVdgD7cncTM/feK4tlC4uZSsB+uhYZbW6RqvboB8OBYBLxm?= =?utf-8?q?r5mAGsWg0p85JkXmBRzMgvRZNmkz+toPie+PPg8LrNT8Ydj0DF7TAEBmzGCM9C//b?= =?utf-8?q?ViREdmPSX4PpHGq9EPfXZiKzwTUdgXhDUjWNhvSIr7Bhe+AUXatk2Id70DDodkCh7?= =?utf-8?q?B5ZvRavYsV0TJJxQ9FkXnGDYxlwznfx649W1mBCW0najcLWzOghjRTZr3RlSWw1Za?= =?utf-8?q?qvanxzpUylYRoaG2ooyipS+GfEY6aey/7+XlM8EEt9Ccni4GQ0rV9qsQobqwSoz/J?= =?utf-8?q?Dz+QuiMNffxs?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02fcd7ff-509b-4c3c-8591-08dabe52f423 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 10:54:32.0785 (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: gTMysYzzjyeLiEwFk0u23t2c52nw/a8HnTqO+H+onVBZi6gyLgtBipD5NsHX7YEIGXdGTp8jht48tKpiBV6AoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8881 X-Spam-Status: No, score=-3029.5 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 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?1748562739481970023?= X-GMAIL-MSGID: =?utf-8?q?1748562739481970023?= PR gas/29524 Having templates with a suffix explicitly present has always been quirky. After prior adjustment all that's left to also eliminate the anomaly from move-with-sign-extend is to consolidate the insn templates (and extend testsuite coverage) and to make may_need_pass2() cope. --- v6: Re-base over dropping of Pass2 attribute. v5: Split off from earlier patch, merged with prior patch dealing with just x86-64's MOVSL. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4846,7 +4846,11 @@ static INLINE bool may_need_pass2 (const { return t->opcode_modifier.sse2avx /* Note that all SSE2AVX templates have at least one operand. */ - && t->operand_types[t->operands - 1].bitfield.class == RegSIMD; + ? t->operand_types[t->operands - 1].bitfield.class == RegSIMD + : (t->opcode_modifier.opcodespace == SPACE_0F + && (t->base_opcode | 1) == 0xbf) + || (t->opcode_modifier.opcodespace == SPACE_BASE + && t->base_opcode == 0x63); } /* This is the guts of the machine-dependent assembler. LINE points to a --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -73,6 +73,7 @@ if [gas_32_check] then { run_dump_test "amd" run_dump_test "katmai" run_dump_test "jump" + run_dump_test "movs32" run_dump_test "movz32" run_dump_test "relax-1" run_dump_test "relax-2" @@ -815,6 +816,7 @@ if [gas_64_check] then { run_dump_test "x86-64-segovr" run_list_test "x86-64-inval-seg" "-al" run_dump_test "x86-64-branch" + run_dump_test "movs64" run_dump_test "movz64" run_dump_test "x86-64-relax-1" run_dump_test "svme64" --- /dev/null +++ b/gas/testsuite/gas/i386/movs.s @@ -0,0 +1,39 @@ + .text +movs: + movsb %al,%ax + movsb (%eax),%ax + movsb %al,%eax + movsb (%eax),%eax +.ifdef x86_64 + movsb %al,%rax + movsb (%rax),%rax +.endif + + movsbw %al,%ax + movsbw (%eax),%ax + movsbl %al,%eax + movsbl (%eax),%eax +.ifdef x86_64 + movsbq %al,%rax + movsbq (%rax),%rax +.endif + + movsw %ax,%eax + movsw (%eax),%eax +.ifdef x86_64 + movsw %ax,%rax + movsw (%rax),%rax +.endif + + movswl %ax,%eax + movswl (%eax),%eax +.ifdef x86_64 + movswq %ax,%rax + movswq (%rax),%rax + + movsl %eax,%rax + movsl (%rax),%rax + + movslq %eax,%rax + movslq (%rax),%rax +.endif --- /dev/null +++ b/gas/testsuite/gas/i386/movs32.d @@ -0,0 +1,22 @@ +#objdump: -dw +#source: movs.s +#name: x86 mov with sign-extend (32-bit object) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 0f bf 00 * movswl \(%eax\),%eax +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/movs64.d @@ -0,0 +1,30 @@ +#objdump: -dw +#source: movs.s +#name: x86 mov with sign-extend (64-bit object) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 67 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 67 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f be c0 * movsbq %al,%rax +[ ]*[a-f0-9]+: 48 0f be 00 * movsbq \(%rax\),%rax +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 67 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 67 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f be c0 * movsbq %al,%rax +[ ]*[a-f0-9]+: 48 0f be 00 * movsbq \(%rax\),%rax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 67 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f bf c0 * movswq %ax,%rax +[ ]*[a-f0-9]+: 48 0f bf 00 * movswq \(%rax\),%rax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 67 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f bf c0 * movswq %ax,%rax +[ ]*[a-f0-9]+: 48 0f bf 00 * movswq \(%rax\),%rax +#pass --- a/gas/testsuite/gas/i386/movx16.l +++ b/gas/testsuite/gas/i386/movx16.l @@ -41,11 +41,11 @@ [ ]*[1-9][0-9]*[ ]+movsb %ax, %cl [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]* @@ -82,7 +82,7 @@ [ ]*[1-9][0-9]*[ ]+movsw %eax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 660FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movswl %al, %cl --- a/gas/testsuite/gas/i386/movx32.l +++ b/gas/testsuite/gas/i386/movx32.l @@ -41,11 +41,11 @@ [ ]*[1-9][0-9]*[ ]+movsb %ax, %cl [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]* @@ -82,7 +82,7 @@ [ ]*[1-9][0-9]*[ ]+movsw %eax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movswl %al, %cl --- a/gas/testsuite/gas/i386/movx64.l +++ b/gas/testsuite/gas/i386/movx64.l @@ -106,17 +106,17 @@ [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]+movsb %rax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]+movsb %rax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %rax, %ecx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 480FBEC8[ ]+movsb %al, %rcx [ ]*[1-9][0-9]*[ ]+movsb %ax, %rcx [ ]*[1-9][0-9]*[ ]+movsb %eax, %rcx [ ]*[1-9][0-9]*[ ]+movsb %rax, %rcx @@ -192,12 +192,12 @@ [ ]*[1-9][0-9]*[ ]+movsw %rax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %rax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %rcx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 480FBFC8[ ]+movsw %ax, %rcx [ ]*[1-9][0-9]*[ ]+movsw %eax, %rcx [ ]*[1-9][0-9]*[ ]+movsw %rax, %rcx [ ]*[1-9][0-9]*[ ]* @@ -241,6 +241,46 @@ [ ]*[1-9][0-9]*[ ]+movswq %eax, %rcx [ ]*[1-9][0-9]*[ ]+movswq %rax, %rcx [ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %cl +[ ]*[1-9][0-9]*[ ]+movsl %ax, %cl +[ ]*[1-9][0-9]*[ ]+movsl %eax, %cl +[ ]*[1-9][0-9]*[ ]+movsl %rax, %cl +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %cx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %cx +[ ]*[1-9][0-9]*[ ]+movsl %eax, %cx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %cx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %eax, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %ecx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %rcx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 4863C8[ ]+movsl %eax, %rcx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %rcx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %cl +[ ]*[1-9][0-9]*[ ]+movslq %ax, %cl +[ ]*[1-9][0-9]*[ ]+movslq %eax, %cl +[ ]*[1-9][0-9]*[ ]+movslq %rax, %cl +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %cx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %cx +[ ]*[1-9][0-9]*[ ]+movslq %eax, %cx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %cx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %eax, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %ecx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %rcx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 4863C8[ ]+movslq %eax, %rcx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %rcx +[ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movzx: [ ]*[1-9][0-9]*[ ]+movzx %al, %cl [ ]*[1-9][0-9]*[ ]+movzx %ax, %cl --- a/gas/testsuite/gas/i386/movx64.s +++ b/gas/testsuite/gas/i386/movx64.s @@ -241,6 +241,46 @@ movsx: movswq %eax, %rcx movswq %rax, %rcx + movsl %al, %cl + movsl %ax, %cl + movsl %eax, %cl + movsl %rax, %cl + + movsl %al, %cx + movsl %ax, %cx + movsl %eax, %cx + movsl %rax, %cx + + movsl %al, %ecx + movsl %ax, %ecx + movsl %eax, %ecx + movsl %rax, %ecx + + movsl %al, %rcx + movsl %ax, %rcx + movsl %eax, %rcx + movsl %rax, %rcx + + movslq %al, %cl + movslq %ax, %cl + movslq %eax, %cl + movslq %rax, %cl + + movslq %al, %cx + movslq %ax, %cx + movslq %eax, %cx + movslq %rax, %cx + + movslq %al, %ecx + movslq %ax, %ecx + movslq %eax, %ecx + movslq %rax, %ecx + + movslq %al, %rcx + movslq %ax, %rcx + movslq %eax, %rcx + movslq %rax, %rcx + movzx: movzx %al, %cl movzx %ax, %cl --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -162,14 +162,9 @@ mov, 0xf24, None, Cpu386|CpuNo64, D|RegM movbe, 0x0f38f0, None, CpuMovbe, D|Modrm|No_bSuf|No_sSuf|No_ldSuf, { Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } // Move with sign extend. -// "movsbl" & "movsbw" must not be unified into "movsb" to avoid -// conflict with the "movs" string move instruction. -movsbl, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg32 } -movsbw, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg16 } -movswl, 0xfbf, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Word|Unspecified|BaseIndex, Reg32 } -movsbq, 0xfbe, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg8|Byte|Unspecified|BaseIndex, Reg64 } -movswq, 0xfbf, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg16|Word|Unspecified|BaseIndex, Reg64 } -movslq, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg32|Dword|Unspecified|BaseIndex, Reg64 } +movsb, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +movsw, 0xfbf, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_sSuf|No_ldSuf, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 } +movsl, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, Reg64 } movsx, 0xfbe, None, Cpu386, W|Modrm|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } movsx, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 } movsxd, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 }