From patchwork Fri Dec 2 10:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 28852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp750439wrr; Fri, 2 Dec 2022 02:18:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4V7zGowzypn4ckxVbVYcxIH9YTJKlGHHr3QlVY6cwUEMEjTXAqsyZJuA59JGrszf6CdVVU X-Received: by 2002:a17:907:2904:b0:78d:b598:bb6a with SMTP id eq4-20020a170907290400b0078db598bb6amr45891700ejc.258.1669976293720; Fri, 02 Dec 2022 02:18:13 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hd36-20020a17090796a400b007721f88d3e0si5403301ejc.554.2022.12.02.02.18.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:18:13 -0800 (PST) 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="V6V2Ov/K"; 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 888CF3858C60 for ; Fri, 2 Dec 2022 10:18:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 888CF3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976292; bh=51SgIDeKj0XCw+REQqHcVKeiNwluKu4/2RJ4J3whhvg=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=V6V2Ov/KQEutfEP8/wzQztI5TCs9asmjow1q2+8eMPJA+jNmTfu6aY2sZ8gLJBteY 6L1JjgL8oMgPSVXN3jWCkWPukxSD5f8J5RBR1BYoSxCD39O7mblVsoGajHCF85/966 PeBP1htppO7faha6WxvJkAVDO0o4SKnqGCY+hY28= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2044.outbound.protection.outlook.com [40.107.105.44]) by sourceware.org (Postfix) with ESMTPS id 15CFE3858404 for ; Fri, 2 Dec 2022 10:18:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15CFE3858404 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kGiE3FaO1iPhM3gJC0SfY2rdFiLdhMEpRxxjQVTyKFmkJDuz30qb5sLOtVUDoLeuaOqFZGGDEO5gyOOy/1ioc/Bi/wZ3xtV7lVraVPBt29sfUEJTeZu8fXjm3DN3lNY58x/EDzGxxxylq0UE2BrmK2QId/hCUDn6nRhMIf7UHC0KsML83bNK97VHgPE71+956afXpBot3qBTf5bXRwY0qjJV/FX7jqJt8uMCXoGEFqsD30Tt93rl4/iPYqTySp8WuJyayN90pqtdXjuigmhadM/7C87hnWfPLmaOBuz0z2UH4AMqcKXEHBN/U9sWGA1bR0XfCzdOLH6rQq4ioFoz4w== 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=51SgIDeKj0XCw+REQqHcVKeiNwluKu4/2RJ4J3whhvg=; b=Od2ZH4xAmNjIGWMFFY7sonToKSg1y+bEywEXG1UQSpbt5dFzpcXBM9XAFS20ZQHf+Cppz1rW1o5g2lFN5/lnLpVFLuhbJHgtmYNl2+36BWCIJpuz8Jc2bpLSnSqB87oMu6obPNy6j+l6sNyE0cyK3yIGeCtkSurytPnfDKpS00fGdNCLmuVLqzEwVhF+yoH8EWErfHMWFZDY9Mod44rIwvKDf5tp67OhJLsS0Vx9uRbXaMMxCxz5uFnHdD9Z7fCFKisQ3xk520G/kkx6uVjs75sH+UCtuQjYPBehbZXWBBnPeAodcW90E/YdbXGd+fTjraKjgx3EVA5cHknqesckfQ== 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 AM9PR04MB8321.eurprd04.prod.outlook.com (2603:10a6:20b:3ed::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.21; Fri, 2 Dec 2022 10:18:01 +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.5857.023; Fri, 2 Dec 2022 10:18:01 +0000 Message-ID: <8bfb1c56-8207-fe92-87ae-1b7ef26b3544@suse.com> Date: Fri, 2 Dec 2022 11:18:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 1/7] x86: constify parse_insn()'s input Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::23) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM9PR04MB8321:EE_ X-MS-Office365-Filtering-Correlation-Id: b5cab830-5862-472c-ab73-08dad44e7e34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /KeZfRkZwmBDKlDfKO35W17W/j4yEdUB6h5LGhlCjoio9qWFSVdWpreMsIWJL2vgAqS16jgiG/K0q0+YEW66sdINXvK7eQdS43IgrOiJg84/aS63+TJSnfjROojDc0Z/wx0IekfQHkamfMF0P5kbTVvKhmvDk2pwgPHCjixE3b1f3+JnQh+ekBzdBn25OX+j9aJaCeKxxe2c8fj6t+F63hjN+YPcjNViK9ZARmObwVCeb9pucP/X/k9MWO6+31lTV4lqwJzxy0VTy/KjkcKV+f3cuRBUw7YVIQRQM055XXN+1oENTLqPSCTmJUwBymZcHhdjk4fjaVs9Rk6wuZsX21aj892bFcdF4XR9OGfR7e/95n+bjvvZNDHBhRNYPBkYyNPDUarL3Cnm1dg4K+t4oqaiHi+iMOa/e7etRLRCVM8tsb45yND/v5xruI3YycbFgCeXP6urwQWqNXG7ys1rDf+q84btdXo2027rT0WuEcBwDN9Rv1dhLHw9r7xm5++sdQkJ+Ne7lFG+SnG2W3kYF66LyN0gjppwbREqZzwjndNWLsgd4Zxg2lJo/DBGdvRIvPfuMcKvR8MWDAWtL4b6aeMvduu548C5YCCFjQQgtXPHzPQifh5K24hDE8gnizyXuegICVIFtQvBdJ+guO3Dy72mMt1zNkFd4FwhP74mFbDBPV8M0iia/i/nnNtFi/4IWRynpK5GboOXiIkDvG0RIOTOi5HpBY8Orwj0o1V/DvI= 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)(136003)(376002)(346002)(366004)(39860400002)(396003)(451199015)(8676002)(4326008)(41300700001)(5660300002)(66476007)(66946007)(66556008)(316002)(2906002)(31686004)(8936002)(6916009)(6486002)(36756003)(478600001)(6506007)(26005)(6512007)(83380400001)(2616005)(31696002)(86362001)(38100700002)(186003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Akc0dE8IPzAbXh1b+WXrm/HE1Ykq?= =?utf-8?q?YeeSvHX5bMCRcFS2p7xp1s8govTBzhq3PSbqlL9vheogYL0nwh8bQx23rYdQjCQRn?= =?utf-8?q?4QzG/e7/EaLsO+7D/HCVwBM+mCadDFNAUvLLLRdfZRCIUxCMeEZVl2FmMKXc1ETDe?= =?utf-8?q?tsxAsgWYvNPEOnp4wBnx8at6QAmIepCYS9smVYqzae3zMxSZA+kGBrJalIJ7B9Pqt?= =?utf-8?q?3yEuUsZVM+UepDx07w0Dxmdz9X/DL1GvOpdQJJ8vVDWWcGBDM7zc945nor/90+6H/?= =?utf-8?q?ZE8W4KVdMuYDApfrA00/IiwFk2kaLFhW8aIIz2i0qoK5KarHkgj/UGzMARcPLjOzv?= =?utf-8?q?9GAoly/52z9YoFzhvyx6ahBk7PbLGF8hO3KZz2r6a54rQz4MflxQG7nQ9ecxinJ51?= =?utf-8?q?v5FI32cNSBKo+Waeg67CbCN+MGQ8VHxMpGgcuim0e21tacieRAClQZxMyCjJI/OQL?= =?utf-8?q?Y9EFOkItUHZsBqpFZybrrPv+JPNnx/LvcW6bRL1iPC1T2TK53zBkwj6fpOKGttMPE?= =?utf-8?q?Ki0iOoK0JYHLNoiDyPfFGMIxGWp60faXgxivBQ7aJ/reVPGFQtoeloT1Y2uAIJuQc?= =?utf-8?q?7QLUwe/dceHMuH/l7Y9jJKBMeu2WXjKk0cnEonSQcbveJjW4hTKY8PPdRw8ZwEh63?= =?utf-8?q?q0ctGSU+EaJJmfdUpdlhAnSZND9ZqHKNOWbK8Ld2XphbCelKAZPPWgPOcDtJ+hphJ?= =?utf-8?q?30x9pmwGcJ+o+yYDYVTj1zl3PfILAxBQqcTdhL3Ztn0Ufbh29YjlTfEjg9BZDS2Cp?= =?utf-8?q?UeXzZg0ELpDQ6rjcRwyge7a0Kh6BLVSpi3T0nBa20OAI6Fyv+DG+S33FNNqb+GmMd?= =?utf-8?q?AY5wxpGA1paJF5ijbpTbMsbIy3qyyQS+t5gxOH/pWNytJAFFmVZ3xaAhN17iOhPLg?= =?utf-8?q?0csunSrfMSlND8SRtF2AWRIyIV+YK7d81e9dopZ7t3ZmXOJUdpuC56KceL5Epnyyj?= =?utf-8?q?vnfleHL0KM2SX4/r3FOOVTeoVSt6fwg46BUDJhXb1xqNcpD0fWI7bB/n34wft76+J?= =?utf-8?q?V6MaufyArGvY0ioHZ1NezBFcPNm3sXUOHElf1RKhkNvNXoi+zAgQVm2tfQaWYMlnL?= =?utf-8?q?Sh28McL6X2iYFCrLfvojHDsjiHybNrGHvpybbMzGuVSUwBBJt5K7x8GJHse+1hfPF?= =?utf-8?q?3IraMyBqW1pAfQN9XXw0rN+NYdUcIQvgjpzXe5su7cty739xfZbRdlwbEDvK/f/Ms?= =?utf-8?q?XVxsl+5ywpiqWsLXFZJQFQxbuCMRr7tyGyT3oVoTNmuIYlXwXQF0viY2OdBGCvIZq?= =?utf-8?q?Dvnmqj6KN+W7aO0GRSvadl1Sfm4uJe95SJQl78gbPVPCA5wFvQtxuw9Y5puh2Hewz?= =?utf-8?q?uO5z4GwBKmr6kx3ffuJiZhk4r+3DyeKniXkVJBassmnSXLjfS3MscGeYSbeyg/Ep2?= =?utf-8?q?5LWWRTlL1u777RXtEQ7QwmURvCOvV4VkGbvA5o02NI22+fD6a+8Ns+T1tzLL0C23U?= =?utf-8?q?fX7PzLgbKV4gEKu92MIuqA7vlKfk6GWF9B+8rxM7mITOVlzdq5Cmh43nP4pV3kbI6?= =?utf-8?q?kUpkWeTvVzkK?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5cab830-5862-472c-ab73-08dad44e7e34 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:18:01.7046 (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: dLhXFyzZZjE0UBGxxKSSoVU4u6a4b9Gp7YUiK8yHa84aZhcEOXrV3vKTrrfCY7vmrfPkPJS/twtkW6v3WSecfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8321 X-Spam-Status: No, score=-3029.0 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?1751097062215878597?= X-GMAIL-MSGID: =?utf-8?q?1751097062215878597?= 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 @@ -158,7 +158,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); @@ -4845,6 +4845,7 @@ md_assemble (char *line) { unsigned int j; char mnemonic[MAX_MNEM_SIZE], mnem_suffix; + const char *end; const insn_template *t; /* Initialize globals. */ @@ -4860,9 +4861,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); @@ -5260,11 +5262,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 Dec 2 10:18:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 28855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp750880wrr; Fri, 2 Dec 2022 02:19:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf7tB0FkHqFtfPs9gHpmK5QG96r2+nEyrRgLLYpkxmdh1Udlnr4kXS7fthASoLCrj0+bI48P X-Received: by 2002:a17:907:cca3:b0:7c0:ba3a:6be0 with SMTP id up35-20020a170907cca300b007c0ba3a6be0mr3953309ejc.84.1669976357380; Fri, 02 Dec 2022 02:19:17 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w11-20020aa7d28b000000b0046b0cc42360si5262683edq.147.2022.12.02.02.19.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:19:17 -0800 (PST) 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=oot8ym5o; 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 2FA133857C45 for ; Fri, 2 Dec 2022 10:19:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FA133857C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976349; bh=bFEpQu+gK1GVJYE4m2Qo9x71eXol6NNHTNI1RzkwwDo=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=oot8ym5o2gDzvsj1OeBnSgNoDp/JXdNdtw4kbk4cQ/YgjWItXLML9wflvPlNVwDTA EvXA7I7O6frpTpHxVRxNCJsy9TWuRy7G134cvEaPxa22ZEzV+Q6HLSojraApvvqiPt 2UecoaT7BK4Tgxp6+uim6O3yHhfbbwdzC80LYuWA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2053.outbound.protection.outlook.com [40.107.105.53]) by sourceware.org (Postfix) with ESMTPS id 81607385841A for ; Fri, 2 Dec 2022 10:18:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 81607385841A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5aJ2I76vYIx4W1ud0I1zuy5TyoljpwmFXgZHKeHpOuxgn1MbYf5thv6OZ3+11pZCRb1V9CVHKiL+Z22c4Up/d1lzCvvhR7UUrTOAZjdb9jCF7xUsBj/9/SFzWxGhwpNhU74W1bxZIGEtNf4II8T8f1koIq2gNEAWGyKUXEcK0QJitphTNxEr12gkeFrOunbHNsrWHcQ9c5yKjW5Zsv/gOB0ovsXtZR5G2Trh1PUfvIOuFLd8wVS8WDqAhXrcusXvU7WCgWFMnqSCmgy0uBa8kJxNwloh8aXQd+CaFJtbCsvIxEWkwGe7eF8r1oJEuZwghlES274Q5G4lPmQWV23cQ== 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=bFEpQu+gK1GVJYE4m2Qo9x71eXol6NNHTNI1RzkwwDo=; b=l+mrL3FE012FhMO2es3ZSafcjoSxIL9oFzyF/vhU5BHlM71Fu5bKPaUQx7diPaRqdsTzRrvUuHs/pEZWAwQbRRm50phmTptTkVVfr2sZFpBu3CgLLdYgnQdLfksiXC4aPs4WQk4w+zIR8EgTpm5F3ABLJvNo3uYR6plOFGM4zxLYwD86lKT0kx3OSsKunbvE6O2m+qsupkqfrxVY/dgviaqMgzS8qrIDQ5dZKXzuc1GOoEICk9AYzSyxbXieH4pgMaLvI/OemOWRk5md0J01ObrdoGlBjTVT1bn+pheFf6K9L1eq27KZWV9YuLTuffyhY/vrYsiqNczbkr7w1ztiQg== 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 AM9PR04MB8321.eurprd04.prod.outlook.com (2603:10a6:20b:3ed::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.21; Fri, 2 Dec 2022 10:18:55 +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.5857.023; Fri, 2 Dec 2022 10:18:55 +0000 Message-ID: <6043f9b3-1ea1-ea4a-59ae-dcccf129c241@suse.com> Date: Fri, 2 Dec 2022 11:18:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 2/7] x86: re-work insn/suffix recognition Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0203.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::11) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM9PR04MB8321:EE_ X-MS-Office365-Filtering-Correlation-Id: 34ff57fb-608c-4c8b-c1a4-08dad44e9e1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WfHYUTV24C0SzjZDAD/G91CZzxiODYdQOBqVhlb2/bOcEWAZ1qb2CoYocq9obWiYSISnhXFMZoNabGjU0popumKoPClJpFQv2VcslNYCidtOmilUbFPOp5f4z8yv4CCfZZvaNgbL1j9BcG1CDl17Cm+bEWEUWiIb2MrzUuxuApALCDnbfVaCGqV/QQtjVsA6bQjSO17HGu17sVf1Ki4dKZIPIDHoEf2I5AIgYl2pGt6E0pCYTIuxGwLDF/np/3mzdUk/g+BxmRRlLgP9VVCvGqSHOb5iIn2KsNWmmn9BhOhk4WI4rbsdQTbWccvjVFYTWHfAND8UzVFTd4MjATYUpyneWcj4DGumTDTKzo3O/HcIUZfQbCrpsc1KJFyIR38RnnyeF2n+DkiqwKNV4izB51gtR7gz1+ArdrP1bj6aY8enQ6mhjy3eNnoWlCqGzj/HH4iRJTWLGZOSh48vlB32Mw82TGhx7Ro5eh12h5vPERr4lFE1BDSTIl5Rw8S79jv230PIPkk+qoTWgq1O/C8Cjo/5Xtgv3S2Um9Xl7DmK+BwHZ33uEXa27uLT6WyZu0IkHqyfGk1j0l0iC+LFnV+02WjmJ9TCPmZlqvoQSbpIn8Gg9vgmOAhMYwt9FHL/42tA5Kh6YwI/lcwf5ZiaUkr7EhiB6h/IOqyRmHKzlFeKFMByS4tcqcLTJdkKf506BCOfoibyXnx//ms7EE8ptI5lHuXpPCU+lrfsv9lkpCf9yYo= 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)(136003)(376002)(346002)(366004)(39860400002)(396003)(451199015)(8676002)(30864003)(4326008)(41300700001)(5660300002)(66476007)(66946007)(66556008)(316002)(2906002)(31686004)(8936002)(6916009)(6486002)(36756003)(478600001)(6506007)(26005)(6512007)(83380400001)(2616005)(31696002)(86362001)(38100700002)(186003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?a76nn3qAqMwKqny+3FnEBhSyRpdv?= =?utf-8?q?b6E3XPA98D4F/yoU3BXFzVdaLnYcsY6Iaiekojfi7qNYbghJPlDrUEGjQBAEmOTiF?= =?utf-8?q?8oxg4KGenp5o6ulxVtoXX2gRA+CISBWQPJtfKC/HOPYXmCBDRkV5bwGoHMfpih/3E?= =?utf-8?q?63kkWFnGWHwz0lQsuoOFeWdiH8uoD63BfPotXdPA9gybKkaKoh2z7pPk9TUuQYIF2?= =?utf-8?q?Wtnm/Da7CNJAyXpRcEQuhL09cduqeGqXDKwMClctJqLWhqpaxx4N/DVkXkz7X0Haw?= =?utf-8?q?lm58GqK9sEaiz81scamh3hSbkRof+yEDoLeOMzK2o8YdIz32zTfrX+vVsLaNKjnGu?= =?utf-8?q?hI6dCFoojg7ZI4zGYLF8cgZ1g2zBrsrtQ/wRA/Psk6GbWPDmpR7bToxstDXADmwhk?= =?utf-8?q?etAh9/+bkCGxw/CN9DXkClZ1kyQ8OR6IJAIvx1r2j5Pjnvn75bpDzyIVE4rtyTnPB?= =?utf-8?q?HA3s4SgzwTfMhUWLayBCwEF5dG+AG+iSl60RoUEYk/JiuWU8CdQfY8xG72FCy+Ey/?= =?utf-8?q?cVCKU7/V8ElH0OenAiqV7JK1Ru8DOElvUrmChCXPhYbobIE6Bwa+vn3/g7HwHrYuR?= =?utf-8?q?P8En+VuMVk9mcSbZjUeFben0O2kF+aNV5OI4JaZGWrqCnnSrUsVpvJyFjsKhmw/9h?= =?utf-8?q?WwZWe+tlOxWG/63I4/8r7MQXeUvvRBUmNKSsrO3CfPqJwHTkhpSqiY98IF2mH3v/C?= =?utf-8?q?bdhLrgsRGBRmZbujQlNguIHyUNgg9hkR+JL1Br6SqODWo2GF5nDr0SygXK/vux+WC?= =?utf-8?q?Un/w26EDmnQp3a+pz0bVmpCmoXGcq75gdbnAbz7rzBVpw3BmbKOQGVF2m5rDtJP2Q?= =?utf-8?q?AXx7bv+oVEZR3MdC007ytn0AHXvEw+ztTyrylSiqKRSLZHvUhtig8MUP2TsK4FIJZ?= =?utf-8?q?3wpGwBEM2zg5ao64xIWZrYnfLKQFzDW1C26c3KRYCL00jWvFHycyO/x9PRbdOrtmo?= =?utf-8?q?/xTcns+KjMThUWr2LkGNF/1NOMdstjJbwPCQnM/sfqzFcT8L3cTqJuhud1jootEGl?= =?utf-8?q?x9nkdiZ8O2X6VzRJCoD7bRhKht52ETkcjtzltFwP3F9tSA8B9IXCUjAhXqmlIG8+d?= =?utf-8?q?WIwppY1+gSAtjgWsStDtFCbhfmVDoLJfb5dxjblW3BufUCuXJNsxpVi4GemePu0mN?= =?utf-8?q?siytJDVf8gCnOr41ut92Y3Uwlq4EcM3mbN57RKlpSarX39jc4fCL7UuJpeoE5fD/V?= =?utf-8?q?DAwtD2JhdWI7Fn8OGHTIrvOeWNWC2ldbMIifV+5oh35q94mlIyn1slqFDo6sTtTQg?= =?utf-8?q?e5bpAdoi5RCSDIPRHhU8FIxzwOqNeNetqiavjWFkYB0Kp2yT37fSmc0qm90yRvuHN?= =?utf-8?q?ohsqxUc6YPEDO6rFAHESv/9E4qcX9g+/3NJ4S1UXRvQXjG0vIkKD7Bzkfsiyw2+hp?= =?utf-8?q?q0av286yIxMFeRY+QyeSejQhm4yxPCx+vhXsqqNXeqNf5QROYzzdROFY8WJjGYXro?= =?utf-8?q?nWUA08Zm1yOTlzSwJ1OvbrleWq24dxWQBljbYyt5/OT9mn0AlLYGn9ejswGMIXnUU?= =?utf-8?q?WqOCaQhGN/B8?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34ff57fb-608c-4c8b-c1a4-08dad44e9e1e X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:18:55.2637 (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: 1dCHLaAB5LYvlGkPjYzq6aFB6SVXsO70qLpJEGhmoi9u4ZKQHOfomOEmYVcFIvWFsSnJxS9dqzKk13eTK0zKGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8321 X-Spam-Status: No, score=-3029.0 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?1751097128960477052?= X-GMAIL-MSGID: =?utf-8?q?1751097128960477052?= 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? --- v7: Re-base. 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 @@ -298,9 +298,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; @@ -4299,7 +4296,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 @@ -4309,11 +4319,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 @@ -4836,6 +4841,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. */ @@ -4844,11 +4861,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++) @@ -4863,16 +4883,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. */ @@ -4950,7 +4980,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 @@ -5267,6 +5387,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; @@ -5436,8 +5557,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) { @@ -5479,13 +5602,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; } } @@ -6873,81 +7022,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; } @@ -11426,49 +11501,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) @@ -11619,17 +11651,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 ',' @@ -11837,8 +11858,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 @@ -1000,10 +1000,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 @@ -1048,10 +1045,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 @@ -1165,8 +1158,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 @@ -145,34 +145,27 @@ mov, 0xa0, None, CpuNo64, D|W|CheckRegSize|No_sSuf|No_qSuf, { Disp16|Disp32|Unspecified|Byte|Word|Dword, Acc|Byte|Word|Dword } mov, 0xa0, None, Cpu64, D|W|CheckRegSize|No_sSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } movabs, 0xa0, None, Cpu64, D|W|CheckRegSize|No_sSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } -movq, 0xa1, None, Cpu64, D|Size64|NoSuf, { Disp64|Unspecified|Qword, Acc|Qword } mov, 0x88, None, 0, D|W|CheckRegSize|Modrm|No_sSuf|HLEPrefixRelease, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0x89, None, Cpu64, D|Modrm|Size64|NoSuf|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, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32 } mov, 0xc6, 0, 0, W|Modrm|No_sSuf|HLEPrefixRelease|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0xc7, 0, Cpu64, Modrm|Size64|NoSuf|HLEPrefixRelease|Optimize, { Imm32S, Reg64|Qword|Unspecified|BaseIndex } mov, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|Optimize, { Imm64, Reg64 } movabs, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Imm64, Reg64 } -movq, 0xb8, None, Cpu64, Size64|NoSuf|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|NoRex64, { SReg, Reg16|Reg32|Reg64 } +mov, 0x8c, None, 0, RegMem|No_bSuf|No_sSuf|NoRex64, { SReg, Reg16|Reg32|Reg64 } mov, 0x8c, None, 0, D|Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { SReg, Word|Unspecified|BaseIndex } -movq, 0x8c, None, Cpu64, D|RegMem|NoSuf|NoRex64, { SReg, Reg64 } -mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_qSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } +mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|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, { Control, Reg32 } mov, 0xf20, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Control, Reg64 } -movq, 0xf20, None, Cpu64, D|RegMem|Size64|NoSuf|NoRex64, { Control, Reg64 } mov, 0xf21, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Debug, Reg32 } mov, 0xf21, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Debug, Reg64 } -movq, 0xf21, None, Cpu64, D|RegMem|Size64|NoSuf|NoRex64, { Debug, Reg64 } mov, 0xf24, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Test, Reg32 } // Move after swapping the bytes @@ -499,9 +492,6 @@ set, 0xf9, 0, Cpu386, Modrm| // String manipulation. cmps, 0xa6, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string compare. -cmpsd, 0xa7, None, Cpu386, Size32|NoSuf|IsString|RepPrefixOk, {} -cmpsd, 0xa7, None, Cpu386, Size32|NoSuf|IsStringEsOp0|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } scmp, 0xa6, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|IsString|RepPrefixOk, {} @@ -516,9 +506,6 @@ slod, 0xac, None, 0, W|No_sSuf|IsString| slod, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } movs, 0xa4, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string move. -movsd, 0xa5, None, Cpu386, Size32|NoSuf|IsString|RepPrefixOk, {} -movsd, 0xa5, None, Cpu386, Size32|NoSuf|IsStringEsOp1|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } smov, 0xa4, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} @@ -997,6 +984,7 @@ movd, 0x666e, None, CpuAVX, D|Modrm|Vex1 movd, 0x666e, None, CpuAVX|Cpu64, D|Modrm|Vex=1|Space0F|VexW1|NoSuf|Size64|SSE2AVX, { Reg64|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2, D|Modrm|IgnoreSize|NoSuf, { Reg32|Unspecified|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2|Cpu64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegXMM } +// The MMX templates have to remain after at least the SSE2AVX ones. movd, 0xf6e, None, CpuMMX, D|Modrm|IgnoreSize|NoSuf, { Reg32|Unspecified|BaseIndex, RegMMX } movd, 0xf6e, None, CpuMMX|Cpu64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegMMX } movq, 0xf37e, None, CpuAVX, Load|Modrm|Vex=1|Space0F|VexWIG|NoSuf|SSE2AVX, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } @@ -1005,6 +993,7 @@ movq, 0x666e, None, CpuAVX|Cpu64, D|Modr movq, 0xf30f7e, None, CpuSSE2, Load|Modrm|NoSuf, { Unspecified|Qword|BaseIndex|RegXMM, RegXMM } movq, 0x660fd6, None, CpuSSE2, Modrm|NoSuf, { RegXMM, Unspecified|Qword|BaseIndex|RegXMM } movq, 0x660f6e, None, CpuSSE2|Cpu64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegXMM } +// The MMX templates have to remain after at least the SSE2AVX ones. movq, 0xf6f, None, CpuMMX, D|Modrm|NoSuf, { Unspecified|Qword|BaseIndex|RegMMX, RegMMX } movq, 0xf6e, None, CpuMMX|Cpu64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegMMX } packssdw, 0x0f6b, None, , Modrm||NoSuf, { ||Unspecified|BaseIndex, } From patchwork Fri Dec 2 10:19:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 28856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp751287wrr; Fri, 2 Dec 2022 02:20:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ris45d4Fnky7xOK1EXV3nnol4j4XJhZPEFlzjaNc9jkpzgggG27RE43SccmZ8Bc5Sgjvd X-Received: by 2002:a17:906:6bd8:b0:78b:a8d:e76a with SMTP id t24-20020a1709066bd800b0078b0a8de76amr4557997ejs.725.1669976418028; Fri, 02 Dec 2022 02:20:18 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ho19-20020a1709070e9300b007ade664ee53si6868419ejc.148.2022.12.02.02.20.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:20:18 -0800 (PST) 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=I5bg0Is6; 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 82FFC3857B8E for ; Fri, 2 Dec 2022 10:20:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82FFC3857B8E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976414; bh=gRxXsPCgCEy7xCgffrYl4aUu/oBZqFtZWw2m46VG2Tw=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=I5bg0Is6vcFtk1xbzx74dnl9X99sUYJ/XW80fPwKKdcVge4jgMQpMJxzHGzVKeQtu RByG9Eff4jCx0RK5kEx07WiyOrFEYqboqwwKtyjdMswzMYKDygnNjD5lIDcA023q9P BKhIRYD9WutJ8C6Buc52N/ubaIqofqs0SLzbwIWo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2055.outbound.protection.outlook.com [40.107.105.55]) by sourceware.org (Postfix) with ESMTPS id A686838582A3 for ; Fri, 2 Dec 2022 10:19:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A686838582A3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITf/OYJoneWwxwFZMiJAgt/ywjM7w7QNyob1tUYVgx7zJbbjAV5t2ggrZOTcsbG4Pmp+UYjFMOKAlognLph3iTRtsQQVCWZ6vhIpcSBpfhiXBDJSBvqmS7YhQdDBC0O+J0idpWHPGtipqyi4mlW3FzalZofIH8m4VXQt+dKBmwlYk9AOkFbvSv4Fqxq3lsBhwiwDbUzStd3SKJhZGIcFjL0jpG71uO1iT8BL+GKCG2TCPSkxWdE7dv4s7qhh1SZqcJJ90f7sRfOXKzC9mH7ZoWweiWC3GkI20RvuKsz8DXa+slFBe8Ro3WJvAxGMzR35tCUQqybl7fl2LUpqW+RaOQ== 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=gRxXsPCgCEy7xCgffrYl4aUu/oBZqFtZWw2m46VG2Tw=; b=UoZ6jAyypO8EAniEojq24krTX5jiNEGXHlJIvAdjXKC4yhIsM8qaPVQLNJ9Ri5R5aunS60lY3ng+FJIpJ+S4AqSz/mApPTfdU3kopu1kkNnCJfUZeQ9pvRc2xA78vxXD9e+WTj7gBwVKUO3Zr8xOkx2viRtGc0BfAw7F664Eei+23kawPxfwaMAL/APqqo0aJxA+xW+PQkBXDe1L8nJi4RC/Zr4inS9eFWHAhUwh/KUOCAZCJCwnqkmOwPqktWS7y3nhMi/e45j9hCObheQxRM38pOye1LYHe01oNrH+sst8daG0q1zNzedSO3DqyxrcrS0VyB/H2lvkthkAfqCvBA== 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 AM9PR04MB8321.eurprd04.prod.outlook.com (2603:10a6:20b:3ed::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.21; Fri, 2 Dec 2022 10:19:33 +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.5857.023; Fri, 2 Dec 2022 10:19:33 +0000 Message-ID: Date: Fri, 2 Dec 2022 11:19:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 3/7] ix86: don't recognize/derive Q suffix in the common case Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0122.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::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_|AM9PR04MB8321:EE_ X-MS-Office365-Filtering-Correlation-Id: 67f43ead-7f7b-43bc-d0c3-08dad44eb499 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6mmfIUslwvHcUXQdbqom+sRYkg/S0Jd6SbXV0KSXQOpIj7c5U2Bw7g6djYkHv3jS+S8/o0D63jtw++VK4N8ltsdEKizpSaAmVu1s+Nu6eDO6bjMLrx7QeVATyoKKPIwJPta3L7rN8T3HDxgH6kGsHlG1HQqA1Xry/NQ5Fqk8dmcnz6ZdUg9B6zZ3/ZkgL+f6EXOE/Fl+hO0hVmK5Mn/vLTqXbL6apum/uOhsjKi/eC1NTb4+bqiYB5h5+5dlP6t6TDseaRjumKRtQ4mlgBlfd2nY7yU5Rny3l3cWjFXzHH6BSjpGfNiJZxfae/is06FYXlidDvLJp/AzuEnjqn0NN9lwPBNCRbHODZNy4b3txnOgF8fGhfqanLV28RnBIlL2KOFEU25lgiBO8iNZEU3Qxofx3REUTmCzGM8YC2YV+9OmH+65U12bfgALSDzsaIwumN/YfaDJB87f4zJLrHHdIn5ccGHIURkmKiY8X6bSp+EUTu1qO7ijzLGoeo7R6d5P4nqYEgxkWsDGxanjBYJZ2l34w+cogeRlQ73Yp3B6SW4ZkjpmwvFq6LE4Sfm4+pUC6b9VCV5zbp1XaUaCht/6DPjgJaMkMKNRcAONKFNTf16GeKBpqh/gSN0IKYht5s/QYQAO3lw7NAcH3k4vB/s40o3FallEAB8OURzgVAElRbYkuDfiq0xfAPSsZqt2qZ+EojWYkaoRHqSHiBy3U+/mkffsD54Bd53MU3/aG/P95V0= 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)(136003)(376002)(346002)(366004)(39860400002)(396003)(451199015)(8676002)(30864003)(4326008)(41300700001)(5660300002)(66476007)(66946007)(66556008)(316002)(2906002)(31686004)(8936002)(6916009)(6486002)(36756003)(478600001)(6506007)(26005)(6512007)(83380400001)(2616005)(31696002)(86362001)(38100700002)(186003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?N5rxPD9SYQbiG5A5UR0FtSAEhigI?= =?utf-8?q?5XmnkJ1Rw2VI7m966KJXlEo5dNSGPngRhr+vkfwby7rXP+iHuFmrqW+aVb6Bgg1jr?= =?utf-8?q?mDjquPmU5BR8EDrh+Y4zSi57YVfa99vea3yj489E+ASxJCD4YwkGIrbIZPeOs+weB?= =?utf-8?q?n8orMCfyaRXr2X0JqcbCIrsn/M8eA0IpjlmvDFmys+NwiOKmuBjntMLoq9Mw954Hd?= =?utf-8?q?L2AapAoQkOAavEm7rHz8HdcwCeD1eqiyUPEBQ8iVqlTMSNyhkf7DEcYBB/enap/aP?= =?utf-8?q?D1Qo51ClQfsI2ZU+0ndVvos79kjcaMZSZewdD5rDzmLDh6O1KZx8gMlNx7IZtf+//?= =?utf-8?q?SffAqi7LIKETFh2bXU/dLSJkxg2tHEP0Wp+zDG8XUhEgrZFx7hOd2DcKhKYWKb/Un?= =?utf-8?q?cBERULmSm+Pjm6ENMR6BIy/EwideUzWA4PVupBWPo90xa2porK8KK33BLdfA+q2dZ?= =?utf-8?q?9vTy5gKhM1cGTW/3C8ECVr9mVvfTWqRUiRPU+vmg8kNVabpu2sCVdF4Bx5dvFIdGK?= =?utf-8?q?uaRYFp5vOE/FtwHqHLDTp2QoorklBJXm8c8OVIe3RyV9cH5XTs8PqvpxK57QTVnJP?= =?utf-8?q?U/S9CNwZhBHjEtSyeF2KjyCAIrARbwDt9BDYC0UNTBqvexaP8sdZJtvwCKTWQcwOt?= =?utf-8?q?r0jz0KnVQlVK6m18nRSa87rdn9AT2K0JBfE7fgJ/wyUteOB/o3OO2tn4Ea55HnZv+?= =?utf-8?q?U1bSMDqe974dGaN9bDg6xLKgOKUjt5ttY0KRHz5qv6yi9whCxqhSOzICoWSU8STh8?= =?utf-8?q?nGEaQc4ZHJ6G9OUQ5o589rMiw1m/QEPltsk/eP0ikrdThK/UiamKD1k1AH7tuE8EK?= =?utf-8?q?TNwWyL5uIbV6HtRZ7MSgHT0hXlu+NlBiDBLmB1VA32ASTCGFDPco0nemwXP7JVtBc?= =?utf-8?q?nXj7Dytj3TgHim0W2/OUaRwcEeXFDATsAVnf1fSSq/RgCqEvnx107axo2wpfDFOTP?= =?utf-8?q?UF4XVoS1CntHjLK0wKYCXWgwrk7Lvx/XN/NVjW6/KJbOOtGS8xcZ/d/MVc6O6XPnP?= =?utf-8?q?QM8filEvXoDBlHyo0F7RAvTJLjwqNlKWWrciH9SnJjwA5x8HMLNp63QMWgZSeYWTx?= =?utf-8?q?tOzZmHDASc/j4aiTAo9BWgFA3yBRxOJ2+6TZ/X9Kcop4ZZz2pAM/FZOac4+4MLwzA?= =?utf-8?q?VMBGH8EIreUJk5atwACQhVlSMKcI1Q6mryjLIq9OjKJkjeA2zeep3+tIZSwl9Km+5?= =?utf-8?q?KQmELUfnnz1DWDoDqZTlOPMao8tJRRoOpvt4O5FIMIZNEW9LNl1pdsLjGrQwkbsWr?= =?utf-8?q?AXarve6KIToA57GjVuxCGbkQV6q3DUpxy3ivKIXPYmVf6LCSmLGJpKRVVNndZeEhI?= =?utf-8?q?UiJatZ0jKnca2crldowh13lqNjy/D3tWF8DPXGY3N5jXsgsNmxk5yAF57GnTeskgt?= =?utf-8?q?fdhim/Yh2kydj0CxLDpCGtApsXIOKwR81he9jD888Y9eF9+wISgdvE6L/S+r7xmm+?= =?utf-8?q?GcBgXvPas35rt8rjEUJzUB4FFdabfxha7jwGJnzHU0Pnqq3qb9WBTYrYXWAlpEOYe?= =?utf-8?q?0WyofOwmO+wt?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67f43ead-7f7b-43bc-d0c3-08dad44eb499 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:19:32.9957 (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: 6AAX3v1safmxfgltid8pF9V4m7wOr3RP5tsKAwPxSP/sb+CTW+Jjn2c86BKtMSmYlzs8PYz3ybpp17rhcMUR4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8321 X-Spam-Status: No, score=-3029.0 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?1751097192403480384?= X-GMAIL-MSGID: =?utf-8?q?1751097192403480384?= 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 @@ -237,6 +237,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, @@ -4861,7 +4863,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; @@ -4886,6 +4888,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)) @@ -4987,12 +4999,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: @@ -5025,6 +5046,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; @@ -5382,6 +5420,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) { @@ -5677,20 +5732,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; } @@ -6687,20 +6743,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 @@ -828,7 +828,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 Dec 2 10:20:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 28857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp751326wrr; Fri, 2 Dec 2022 02:20:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf6JbQO0RXeOiYcRKWwUEZX6vrLPX6o8zS8ty5xYWuiO6TiIQkMEYnssVibwKxBKI9S+b6Wc X-Received: by 2002:a05:6402:396:b0:46b:9c63:fa87 with SMTP id o22-20020a056402039600b0046b9c63fa87mr12717978edv.100.1669976425464; Fri, 02 Dec 2022 02:20:25 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y12-20020a056402440c00b00469d35e2f13si6473931eda.522.2022.12.02.02.20.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:20:25 -0800 (PST) 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=XhvOcosw; 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 A67243857C51 for ; Fri, 2 Dec 2022 10:20:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A67243857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976420; bh=lCtK8FmYrYGq/7BjbK2aULFnA71mQRZ8iFdEmeUV2lM=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=XhvOcoswh7L6K2LzFnhZeVYnQ0GMHns0/MqfsT+wZ1yeMzZc7Xle0XrLmJd8JZJU8 EB4oTjGgxaQXUgJAoGBTdM5sMqMbGSzDqKf9NuIwpDANd3e5HedkdhUJKl/DihgA81 Kdxm3ro/XvMQ8Wr+jMOSEVjEUEfOVmuffYkePAbo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2042.outbound.protection.outlook.com [40.107.6.42]) by sourceware.org (Postfix) with ESMTPS id 185453858C60 for ; Fri, 2 Dec 2022 10:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 185453858C60 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSIo3Jt4QkuJijGKofFYuS9nX2HBtKrR5mC/7e7rZaoCtUfgzM6qZeVkUKn1o2Ndz3+DB02Eh8fAJrDsTWFdN7oIg9Zs52IYmFnkhqqMhUPPvKU56fP+adOGTXKUU/8NMrHxuGEBDBqc13kjBRZ5vS3F3lsTeMbnZQo7gqZyc9WbuQjM/xH8iLORNlOKR9ona1i0PS3zWvaJBuZ939ZIGG7ljwgqhtpT4Cbpo4awCS/dSTc7e4uvXPJt9SVJMUJlbCI9LQU2r4dH4lsnHoZ1mTcmlm8Q4NQejmIOXPu1sTezbfv1PLDYj4GqPvMK6eU6Q1CrvHqLG/Y4p/YavrgW9w== 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=lCtK8FmYrYGq/7BjbK2aULFnA71mQRZ8iFdEmeUV2lM=; b=TI5Nc0DjfcfNSJwb6m9qYQRiDJba2R0OM5MieW2jgwO/+Q4nlIZYWKRUOf5+K8sioPY7FdH2y+8YxDZVDeUD9CmG9l6jwGJqUUgYgqMMffX0kPJNQJOXEQU1nSt2jfpBuKBefytCnFCES+cSd7H6t+3ad4ilWelX05PWXcp0WSF1ApAZUnkSfJWtet+Spt/mgiC1tFQes0/s/2v1AK6JA2fUUyMAf6ZzQ/yBxKyJsotFRCwub6oaUypmJG7jut4TfHS4CWKtLCf663YxxXrV/VQ+0+aec4uRDu/vpiFM9EoRlHo6r9mujn0CvR/K9w+sLC7GKg5RKkiXcEHWgy1r/Q== 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 AM8PR04MB7409.eurprd04.prod.outlook.com (2603:10a6:20b:1c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Fri, 2 Dec 2022 10:20:08 +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.5857.023; Fri, 2 Dec 2022 10:20:07 +0000 Message-ID: <77fa4300-e192-5b9d-d699-37255054d391@suse.com> Date: Fri, 2 Dec 2022 11:20:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 4/7] x86-64: allow HLE store of accumulator to absolute 32-bit address Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0160.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::15) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7409:EE_ X-MS-Office365-Filtering-Correlation-Id: 9512888d-6ebe-4c2b-ee46-08dad44ec8f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PoW2h98RHKE8pOchnSRF9l/9yp69CRQVI6GVS2uKsAYa8n+h9SVkKWLw4oXlhLKHtuYLXHjwR2aCEYH9Ib60mSbqdqX2J3iXVEi+MZM7hZJzNd64dFj+oPnvQx1SfvZlDvr7ugptXUe3YBeiIzsbm8X57BII4btiKjGc97edcoZmamYyxaH7HoEkjSH7BlWQQ6nd2QiCgLnKFpTjK+ZMak5GbikDlRQxnziMkZyN3mx1/3SvpFPRdhtDNRjGqegCWiF9om8B43x0xPMN0/jKC3TPl4dnUaLmeAEzhNW22MsioPBhnqrjkYbMtX30aIUxmM72m/UcnTlzZQ9V/hX4O+OZ7kfEiisufeGSt6aqjW/GAJZWtDUdrLpB5JDYxnwCPKUWv8nnF8g9/kQZ8Lm9ud7IcKrtIpzst4lntUdbIxXLjfZPXh9K7G9ofRoB1xHZzdfXJtyY7KL428JveZb1ecMyCvEYL+I5UtjdBLoHQ7HIhGmiluoWh309PqMrWITST9bbWPOlqH8XIfKTQ96Qe32aBY4TRlB6O6CgbSjH8FlV0ZZvVvpD9GOuT6A2Y8QPhUAU/qySxDFrsxkLxwYmzbmYE/9L1QuJ1G1mLkAAmkiiXHse44j9opEkfXFS276YzFYTKdNU1jyw5COU1VlwG3YptALItBf3p29dsXYm4e3r5pIn0fZUBPJDDEMvaZxhDUkJvs6ehiT3f/Zr3kx2NBsWTZcwV1PiRP++ql5qskA= 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)(39860400002)(346002)(136003)(366004)(396003)(376002)(451199015)(31686004)(2616005)(2906002)(26005)(36756003)(8936002)(6486002)(6512007)(5660300002)(31696002)(86362001)(41300700001)(6506007)(66476007)(478600001)(186003)(66556008)(66946007)(38100700002)(6916009)(316002)(8676002)(83380400001)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pKbtwAp19k8h7SQM7yGU2PiidH9K?= =?utf-8?q?b/gb617vqu9EoQXViRoGnRhTNp6VWXlSRH6NJ1ajPjbfuxVWf6sAIO7lmWUV86Shm?= =?utf-8?q?Qxdk6+XUZ9VgYPi2itxbiicGOH1YS29VLU+j9um4iN5SQLS2ykGxh8E0rTiXIHMVH?= =?utf-8?q?UhF/dzvYfPFKQWMS/XAExeGlNdfGs/xxJ5eAiqXzvwDWXtINm6HsMhDdsrwdMbOaU?= =?utf-8?q?1T2adJ4sunmd9X7y22iL3TYzfrgzY7bjKm5wIZKolJpcNqy0YzSs2wTdh496R/0LQ?= =?utf-8?q?mTEUoXGRkXUCTZm4xh4fK3lJwCR4bcFalEmHmGroUqEApP42/52rTIHBNM4T6qLE1?= =?utf-8?q?Eaf0HIZbJWjeVRSsrTslckopJod2XqMw1REo3Bc5yJlUu988xNQ7HPMwofsB8hKzU?= =?utf-8?q?8GJ/MfvOUh3nb/47MWr52O2bV3UjYuMd+RMCo5tGT1jkb86LlsqX3rg/dOtYBPnDa?= =?utf-8?q?520PHEudSQ+fuo4RgKWlzKCzwD/bOEvnKJfqNJVdzghybzSZ64fowiFhMNNAHn60N?= =?utf-8?q?wP20mCAuhh3/br5gYU7kGEqIC91OKbk7d0BrDL4g7uIXb+cwXC0ONeYsij7kVmcgO?= =?utf-8?q?qhxHQWEQrqYqGEJIn5gnhvSqOISKCuXJSgGjZZhzcxVyzqKhzdpDLm+5D9YZCqvKC?= =?utf-8?q?idfRqb+cwx8kKxDd7YlZkMP/nNE+r97AU0gYwFT06iMSGhtijQyzTnONjrMh8rr7m?= =?utf-8?q?uZppLf0ce9o3sx9Fg3ooX20ZtLSJfvgEVN7f27tZnETyCE1NG1tC7uJ06raWW4E43?= =?utf-8?q?n8xQazJakrAk4yiIMHOmhn0jroFHB0RAjhYu5b9fOQqPPLsQQn9HhRJRThUPMynJ4?= =?utf-8?q?7QdmUCVroZBolZ/Io9pNZ0DoTX9RNgzth3Gqp54BJclH16VRdhA1tuNALIA2Dze5b?= =?utf-8?q?d3TqK1koG+Pf/wekF9ZojboFo3yg1elGTy+nDs8H2dGw0hqvLXRg4CbK45E5QYx0j?= =?utf-8?q?q1NqnLl4R6eCOW6L8ivg9WxiT/zwP4dnTaKtEzi7VbmUlcJinobTb3kIbefFPJa8F?= =?utf-8?q?OT3CbWNQkcRrQTm2DW/OiDPhd1E45Cwmjz3PncATC1larah4WKMfxvIWYVW6I6ErX?= =?utf-8?q?jr6Qgi2HMcoKtfjFO4HGV7R8STjw3VMSgTBjv0tcOs/y9CP8xVWzbKIXNndeAYez9?= =?utf-8?q?yyX5Aq6anoKgZPgAHwavIFh/eUuRdBhoMxnUFDyat6zv/5IRs6HuMhPIiBVUs98Jv?= =?utf-8?q?63bPn1aJB3QCGcJqszlNWRP7I/18/M5/tM645Re+Du3E/FAI1AjWqbKD0EwPgaDYP?= =?utf-8?q?EfbL2DghSr47Dj36zf3Pl3w0Zu3fR2cdFb47CNTu3fcbEAmqKNlQ9z8z+EwwZwHYG?= =?utf-8?q?l42DsvlwBWztRCYEVfMV/9BunqlD2EECglsH22jFthCz7M7Gk4eRidvsisbsAk0PB?= =?utf-8?q?P2qr3uav6PomJDGP4gd7oTBkU/LWWaiIVCIiY8lJv8ARd2Wdv8RJeITDVWM0PdeiR?= =?utf-8?q?gA07K7RxN+cY36iRBI2DZihsAqKylNSkNbQ00JHcwamc/W/h/l8g2EyUObB/kPqRX?= =?utf-8?q?JOzbMEO2HUeP?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9512888d-6ebe-4c2b-ee46-08dad44ec8f2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:20:07.1966 (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: P27neO6Nmkrur7lMVAWUvPJkfub64GnpgW7QQRRE0JkjXkPfwOl+YMqq0S9ZrSxTBQo8utq9VkLMybNMZ+fOyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7409 X-Spam-Status: No, score=-3029.0 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?1751097200152572621?= X-GMAIL-MSGID: =?utf-8?q?1751097200152572621?= 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 @@ -6870,12 +6870,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 Dec 2 10:20: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: 28860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp751852wrr; Fri, 2 Dec 2022 02:21:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf4g8jEFQt63wPFpmmQy0ksl0YRkWtpfYtDNSq/BVgAWR5M2MSYmCezCAndsv11n3NUhvNxe X-Received: by 2002:a05:6402:3214:b0:459:278b:7a8b with SMTP id g20-20020a056402321400b00459278b7a8bmr48632926eda.355.1669976518676; Fri, 02 Dec 2022 02:21:58 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sa7-20020a1709076d0700b007316ac034acsi6922323ejc.834.2022.12.02.02.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:21:58 -0800 (PST) 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=Ois3Q0k7; 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 215A63858417 for ; Fri, 2 Dec 2022 10:21:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 215A63858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976478; bh=pXi4uz4U72kLOQ6gNTPYXEjFgpu3JKl+h7WiFLZrgJU=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Ois3Q0k7Yw9MwLSW64DLmlqmJhNXwFLdzc83gugatfR4QWRNkImbr5uQfkIxOBIC6 7Hy7hByvsPGQeoPrUxQm21CT0M2zU8RBVX0a2E4WxlkNP8Px9NroskTolpOHUHkyhu 8PtpRLfUvL7iWtgR1nsDyRAdWssHmaKK77nAeNeA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2059.outbound.protection.outlook.com [40.107.7.59]) by sourceware.org (Postfix) with ESMTPS id AC238385703F for ; Fri, 2 Dec 2022 10:20:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC238385703F ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LqYPqy341/pYHCG4bceScbhNp512druzrguZ/eMJEI3wln+WPesgjAk4pyOEKakblFXU80g34qq8EiZ8nNAhdOkyRpj+jujsTM4+lm3hws/TOkop15NN9+JwulerKCeMraxUgE6WF4CLxS0rht2tpvFja4Q6SfcIGkbXWJoy2rt/TljemNVCRBp7IrkXUhz4AOmmh9yB3PUyX93CAu6zI0HJoruBjHHPg7OGJv/BgkM2jAVeCTBeswjk8zFYyvzLZ8kqImRjouW/jZcNpHbiyRn9wlLbjfC5QQgvjjFwgXB8qidRYUf4Kt4s3a25hxpSA3T+F2duLZFVYaxn4fu47g== 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=pXi4uz4U72kLOQ6gNTPYXEjFgpu3JKl+h7WiFLZrgJU=; b=kxHEvTeHkMmaNP41GfAk28LMOgwC2bz+zbpCJ0nx3XH1OnUw+KavdmCmf1LJ8+zBaEvjTEITcP51pWYi6+42zEKWYSc8vsuQ5llw1nBu2YSBwCyHUEroVkc2/viDudetq7oP/CXGfWdCyZ+RvDf/Jw0ueuuKzMnGjYCDmpwVoV3ce9qAPrFif0JqcWPtiAtzteNyij9TXyZYBL9AP5ZPCjXTlkdpXnZwa1rRvzL6Ycz7HRHw49P5uG031ptfJLf8yu3mUXWPI8d1CTg/hVJMpaOJHXUk/aTiVXDab63Tqbs5VsFiYknnLo+gcmNIXJ5ZLxO1/dSFdk3rJljayJVEGA== 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 AM8PR04MB7409.eurprd04.prod.outlook.com (2603:10a6:20b:1c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Fri, 2 Dec 2022 10:20: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.5857.023; Fri, 2 Dec 2022 10:20:35 +0000 Message-ID: Date: Fri, 2 Dec 2022 11:20:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 5/7] x86: move bad-use-of-TLS-reloc check Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0083.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::21) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7409:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f46886d-0dae-41c6-527f-08dad44eda1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XTq9gSGNa/t5+YZhjKLEZgCs+Dxeb/i5H4aQcSZ+avkUpyjqae90DcmQ/IebJOdTj5XfVYrkNYG/4gn9g8tVmxDOiZNWNBa6JBl5cChVtwhWM0X3m6ipbRNZiZDd7bMTFIJsf9CAkphV7/GSw8zel7T1BJI2ISctGNzgOLNifM4RIBWuivPOIFUZZGxPJo4SWlF8OEwH3rihTmQSrrNEkecSpa22RhSlw/YGLNsOUOMiBuymmOSt8eIzESynUQ3s2lIv6S/RBITpautYTioxk4SVpkGE5JD/uStHJcnePF8mi7IZvT2bB49w/JWfNVGvJ1xp/vycj0/RxCPmxRfFdhacYY3x2hfJjzV4kNsFmPfVYX5UkfWzhSiu3QOP+w3eeCjB1EljvI5zfZd0YxY02ojT8cHPP70QiU5F1TqFF6cV8tShvQgIoXQKovO6803ZN5Csw1A3PE0KPOq910IctGODJqE/QTYuIoqME8mO6jox+Wx8F7jcmkVXnJYLRagVkWsxGkUEsKABzGs6tJNpBsXsajinS5/vP2n8O1G9w/0FBIEO5T/AXL00pNOtWvPMZYFQwhd/gGbwvxuiNG5Xg95+hXAAZGP+8nQNLxJ50RQt87AnO8yD+YPuv2kSVdPWGMeQ/dKGyfgUn5vUcz6IkzzksSpE9AWE7QBen46k/blhJDdWfE3DjoEkEKYE7XV6anVr2XUKM3dihuvj2ia/J6z7vHnL+MwS7r1w4V+VOzs= 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)(39860400002)(346002)(136003)(366004)(396003)(376002)(451199015)(31686004)(2616005)(2906002)(26005)(36756003)(8936002)(6486002)(6512007)(5660300002)(31696002)(86362001)(41300700001)(6506007)(66476007)(478600001)(186003)(66556008)(66946007)(38100700002)(6916009)(316002)(8676002)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1fWKa1suKoc99M42bJ7QjarCwHh2?= =?utf-8?q?n4ymzhwL27xwvXeslLMST/Q6IOX7cq3pTRbF7azHWuEoMsS3g03mDZYkSdK+XgPLm?= =?utf-8?q?FGiwyaFSI/xJlunEjNeam812JeP8oXe9D7nkE7nfqaGzCZ+Wjg30vLX4mpy7xeKkk?= =?utf-8?q?DQvSCI940tyEG3Tx7TqcyxowYKtYNu/1wDEl4wREfl0W7IN+xRDGdQ0cq0Y6iAzjy?= =?utf-8?q?YH0oH/vds+UT22jxfuSFnOiWL38RDEk+rAqNGKYSg716Uatw1j+SQSj0ZIhTz5vIY?= =?utf-8?q?vm87izCxJJtVqTJ1FdPs+NWon8hm8nkxyhTbFc4ARVvumRwVDIYSlPfD3TJGw7p3m?= =?utf-8?q?+Zl6J7PyHNsoPQ3qvdX7MmHhS9YqktGvJEAi7udi8/YDDZFvrjFYSSz/L8mBKZzsd?= =?utf-8?q?qLBGgATSGt4ATnrTDSdM7+uraCy7vh7Ew2E+O8he76j8aKuws6bhp27qtlqpe/mfx?= =?utf-8?q?ZpJRAVf8RiZhnrXFL8FQUUZ26SiaEJShn86kjQiOGKcbkTq5CPYbYch2gQ1l+HTeU?= =?utf-8?q?91HwXraH1fSJbN5gJEogJ0eRW0vvDtl4iwSZ2JWeCXNTsrBsUhePtJTRtzv6wBO15?= =?utf-8?q?fwtLDYGcar9CIb7HxjT4W5afosQRHh5MITC3dQL4saKC68/y5Q6D/6tOy8okfXaNZ?= =?utf-8?q?i0N+amvAxQSus/K6mUte7tE291XjcXapKLGeOom38zBpHd5V0t6dE2JCYjJKRo5BK?= =?utf-8?q?NwQqeHeqXaPpUJAGxdc2BsorjhAdViD9/rqo0WRx2rgvnWhiX+5+5Tp/SKWOk2a79?= =?utf-8?q?QRqcInRMz95vS/w+wsQw+f9+F0pBXC+qIvruOebN46Oy6qoQgdmMEMNjpSnofhOnf?= =?utf-8?q?BVlNBXW9VUHUB64/If6PtUcJ+C2sII9xPl94LioBuSsQMb6erXE8jpkCtHuarPxrV?= =?utf-8?q?W/O823R0jvK3y+Rifp2m7BkZK8zGV9iJUWFFj6eKtslgWzcTiOEnSXU2L6RZu3CSH?= =?utf-8?q?NU/TFVdalx7ABn83V02DKK7SCssgYY211hHq13hKXC5I/sc9FYTj2uuLFsSePgteg?= =?utf-8?q?6LWzNaIlGPAeApKLI1fBS0odxzq9pUNU+PlFLUJNyALBepWMQyEXOvliQMZYijB8y?= =?utf-8?q?5Nfe+fGQ2OJvu0VlVZwtNbA9QHxAOLkaYvmE4uCQEJHCm7IE7C2bBVcDvBplyiV4n?= =?utf-8?q?rhkSyqrqeXLMwlHHSasxcfl3ZdamgxbC3F0QCpng2F98FAwdmwe6coqM4DOwqvldE?= =?utf-8?q?8TRfYDlHqXOKIVHXQ5EZ4wGeCO2sGDHtxKyCA3WqWFsahnOIWl/mfuEu1eHWQ2u65?= =?utf-8?q?evYriVinZ1rsRVxTPLon208FzLx3nhdzzeZZQNVXPVOURwHCI35Ig0loxbRHtdSlN?= =?utf-8?q?c5Iffg+Oxvro+Lndh4KrewHV5K16V75xRi7vjfLm73MjQVKAec0KkC1Tx/0bCZGLD?= =?utf-8?q?3XntzGQdjOGoAZPMSbbkV5KzBb6fvwoyYVc7KfmBxlx7OkSDyKYMY3RML/GXREmiT?= =?utf-8?q?sUFEimnTnHO6tYpIn6PqSUSFLjZNCArEQlNlAf1QLSHI433el0EDJ4Pn27npXPP+n?= =?utf-8?q?UMjf+zwY+p/s?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f46886d-0dae-41c6-527f-08dad44eda1a X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:20:35.8823 (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: 9D8dDv8BhVJSJ5V3NFAD5M3wxeMtUQ80W2kUowd3PHoYdXRqknuXnqql5LyJYXVStQV+YeYBrv43bs5DBPpFpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7409 X-Spam-Status: No, score=-3029.0 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?1751097298190806613?= X-GMAIL-MSGID: =?utf-8?q?1751097298190806613?= 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 @@ -5158,14 +5158,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. */ @@ -6819,26 +6835,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) { @@ -6868,12 +6864,19 @@ match_template (char mnem_suffix) && i.types[0].bitfield.dword && i.types[1].bitfield.instance == Accum) 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 Dec 2 10:21: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: 28859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp751834wrr; Fri, 2 Dec 2022 02:21:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5MIENasYe4H6jgEZNwZ2l0JeFSEo3OSxUGt0xIS4HJVYCvmTVE3Sb98loUrDOaraI+SU44 X-Received: by 2002:a05:6402:5021:b0:460:5340:d522 with SMTP id p33-20020a056402502100b004605340d522mr51773315eda.87.1669976514592; Fri, 02 Dec 2022 02:21:54 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hs33-20020a1709073ea100b007a7a3b40920si6767469ejc.995.2022.12.02.02.21.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:21:54 -0800 (PST) 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=sDOJ6Cfe; 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 750DC385457F for ; Fri, 2 Dec 2022 10:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 750DC385457F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976475; bh=FYwz0qyr/ShyMkcaU/mcaY0R8ouqOWG8kBYEMIYxMV8=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=sDOJ6CfetF/QBGZG6rX60uSs7pZGwD+NE/LuBdMCZ4EwpW7198z/1oGDKhN+FODSC 31dKNmLFav4Zn3CdSEBU22ufWteZQG5vAGVeBjIsK/Uav90wFF6fRuIkyQY0BtISk2 YhYJ2OtVKuMYFDyAMNdWKjPzEGGCZN7Z0LvJNPvo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2057.outbound.protection.outlook.com [40.107.7.57]) by sourceware.org (Postfix) with ESMTPS id 7F47A385C301 for ; Fri, 2 Dec 2022 10:21:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F47A385C301 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CRDfA6efAbh+9dMt/NOAwu2LVQiNas6mxV/TbHY6v6nEOlEokxfAaZ+gONbSHqYJ8UQ8RvD7nPMOeYjecbtwgXRCiARud5axE4+r7f8IZdsh53V9ZG8CKqdzhyeSbQqvuxfel4DhcbB/mXph3s5fEEDDBASTWmID/wrxj25r6Ntft/AekY7yG63dBaMbAerLX1/ASmpHt99iTyb1O7wBQkvMCCX6LFx2HodBSA7Yld0QKMgb6ttyeiP0eHpioX72GgwNQVar3YowJu+jUyrDXQOU2Q5RZ9dPpS+8L+GaWGs8IDVxVkO9gDnlRScmLJFaxgmRfej8B5GOgBXHZXD1lw== 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=FYwz0qyr/ShyMkcaU/mcaY0R8ouqOWG8kBYEMIYxMV8=; b=TiSOwp2hppOtzRSh3eDpSvQk2fcbi9sRdCec8ESbx1uoBNRkkvsrWHknyuk5/iYT6hcL16HIH+my4EvQLdHTjSTFtNCpKkImzUp0Dax5KWal+WIepU4kj7bFRnx46BUsuJ8u1/FyMmH19xDeIKJF1c1bLVBMHM3sNAPygFfFZMtskPiMTtd16rxvvUEMVLaoKcPAUYHg2EIPQ7o2GCygG0YnywNTAXWSboGAIAQFlZaMU/qA8TkHRiKGjGkoj2wrjhkXem07dXW6u5om1mBS9sugVEDXtsSj4vhoe+ywT0pWD1lkwOVEkHMpp4NjEX5HU9gxRlBkNnute4j5gCL8Fw== 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 AM8PR04MB7409.eurprd04.prod.outlook.com (2603:10a6:20b:1c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Fri, 2 Dec 2022 10:21: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.5857.023; Fri, 2 Dec 2022 10:21:04 +0000 Message-ID: Date: Fri, 2 Dec 2022 11:21:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 6/7] x86: drop (now) stray IsString Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR0P281CA0067.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::21) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7409:EE_ X-MS-Office365-Filtering-Correlation-Id: 44fe16b0-91c2-4eec-0c61-08dad44eead4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DRvhxvp5tOOfcNz1/0tqZ4lhAahDie3Pkpi0Y5VrjQN0WGB7pUmjbbSMlWEnZcRnFx06wv8+aXz8GvT4eq5yLaXrzhrGzUgSyQurdoKG+cu3M8XPB51GS9ZBvijkqmTg3F0lZyIDW8j94aXbiCha4onuznY24o3R7wkEo8apbcYf42pAVfLirqFcTYlMxPYL6fi9GYYMYim8c0HSBnhGyVRz6F2ADMZ68JcCvMgbiKSvfNL2CN93M41nkZOV7mM1cT+C8GQipc6rfUaUqHIewWxjnPWQvHmEIVU1vmzyveYcu5TY3JHvlwG0HaFQE1/VeQPYf/EOb5v8hxmvQbGFi5LKfNEw3ta5efLVx8aZqQDKR40cdyOOZkBgME9NiDQjxM0WCDLGiUWKsBlnVzp+iPWT8ZEVh63v6pD9niUzJAUctSci6LHPhVkidjKHQ01pEhuKi6TZXfVDF7cus3WSBvrvI//p0gZPBVtbDOMXA6o58zLkcgNoSDQ5KYJk0ZvIfQ4ONcW94weqPvoQtc63O6C7sj3yJQE3eyIeEoCoysBk8XJLX3juWpd3ov7QiMLlASL8HIjZCRTaI3zO82ggFZxXABBkS6AubKbsM3UXcOV29+sX6u/YbURgtk7TNh03ivRVRDXdw4gSwC3Jxk6sUMcHdeBQ6con4XJQ+XvsqRbQ3AT37KOF/Z25qetqSwdCMyYdsV3SF0GnqtqJZphBLYZif7A06Bi363fT8CC4HIM= 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)(39860400002)(346002)(136003)(366004)(396003)(376002)(451199015)(31686004)(2616005)(2906002)(26005)(36756003)(8936002)(6486002)(6512007)(5660300002)(31696002)(86362001)(41300700001)(6506007)(66476007)(478600001)(186003)(66556008)(66946007)(38100700002)(6916009)(316002)(8676002)(83380400001)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?k+jA3F5dWskJ6dEwz6Nfs+X1e4Ak?= =?utf-8?q?MtSKKbZKfvpiAHe8lX00HVuJKXAuN0j67K/6/BcLeRND2Boi49fvNwgW8x/9v6r1z?= =?utf-8?q?N8BZKItO3tJ0jhSYK2c7vlpIJ9zHPcyyZ7KIsY5WCPs5CidBBTlSnB086U9cWAV74?= =?utf-8?q?EB5U9npHDqiQ5xSAgYteZm9/MrVukrRvGUE+UyqpwLE91ILxelYiTa5B31GT+e3gt?= =?utf-8?q?ONcyCQu4m94FaEGUBQOXivuAfHIibKq+ZWHK4cLHBKmA+Ngcoxey8vZ0YCS8Z9YQV?= =?utf-8?q?BrYen4ZuK20WjW+/3d3XhMqeAJkQVqfO5yfxICayfyvei8ftAwim1bkTf2iwuh8bE?= =?utf-8?q?50mWbbN+7Z+m8CvFDDwNctHwUOU4d5M6nkPU8V4DItLaIcHO0q7yR9Fbn4xGIvOqZ?= =?utf-8?q?1HTqx987DgLw+odRoMPYBBJwlxpS5NNlkr7AdUiRjL2ABf3b5XkLVui6YILuiJEbu?= =?utf-8?q?gqX2l7hDTYmFDlCTLQXcePA4v/CAWIqiOKs2AqM9okc+BuT86YXYrIcnuiF0JZ10O?= =?utf-8?q?0f13F8W067leXb9T8rWVMVNL+rzaDd2gyrXjKVIZW9i45LTsvvv/da3+XOiAHMdhr?= =?utf-8?q?9vwx463BUftqNHhK+q5HKo9ysQnrQx8NKeeWmIJgtfkkJaGzLAlQHGX8PDrUILvXA?= =?utf-8?q?4kTi2IWivbrwh10gdgqB0LbehwJ3DhkmpwQYrgNf44JZxAzeDSOa3oHg0n9A3L+rT?= =?utf-8?q?+A/qX23sPVkRcw4SyltR+BhGD4BrQoo/WBQV/7r7wg6U8du+fBWM9gmzlg7BpGssn?= =?utf-8?q?JYJfjvAS17yGmgEjLLZpW5XdwV9SLEZpgZtFOcSEQluW2ZboVrUrqYdtIFiE6xzy1?= =?utf-8?q?vXCICqwfKxdifJLiflzDdrL5ZJS2jmUYwWMrWpH7GOnr23k1RZrpGOtIhg9336gLx?= =?utf-8?q?Uoj2S9EbHjRWSYWi9+36Ye7PV4RnYEg4pwPpVeRtnZ/aHaPs+SpxiymZB71W4+iKS?= =?utf-8?q?y5luBr9RIuST6LCPnvPHPU3zppdTAzCk3DMcAATiOlnPk/OC8TM2Q/TWCia+KFIWB?= =?utf-8?q?Iskk0RTbfaHLmkwxl+q0k2E3F2LDtqK0WHY8PWqzbMcX5Sgbd66BG5jzD8vB3WcZM?= =?utf-8?q?WqurLyxpiTo8Xyn1DgPUZR5QcMUD9v6vqDONwqWxiDow4Jb6RFNbwKiJhMKoRR3f5?= =?utf-8?q?w9aDXFInEXCaDwTunxYvklo/6t6LAj/BLIWBglv4Ix9nkKaAvdbRa6e7DrzzPTEbr?= =?utf-8?q?m3x5QntQ4mqn/LFYVHTRsfa8hK0ycVV7SNjcwFvXdRCENedHybnfW+scpvQAALPvK?= =?utf-8?q?Bq0YUg27aG1gZ851Kot+4E97UBpCQlnUpNVziWlQqXFIw3w1JMUdOuc5v36qAALDX?= =?utf-8?q?Gx1UoBhZUOcCYrh9aqZv+7Je7i8U4ey0fDT5Pm3De9kqtxteMRAkogg1jf5OugrwR?= =?utf-8?q?ZQUAbauLERBbqSmOL0MsnjnxBeArkdbfG5DYX5gUvVTZS59da8t0Vznc1PY1o2fW7?= =?utf-8?q?Gfm2TZBg/XR0J8VkatXvvmXqQBmDNJ8SibznxyJENYciQLIVaVpVg1h+V6jMVFgEJ?= =?utf-8?q?2CfOkORhY++T?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44fe16b0-91c2-4eec-0c61-08dad44eead4 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:21:03.9743 (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: i80vBByPA91mMC74zmh6AweZQM4CDqS3CLPpR8WCejGYkqWiH7CvfawaEgI/g90uFI5QyPv8FfkPDeDl3gv9FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7409 X-Spam-Status: No, score=-3029.0 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?1751097294006365815?= X-GMAIL-MSGID: =?utf-8?q?1751097294006365815?= 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). --- v7: PadLock parts split off. v4: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11373,11 +11373,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 - && (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. */ @@ -11394,14 +11392,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, @@ -11444,6 +11440,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 @@ -490,37 +490,37 @@ loopne, 0xe0, None, Cpu64, JumpByte|No_b set, 0xf9, 0, Cpu386, Modrm|No_wSuf|No_lSuf|No_sSuf|No_qSuf, { Reg8|Byte|Unspecified|BaseIndex } // String manipulation. -cmps, 0xa6, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +cmps, 0xa6, None, 0, W|No_sSuf|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scmp, 0xa6, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +scmp, 0xa6, None, 0, W|No_sSuf|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|IsString|RepPrefixOk, {} +ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|RepPrefixOk, {} ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|IsStringEsOp1|RepPrefixOk, { InOutPortReg, Byte|Word|Dword|Unspecified|BaseIndex } -outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|IsString|RepPrefixOk, {} +outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|RepPrefixOk, {} outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Unspecified|BaseIndex, InOutPortReg } -lods, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +lods, 0xac, None, 0, W|No_sSuf|RepPrefixOk, {} lods, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } lods, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -slod, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +slod, 0xac, None, 0, W|No_sSuf|RepPrefixOk, {} slod, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } slod, 0xac, None, 0, W|No_sSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -movs, 0xa4, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +movs, 0xa4, None, 0, W|No_sSuf|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -smov, 0xa4, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +smov, 0xa4, None, 0, W|No_sSuf|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scas, 0xae, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +scas, 0xae, None, 0, W|No_sSuf|RepPrefixOk, {} scas, 0xae, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -ssca, 0xae, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +ssca, 0xae, None, 0, W|No_sSuf|RepPrefixOk, {} ssca, 0xae, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssca, 0xae, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -stos, 0xaa, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +stos, 0xaa, None, 0, W|No_sSuf|RepPrefixOk, {} stos, 0xaa, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } stos, 0xaa, None, 0, W|No_sSuf|IsStringEsOp1|RepPrefixOk, { Acc|Byte|Word|Dword|Qword, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ssto, 0xaa, None, 0, W|No_sSuf|IsString|RepPrefixOk, {} +ssto, 0xaa, None, 0, W|No_sSuf|RepPrefixOk, {} ssto, 0xaa, None, 0, W|No_sSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssto, 0xaa, None, 0, W|No_sSuf|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|IsString, {} +xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf, {} xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|IsString, { Byte|Unspecified|BaseIndex } // Bit manipulation. From patchwork Fri Dec 2 10:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 28861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp752172wrr; Fri, 2 Dec 2022 02:23:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf7tFQlsk9mCx7TgDF7KWOnmnlbaERoIv6q076YzQMe0QcG8rKr6CjD2bLVg1aphRHM9l0kZ X-Received: by 2002:aa7:d80d:0:b0:46b:7645:86a9 with SMTP id v13-20020aa7d80d000000b0046b764586a9mr15059115edq.311.1669976584176; Fri, 02 Dec 2022 02:23:04 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id mp8-20020a1709071b0800b007c0bc7057d7si2121140ejc.202.2022.12.02.02.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 02:23:04 -0800 (PST) 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=Il2gpL6w; 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 10C3A3853D58 for ; Fri, 2 Dec 2022 10:22:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10C3A3853D58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669976521; bh=BA8ttiGTKtoroAKuwXn9e2RmpXgt8DGdStKaESe9kes=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Il2gpL6ws8Tc5TcebrgjV0njSSc6sMDbdShFMqv20BZcOTdHM7gSAlFw0Lxq9MWp2 iq6gANrUdfNguWbNeXBItIg6bMHunWCEoMU/L6k0TIKWUNutwftWOznqDY21v+QP/p 0GNyvoSkNRm+h2cHw97gMPVNaz2I4NE/7NFpHv8k= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2047.outbound.protection.outlook.com [40.107.7.47]) by sourceware.org (Postfix) with ESMTPS id 77672385B53F for ; Fri, 2 Dec 2022 10:21:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77672385B53F ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BginPPpL//BOn8EHfnOxgEgk4ss/yvb0UiABHR8/5LJrdRIR8xPJGE/h3gIhxNn3+T4GydN/TmrLGcFQmZbgoOS7VNAJSLuhfkDv1IrYuS0NSUi7KW3pKfMGTePNQANXTEDmjDps6ong+bvq1Bt3V4TZKqG+8DWlKmhk97S9/+VKE30UVPrss08qhTwdaZjTVykDbObsg0Ed2JWBrTNT0wTWVTlYDFgPfEmikBEVQmr6YrdaJRCRk9YVmELnWSyibV4dWJFiE31dWd+smg9fVMreG8xGs63+ZI78TLa3YfJKqlRPOiIzf2uQq9HfJckwzdpZZc/kicFIQpZDe8KOJw== 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=BA8ttiGTKtoroAKuwXn9e2RmpXgt8DGdStKaESe9kes=; b=T9WE4UHRTY10ehuwBk5HkuRhlK9eWo2msXQZQi3fc7jzzWkV5EDvMJirdMX6zW+Q2jM3Um2dKdvsnXh1mWU9P8JHfbh4zzM9kRt9qjHJEdZadB11uJ9KY2tTiTMLeYcnxeahFsVmNE3nZ3bDLKUfRHQgNcIUHKXfHHlzgthLaygP78VCCtmpb+E88wtGMoVKNvD24jnrPeaR560jSdzwlgaDnKMR/Ndjt7gsY1HBgN4e+zdozrGrLiA7oLOzLNmZ2VceHR1OWgKxzvcqgJO8gbG+Z2BdCokcL9yCHKbPbE68Y4rI+W+cPs3VMM+DAW/5ihOwM+XbfJmmqpuYKCRj2Q== 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 AM8PR04MB7409.eurprd04.prod.outlook.com (2603:10a6:20b:1c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Fri, 2 Dec 2022 10:21:47 +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.5857.023; Fri, 2 Dec 2022 10:21:47 +0000 Message-ID: <46702842-5bc7-113e-bab8-d67304f0f337@suse.com> Date: Fri, 2 Dec 2022 11:21:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH v7 7/7] x86: further re-work insn/suffix recognition to also cover MOVSX Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::22) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7409:EE_ X-MS-Office365-Filtering-Correlation-Id: 5073300b-ea19-4217-315d-08dad44f04e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mN2OH7j3eInmRDiDTDH1kHee1cs9rAB6lRMFyCS6gHkxwik9ZPlYpankLPcO0BuYh9oIDqb6M8oS9Sz3crhON5tERSHNNcYR7iWU3PUz8X2+3AQGP7/FYzMxJwy/Ui6SGOa08LuhSiS2o5EcapxWsZxFKdA3AkE7wD7Cp6rLLCmy5ITsRDqv4EE2ctZXdjSScOfumxB9/n2vwvkJZEF8obnOD1E/RRIU7+53UNtoZdH7rq5YH6E6fJ43M55ReBUxeEHfUWQkcDIWoEoqahn9BKrbcpLxZ+GdiRLbsD5LIxu0WYoX+O7UHupP/d2xpnH4QLcxDzKn/GKrwles7AeE5tnXffIQnJ9/TgqFnR35YCzSsXXf5Mk5wd6u91J+95VVUIlJ44qDdQ9ANdolmy92EnJWkfUbdC0GOUyGs8wLRePoUjLbunyyBC0W5Ftn1K+2Ab/D/8/eMOSbFf3H4vOLSDzHxm8aku6f1+WDxjnNq3N5b61WW23XZXA5LGvKvBzvK/D2WkIdUIcweo1AgNHzsY2DDeDE5mTna2UqAxtoZYRN+DejZahrxLGHc72uQXdOZ7P/8iLF3pGvuztDDQp/DN7nXUgPdkOiDvfV43MrhipCN7yw28o1NTc5N7Epo2x3diDiwQFMuDJCUiM3omzf2JkvcVK8U5e7zkTCjcSgS/gtS3wVtWpwby+7bpWbk4fol6rR9WDrddd7rcvbOD4aAKZH5htocQicKJH94Y/2B2o= 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)(39860400002)(346002)(136003)(366004)(396003)(376002)(451199015)(66899015)(31686004)(2616005)(2906002)(30864003)(26005)(36756003)(8936002)(6486002)(6512007)(5660300002)(31696002)(86362001)(41300700001)(6506007)(66476007)(478600001)(186003)(66556008)(66946007)(38100700002)(6916009)(316002)(8676002)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nu4yZk1wcRKbJLcN7cSdgCc4IGcY?= =?utf-8?q?rQkAZKGUiJxvxDf39UWboK70X6oumy8p4lDTEi5QT4VGS5Y8ZOuxriNzcQsi3O9KW?= =?utf-8?q?hjX2lJbUVvRNVpGbyIp2Fbhy1WYbS1ERNNuUkUM/mDtbWl+vN3EAz7FWgv64vj/Gk?= =?utf-8?q?0uERPAq4z1sMg8DrPfu7XbeDhnHemAAdrqLvG9nQKQvnJCKPrK60+jC+CB0aM1d5m?= =?utf-8?q?qMfD9UlBJG5A3otjlEw8OkRxSzvKCXSF/T9z3kUbgF9yagW5Ua5/OKSLcC/bpJlhK?= =?utf-8?q?k/TQAZHIGHHTjO44JkfDb53Y4eLZ8yNzjjpiYjTD3swh1oMJErXkUR/aGJxr/myJs?= =?utf-8?q?ycdEvWQfFjtvSrnJOHwQt7NQKnfHEuJ9xt5LD374ETETTl5gxpqMNx5A5gUayKwIE?= =?utf-8?q?zpPIjcRKj7OVzXFgat1TROWfmm/yhS0hrr96fHGk1aKP0iL9YVbuvT3tKTrkRKFuN?= =?utf-8?q?IlrUurH3AZxNa6EVxCJJTK5z1yP5kAXmtuOEOEscj2SicWGbX6RVWLkGjuowoKQ8C?= =?utf-8?q?SZb0/uPtIBe7+34IP2y3TaUv1cJn4vRNR0YU7qQte77JXGhCzTH4MexMZ64NhqbW0?= =?utf-8?q?MCFXTQw1zTxDjCVwukkQenboqiI8zKmeq9E3PqloY6mypzeM6G/DMmsd1zkQoBWWR?= =?utf-8?q?xxzypc2s06uIRdhHPVSGSFavL2NnIcxF4kk4QMNvRt0NeySLwJ9A/QQT/aDDtgJO6?= =?utf-8?q?PbLYXCymRS4P50/4+LkdTCNdU0nPhXAmV0eiAdJYL6lPryaarkb0t3kMuegg0Mj42?= =?utf-8?q?CJXdYj6y3817H8wCV/7WqtjV38FeT/tcFiAUVAUNHNvOJ4KzCoXPMq75LrH1L8Jvi?= =?utf-8?q?hZbEF7Pl3aeEjtlUyIzTyVXGpt8e8RmfVMcOL3e92e+rUL5nLQHJU1C7PGxBcfHrO?= =?utf-8?q?yzJf2vLD3ivieYNnhfUbAC0Rj6WvMZqYyA61J1sx4W4LKt7+jaDn71UHu/Q2yy008?= =?utf-8?q?rJ5CjczziQwyu5iyM3KvQqB/N+RFTT5veOMabfWFLMoUtFjFsCIOLWS5mbbAEv51J?= =?utf-8?q?ZUqUkdP2MB3vFYlbqHUzol2JX8+559+fRtvm3QVS6ErPBu9oxi+38MgebNXKp3Gyn?= =?utf-8?q?dO/GYLUEnZS6UgsspwByDC2Gceny0+X0e3/spafpmwbtq0wNEhHLnHUNIX2mvX5Wz?= =?utf-8?q?J/s13efO3bYjcS0K8nUpMgAjqEf4jserlgoA6TS+p2IYZb2jfqqVZ8fUKLcIQv2dq?= =?utf-8?q?72wE41LQXPf3GKstgSeV7l63NeOCd2l0QcLd6h8oXITPAkyq0/p2Q+0SvmEeyxIrW?= =?utf-8?q?uUX6fuMHfj4UWEnuHtp5riPcEdzqXfI9De0YX9DfQHMaM3O3nPsmw9RAMCkJL5/lz?= =?utf-8?q?jglFE6MLRCqpgIjFlScAzUrH3tHpQw+16UXbDDjlCp6JSK7zJtIdMGM1yD3U2r2zB?= =?utf-8?q?tztQQCM783lr1zRO78YOyU4Jb3Mq6BQNgFcrzcR+tBWsJCCPN6ivEKffDsNGecgdP?= =?utf-8?q?ZFvMiVvl68y0IweqHPWba1a1YWkIdbfyIAzi7FjX/wtCX+NTvDJOK3AgSyFRto/CR?= =?utf-8?q?KUhe0nOs7Blw?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5073300b-ea19-4217-315d-08dad44f04e0 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 10:21:47.6902 (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: +zKrN28I6ixFtE3ROCjtD7JEbZGL0xoi7dwglpS42/DD6Tc40n8vPk8/A0UQdi67kKaiTbOIQhwQLD89EB1CKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7409 X-Spam-Status: No, score=-3029.0 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?1751097366500057212?= X-GMAIL-MSGID: =?utf-8?q?1751097366500057212?= 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 to make may_need_pass2() cope (plus extend testsuite coverage). --- v7: Re-base. 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 @@ -4852,7 +4852,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" @@ -820,6 +821,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 @@ -172,14 +172,9 @@ mov, 0xf24, None, Cpu386|CpuNo64, D|RegM movbe, 0x0f38f0, None, CpuMovbe, D|Modrm|CheckRegSize|No_bSuf|No_sSuf, { 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|NoSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg32 } -movsbw, 0xfbe, None, Cpu386, Modrm|NoSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg16 } -movswl, 0xfbf, None, Cpu386, Modrm|NoSuf, { Reg16|Word|Unspecified|BaseIndex, Reg32 } -movsbq, 0xfbe, None, Cpu64, Modrm|NoSuf|Size64, { Reg8|Byte|Unspecified|BaseIndex, Reg64 } -movswq, 0xfbf, None, Cpu64, Modrm|NoSuf|Size64, { Reg16|Word|Unspecified|BaseIndex, Reg64 } -movslq, 0x63, None, Cpu64, Modrm|NoSuf|Size64, { Reg32|Dword|Unspecified|BaseIndex, Reg64 } +movsb, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_sSuf, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +movsw, 0xfbf, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 } +movsl, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg32|Unspecified|BaseIndex, Reg64 } movsx, 0xfbe, None, Cpu386, W|Modrm|No_lSuf|No_sSuf|No_qSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } movsx, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 } movsxd, 0x63, None, Cpu64, Modrm|NoSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 }