From patchwork Tue Oct 25 07:24:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp857161wru; Tue, 25 Oct 2022 00:25:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Rde3pcKo8pGfO6NJon3Ko11PLuFdEg4pAcYu+diWoS+BkrKTHc8GCWJ+Zq+HGEjgFGHBN X-Received: by 2002:aa7:c78d:0:b0:454:fe1d:8eb1 with SMTP id n13-20020aa7c78d000000b00454fe1d8eb1mr34307267eds.59.1666682709145; Tue, 25 Oct 2022 00:25:09 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id jg18-20020a170907971200b007804f3dafbesi2272476ejc.587.2022.10.25.00.25.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=FU6fmXZK; 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 7B8533857BBC for ; Tue, 25 Oct 2022 07:25:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B8533857BBC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666682707; bh=mwhuDxNdqxnFfQ14G7Ad6WKLACKeLiDADn4EpDsZvQk=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FU6fmXZKwHh6ddNSRcJ2SeAfBGYOtB1Id1mbieOyv8QrHDG1mYL6ZaHrLjb6j7KSk BbWYUq7Of3ZU7GfMYEMy5gsZXlV4C6kokvvyDbiDQlESXSC9LLV3g7/Z/Ux/P8JWIn ooML9AQkWbwdYf3w6ofZz5ScORgYPFRCGXeGkHbo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2045.outbound.protection.outlook.com [40.107.247.45]) by sourceware.org (Postfix) with ESMTPS id 16083385843E for ; Tue, 25 Oct 2022 07:24:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16083385843E ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhGdnQUy42Vh3aU0M/zePbDi/oBdruFPTUgnoWKLiU3hUndJj+KSIFPSWmU2/cozAv58DOlIoaEljuPR5CLnGmBXF6OBCXUrNHdNwi+6ntPbpHyOwM2qxcZDkkNQHqwIr12x5UQtZ8mM/G17xGer/ryBedFII2SYAD+avVZVjrFG1870KIBKDYwC3O6pr5/jz1G0yXUsSk12Wx8KECGkOjUjGoibdHkaD42nF63nak89c0OS4SnGyZdRWOJVTF4Qntbra5GgsJHREBQAWh60r8oASeWhBjp4y3YUy+wNEfh4x0FhaCStn0wHYbg6IwgfDgOBgD4+H6xgyEaDIiREFA== 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=mwhuDxNdqxnFfQ14G7Ad6WKLACKeLiDADn4EpDsZvQk=; b=Gav7crHwKwqK2QrUQt88fKjRAcc96GZRT5eC15peA8b+VGmXEIpFXu8UCjgYSkLOljCSa4chKvdM8ccVSqFLs9DI9KSmTNYen4ko4Hg49SXuXGfVpJ/1wDXKBiWO9tUUuYwcPQ8sJ8jF1KXzLkFg9UYvylkQ0Sb6UcVhDZstr5T95gr1jWUjVQgQUGXxYsguV0yN4LFlCDxxfDrl44uBBEKtemmJICFYPB8y/WlLeG/IJtwjC6wG/j9YaXfKraLg9L6c220/sOcl9bn3cr3BiRC7j9dOk+JON9WoeGuNMiN+tbVEBHo/p5Zt4MjGXLoZ9g0LQPnXXIXTUDaCYOQp1g== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:24:57 +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.5746.021; Tue, 25 Oct 2022 07:24:57 +0000 Message-ID: Date: Tue, 25 Oct 2022 09:24:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 1/8] x86: constify parse_insn()'s input Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0065.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::20) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cbe6df9-1376-4635-c462-08dab65a04ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O3nGgnRDYON6WW/nUAWaJkx9eH8KTjYEtP4J/VXfGXNXc+SOPLUVo2Ne4pvrabawu9r0jkX/EtBVmRYMSMGTZaVSDYy/y11vSMpr9S/UJW7qxuNXud60+RqfchnA4TkH0NrzpcGZj9CqQxRswB77aC9Q2vQaIE5fvId5Zprb65CakbpaXPvsJfhzpb0qKK0GwHMtCH7fU/G3ehVsP9ScIw1BJfzVtbav6QshRDCQNJolMrxhOWpd82ct8m0EukVRJGRL+nquAyHruETbnMmZhCsw/dha1vNtCfmqzxrgo4kT6ZoOqqbaRNTriL1nDb7IBCHrY2t5lWoKVDXGzlS1q1alS7YOQFJmz5ZIYQuVgmoizTxILz2SIIRMjP8Vh73S5i3N2EzdhzwZwJXsvhdxWLcv6LxKnSqwwD4O8CYM/M7TrKRHeBsc3tYU/VTSpcoBHLohaM4ZztcjcYt6JcyHw1A3LnaTzthOpnWqkXUbz6fB9ImVBg0GvJbktMfgcoxXe+MubI8LzH3AAcIK532hgAZ1o5IPTFLcFubJ+7TsCQT60QlZuRGV1eUxYceLqg/Sht8uMUZ1EL5okD4jU88ZBRiHx/mcZdUi98+VyV21lj7pIwhTvP8CGY49lRnMF8rfU0swjgLYQQsCjM8fGCPFgmCWiwA+nCAf0qMXK5CEYVGAxtZomUZdAo8BI+dtsRL5vAP0awrTD6fXsxFOKZbvGvwhMpSyN/Wct3XnHFghZMVJS+jWb81ksQeqQJ6K4rJqJmxllssYKO5eyaczilbtgOuuMZhm3Z1NPI5XCTdKp3c= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(83380400001)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?u41o2iq5I1ciEqcLBdVkAhB6RQtZ?= =?utf-8?q?hjdJD6JCe8VVS7r3OHjtYBYkXIpAtTYbwUkd8HpfUk7ckGvQ0UA0J11+sg1meMYwv?= =?utf-8?q?Mg92bHS03qUy57TP8/ual7I2r+QYQGkHaQuGrrdk0+w8es1V09CblNz/QBxf8djez?= =?utf-8?q?tL3xKcqibBy5jeNKx2+p+CRDcG46gocj0GfyKtSvb0poF0ufTdYq2HYpWASq9daSl?= =?utf-8?q?H9A4XrYZERVjljAQVGYw/l6a/oN9ygfAfad+pywiS07gNONd1EykEsgTSJdLEbwcp?= =?utf-8?q?RQIasDOd1fbPRkxaebYX3eYrC+0c/GOnwN6CzQTNUlLrp41xCnqFtNsK07fwwUMCi?= =?utf-8?q?IXsKmL6Jd3pQg+Ap8+6zMmOlj8RQevdaTdmzRIOgHS8rF+JJ94/HmtkOSmaJXAsNg?= =?utf-8?q?enMmCMWKDIkm6EH3n91I921XYNVhjEcJ7cfUNPFUPh4QfKpHX6txzRPRbIMFvpVcd?= =?utf-8?q?HX5ec4JP2A7B7NUvEpxCHo0T6NR542izzTjkMSlFG6zLk60hrQZXm7w1YRek6aeqF?= =?utf-8?q?GVt9XTVRDFiucQYelVZyIXr5GLs0uDv4/NDl7tGlc8yUe4iysupqA17GKL1R9iX0d?= =?utf-8?q?kDy5Z1MagkdmDvy99PDhQhzQjz3iuaA5PA15tI3M8pLHu5aKl8WTnvdeIs1u35Rza?= =?utf-8?q?WDOpNyjwJkZ1juToCUA3xYc67CEdVx/yUUZ3biKXm+c0g4zajF1ZQoFF6lk1ilbHM?= =?utf-8?q?1KVkk8P9RpwxSwtyeZFp4NrGhTkE7+pqC5FNpfLdRyLN6jcYifojSXfbiaZU5Y/Zv?= =?utf-8?q?Sdcd/cPCI4Lll68tkc+taRVd1jNCdHuwmTuKbUWTMCkL7UfmGcovMMrG7ojxhSygY?= =?utf-8?q?JCXj9MtaDNS7CGbzwQAWIU7fGlKS52GwDUxrPsjzGob08D6OLqm3OIlWu36aKE+tU?= =?utf-8?q?LiMCv/7PKi13nX2H6xJ6pfu6ql3fCVMI7Y6Qt7yMN+/vl2tK00vNkbiqu86yekHpO?= =?utf-8?q?ZRqKYtdnAyyRuEcOPyizWSar/8BQ6X/dBDYA/q/2GEXzq7roVLCCxlb1xPwttWdd5?= =?utf-8?q?WUgKLPuFAmizWckP/KEUsOtJnH3EVkso1LuWZACvGPc3nhAYM8Mg/LM4xI7oRpE0P?= =?utf-8?q?A/yw5x7J8KiF4S8WCTNZ5dkzNS1nsFOqi70lOxTwLoMehYzDqGCCLPxCiqxhWw4jh?= =?utf-8?q?Vl4LyofEEE2Ng/MDOcwuiMZhK9ln4PSB9O+b6OMLJ1Xwn64PRlwQutIXHrJy0AOH5?= =?utf-8?q?z0bxi6hONZeGeMiZjxwnxWvnh9+BUWOqK+J7/gWiASRjuXJVVseW8YBeoqQ1CLmlr?= =?utf-8?q?T1RcsgbktF34fZbiVS9QKlpr2Q5WXGlGXSI7EyJIGNr8fml3ND4X2iFug670hO07v?= =?utf-8?q?yJMbnTVJPU1MgWQbJ+PhEBuKyDlFuvMc5i1pcPtNxfvxIiN6yXDs11uj5eK1OwvI5?= =?utf-8?q?PxbwyFSGS0ycQa2hmFocYAIrh3YTuKeN/jKEbbErTYscJtKe9XiLSaBDaRklomQq/?= =?utf-8?q?pj2HvHRI+L/jPB97lvDHTq0psNU7y/Sz2LjTWNF8ZYbNRH9I2mOC0S4xuUYikz7fy?= =?utf-8?q?RcdSt9NgAQ1D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cbe6df9-1376-4635-c462-08dab65a04ee X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:24:57.3665 (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: Ry4ChgRCjcNaKl4fRy6abtXDAc5ZCx7R2XIWy6oaFKc/nU9rEzZTgrjGWuaT15ZODTZiCyE0RNIRsr9XacFyEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.7 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?1747643488317645180?= X-GMAIL-MSGID: =?utf-8?q?1747643488317645180?= The function doesn't alter its input buffer: Reflect this in its prototype. To avoid using any kind of cast, simply calculate the update of "line" from the function's input and output. --- Avoiding a cast the way it's done here is going to be useful in subsequent patches (there'll be code added between the call and the update of "line"), so switching to a cast is not really an option. --- v3: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -157,7 +157,7 @@ static int i386_intel_operand (char *, i static int i386_intel_simplify (expressionS *); static int i386_intel_parse_name (const char *, expressionS *); static const reg_entry *parse_register (char *, char **); -static char *parse_insn (char *, char *); +static const char *parse_insn (const char *, char *); static char *parse_operands (char *, const char *); static void swap_operands (void); static void swap_2_operands (unsigned int, unsigned int); @@ -4819,6 +4819,7 @@ md_assemble (char *line) { unsigned int j; char mnemonic[MAX_MNEM_SIZE], mnem_suffix; + const char *end; const insn_template *t; /* Initialize globals. */ @@ -4834,9 +4835,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); @@ -5216,11 +5218,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 Tue Oct 25 07:26:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp857986wru; Tue, 25 Oct 2022 00:27:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h4YiXfnmd3Za0ehbAblLowW2CsXXrU629bF5fH7X/8SgzcOT1NXNWPfsFfHlglArU+72R X-Received: by 2002:a17:906:5a6a:b0:7a6:bad5:8295 with SMTP id my42-20020a1709065a6a00b007a6bad58295mr9269389ejc.647.1666682864889; Tue, 25 Oct 2022 00:27:44 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n16-20020a509350000000b00458cd6f8506si1613643eda.173.2022.10.25.00.27.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wMSjnaCH; 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 E3BA93857815 for ; Tue, 25 Oct 2022 07:27:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3BA93857815 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666682862; bh=SYifzw/4nPc4U2nKAh+Yr+iaatj+UIMCBW6cUE7J5WY=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=wMSjnaCH4X+Bq4Kp3pG/ogWBCheVxSppNu2ZwbebJf00M/sR8/Xbi/MyVuTb9LYR2 7smqBsIYHyu9Dw1sb8HoM+30pKYWnY2lNsAIlkpIDdyUGUmLDREaTwF/4CXn3cDM2r +SnouJ5H+Mmun3XtVhTS7qNAIg4V554elKrzbH+Q= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2051.outbound.protection.outlook.com [40.107.247.51]) by sourceware.org (Postfix) with ESMTPS id 978EB38582A2 for ; Tue, 25 Oct 2022 07:26:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 978EB38582A2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/H/UiB6s/YTQ0zt3Dpb3LIFJWg3FfLgHtOLdwWrBS841rMuSOJEUyZpaJEYTVprrynLBpiy//1UinAKWu8V5G8PUAkwEQFOrjX6KWt+/3F/ZwTKwhTMjCU3zNLskmtgevILPZxG0/V2pSofNj5bzrW3V3e84fNdMG2Rl31dMOBANqYx9nIRvGRkCIXrGJEQQQUo4x+69uL3mRpS2wulMh9Jj56wBFxcI8DGndER8Rd9IIVKmORxAB5VNAZWWOn+lzgN2tsiWjFttLcm4Rm1Xw86KUYjUl4SxEy6Jw20HRw62LjbUCzlwO0PgdV+BMEapY1MTmx0St93gLvi6H0mjg== 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=SYifzw/4nPc4U2nKAh+Yr+iaatj+UIMCBW6cUE7J5WY=; b=DWcTNpgsZHRJtaQL/Q0bWut7AFGrtaWPNmomzeV535WVlCyu84sZiOGjkLUygizq257OTYUg/3vYA3ozn+zf9jEOmMSNTX3MPWieuueni/mAjKTUhXmclDmSqBr8eXrhKGcuDeS6qsXoMsbzuEnQK5EqUhYxXpVuYQaF8ige15mgdBJ9bFxP8pdpoOKZVBAMI78Urd5x3j8gSuPL5OifqcfyzOmOXV0slDCAPPzQP0eWKEISM8bWDIVdisjqUt9dwI+aqxTSKnuoweB87nT8wjUTIw2j6C8e2EklDQmD23iwGULDFk9abRMfdK+hl2+wjn6bObEDHKlj/+M40ZNdIA== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:26:15 +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.5746.021; Tue, 25 Oct 2022 07:26:13 +0000 Message-ID: <7250dab9-e218-e6dd-4c74-23da9f611ab4@suse.com> Date: Tue, 25 Oct 2022 09:26:11 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 3/8] x86: re-work insn/suffix recognition Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR0P281CA0098.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::8) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a2865ce-02a8-4bde-335e-08dab65a31f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lqBuahVUimELM3dZsz1GYaBrAT8zc2PR/mnGSAcFGtZ7X3XO03LJNerGrwbu/+QW33pXdPV4n2rbsgJgz5gnJw43l/ZqZKQnfQ5nlPqbV+/xijp+HGCiprkrr/qdJgnEGvtTQ/Y70tJ6b6R4VCvuMW/6THoHGbroe7YYHJP7xMQfsbnUnyuUSw9XgfGtuIehBAc6rofRRnTR5z/5CNVTrqTDfSByZVxpKO33qmrAVqmd4DCVyq/uZ+o0ZCKr3xVev1bRp+QaZpYvHl+UMzZg2NPi0see3EqxqsrifxUrSKgIaJ3fuDCWt5HT61qZ9aHoHGKJH8zO5jbJzdRAcAcQZe1ui6RRzgGDxRjQXevJ3VoM9XwEk6M5s9nWJXDOTCRiuiFOLERGhG/Kq4I/cixtg4XRk42gB/0owx0sk4yqllmM4nnBCKoXPhdCLkxZowBtNPw40dHAg/BJmTqGTyafnS2HtX9EiUuHJ9ZzgMgkU93t4S3w9OmLvFNQTDdlZGF1SlUW21Qo/7+QR0t5GZDVcCeLDaVapQqt7iEVVCWB9mx1n17XOyFmWRTRxRe8QJXrYoG/bhg6yFbJHKb81uCIR834lSUpFhxm6DU5Gzbn/LfHeljQ67Vg+a/7K8/9OpOgWK4boGbl/duGFVij/nDSXSCONsdbG2fzca4H7OHEUtFMGG8ZsX6eze7SP/kVPe9P9leyXyuem77WvZlcg7HB9/e5PZp2WSVGNSmFuk4LqiWCLvInDyp1UR24JUQqfp4C53BY+rKelPlk4Y04D+Sfg0+XWB2HjCRFnOfgX4NEI4k= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(83380400001)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(30864003)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gC2O0RSWPQ37udlzaKaQCT1LVZ5e?= =?utf-8?q?9ohrltKvKTBZpL2IcFIEofAuR1R2ccql9Ls9T46Lez53v7K0dbiaI7dM6nQ57btIk?= =?utf-8?q?GxNFh2F6JYnLklzNba+BniH4kmyxokvSzuNLfy/27K/oZ5w+YclGZ27sP0wGDiv6T?= =?utf-8?q?mryLCeFNVbdApCT8kU00k3apJVPE2oVn9rFd6SDKxKYIv6th0S5jbpTdQbrxqVVB0?= =?utf-8?q?+h193l3fDSqHbl+ECCTzBQfP2a18kPkGa5s9m2PQV/AWH5n0ulzFdyEYz4JCORGq1?= =?utf-8?q?K2KMyUt+brPdnFQRrKlMKM5VGEbiy5MSANbHUlleHTcW+DcCE1PHaBtNHhyfvpQmW?= =?utf-8?q?1BHBmoqylshqgGouKlJicOn3eO+U0cheNcDQEQ646xDylMWYfIW4WAZOEWAe8wON+?= =?utf-8?q?OWBJzxnK9r+pNE8X83EUN3OCuUwfqCBqROy5uohaDdFnHRSJOEetM7iTPm2kKEtaX?= =?utf-8?q?FWynf8xnIacXXtMbIUFBNrIgATiQNdVf9CEMrXgI647w8C15ZaZVR07zeW8C+ehQ8?= =?utf-8?q?NTdv/qb7pS53l5YULZdZLfAcm50svEgV3XKFicTWboYsaEDao+cJ7pKq5A2C+4Un+?= =?utf-8?q?bndeaBePGbn1f2JQgmWLWr5EznC+KL91I6mDNXXP9XLgGaNAzXmW1k8SeqR4ETdty?= =?utf-8?q?hcTN7y8jUvbxSv4mn1Ot3En7Rf24uWE78oa/FJ2WyN5rEU7fQ3PlpSSoIFKUjWOJN?= =?utf-8?q?88SeU+LIPHncDfejADAbAT0bjVJFS0x3Sjg3g/2W81FfZo2C7yhxGua332/f/AWL2?= =?utf-8?q?39Kt8PbWfxen6cKCecukQ+VRDxZ9I3m9HCGf1Dwjh3snR0YksQw7KdJkVQW/vokUM?= =?utf-8?q?Tl6w9y0U49TqheKkc0dq7RX7Seu3QCuJ/L8JtCevb0Wku1cyLvq2cb4a51g0rIfwf?= =?utf-8?q?YCe4vrhk3kTlrVYqCROiaG4EZXQE/ehTydiS5viRTnF3zesQ2BjJ8MgPOdwL77HSC?= =?utf-8?q?++qzLHA3p+gFl9AUNHxCOUCBKdpn6/PKS51jRpGvAD031lx3tTGn0UYZuidQLKyby?= =?utf-8?q?TjRtknBXJKaegaZYodd4q9Ww6pfo0N7BxhVEthjfHbDDZDGGwpwyht8wi3yFOGN/x?= =?utf-8?q?cTLXxfc6nIzwyRHWF1lCB7SwdeC4gJCHNOC4xjttkKmYIQyD/wRnN5nE/1MksKor2?= =?utf-8?q?gpuptOZFawWtVt2eIDmYVff8QnbS90KyLQtksqUVuEbumsNxi8eMUGu/o/Q+iQYr+?= =?utf-8?q?lxGkvBv6u1L7Re+TCa4XWqmyHdJ2e5+m0IRQyQKqZUlcDBPxtFUevCktwxX0tGdw7?= =?utf-8?q?3HckUjam1xl2IKdY5Mp/2mSaltpkrdHg9IeUTjnz1hEwx2FAh6qRbMp4Xzmt0H+Oy?= =?utf-8?q?i7KT303sFwq/8ZODPoxMzLSEZ56WMyWurgRkAyhh08HgffQG4I+91GZ0Kc2wbc1qd?= =?utf-8?q?mxAn/yUjedqTtHjlu8meVj8Syo6ur5Ar2tun3N5uxNtyjH83orChvUaDdFTVOk+dX?= =?utf-8?q?rh1jYlQSvLMceamtNtTLy6DEr4wKY0HjuTNLMzd9sisb1CfJnGBOKtrzXlUJ+wQLS?= =?utf-8?q?u/VtM+Uy6xuY?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a2865ce-02a8-4bde-335e-08dab65a31f3 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:26:12.9399 (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: tFEutDzWEyeuM+j7K9anz+2jqvg507sk32tzUl1QFEGyc/sdYyplpenRHf+UARKqswSTnzRWqQP0xqqlgeabgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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?1747643652009430976?= X-GMAIL-MSGID: =?utf-8?q?1747643652009430976?= 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. Why is "MOVQ $imm64, %reg64" being optimized but "MOVABS $imm64, %reg64" is not? --- v5: Split off move-with-sign-extend changes. v4: Retain support for operand-less MOVSD and CMPSD. v3: Limit xstrdup() to just the templates where a 2nd pass actually makes sense (new Pass2 attribute). --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -297,9 +297,6 @@ struct _i386_insn explicit segment overrides are given. */ const reg_entry *seg[2]; - /* Copied first memory operand string, for re-checking. */ - char *memop1_string; - /* PREFIX holds all the given prefix opcodes (usually null). PREFIXES is the number of prefix opcodes. */ unsigned int prefixes; @@ -4272,7 +4269,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 @@ -4282,11 +4292,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 @@ -4818,11 +4823,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++) @@ -4837,16 +4845,26 @@ md_assemble (char *line) end = parse_insn (line, mnemonic); if (end == NULL) - return; + { + if (pass1_mnem != NULL) + goto match_error; + return; + } + if (current_templates->start->opcode_modifier.pass2) + { + /* 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. */ @@ -4922,7 +4940,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 @@ -5223,6 +5331,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; @@ -5392,8 +5501,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) { @@ -5435,13 +5546,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; } } @@ -6845,81 +6982,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; } @@ -11328,49 +11391,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) @@ -11521,17 +11541,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 ',' @@ -11738,8 +11747,6 @@ i386_att_operand (char *operand_string) if (i386_index_check (operand_string) == 0) return 0; i.flags[this_operand] |= Operand_Mem; - if (i.mem_operands == 0) - i.memop1_string = xstrdup (operand_string); i.mem_operands++; } else --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -993,10 +993,7 @@ i386_intel_operand (char *operand_string || intel_state.is_mem) { /* Memory operand. */ - if (i.mem_operands == 1 && !maybe_adjust_templates ()) - return 0; - if ((int) i.mem_operands - >= 2 - !current_templates->start->opcode_modifier.isstring) + if (i.mem_operands) { /* Handle @@ -1041,10 +1038,6 @@ i386_intel_operand (char *operand_string } } } - - as_bad (_("too many memory references for `%s'"), - current_templates->start->name); - return 0; } /* Swap base and index in 16-bit memory operands like @@ -1158,8 +1151,6 @@ i386_intel_operand (char *operand_string return 0; i.flags[this_operand] |= Operand_Mem; - if (i.mem_operands == 0) - i.memop1_string = xstrdup (operand_string); ++i.mem_operands; } else --- a/gas/testsuite/gas/i386/code16.d +++ b/gas/testsuite/gas/i386/code16.d @@ -1,5 +1,6 @@ #objdump: -drw -mi8086 #name: i386 with .code16 +#warning_output: code16.e .*: +file format .* --- /dev/null +++ b/gas/testsuite/gas/i386/code16.e @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:3: Warning: .* `movsd'.*`movsl'.* +.*:4: Warning: .* `cmpsd'.*`cmpsl'.* --- a/gas/testsuite/gas/i386/code16.s +++ b/gas/testsuite/gas/i386/code16.s @@ -2,8 +2,8 @@ .code16 rep; movsd rep; cmpsd - rep movsd %ds:(%si),%es:(%di) - rep cmpsd %es:(%di),%ds:(%si) + rep movsl %ds:(%si),%es:(%di) + rep cmpsl %es:(%di),%ds:(%si) mov %cr2, %ecx mov %ecx, %cr2 --- a/gas/testsuite/gas/i386/intel16.d +++ b/gas/testsuite/gas/i386/intel16.d @@ -20,4 +20,12 @@ Disassembly of section .text: 2c: 8d 02 [ ]*lea \(%bp,%si\),%ax 2e: 8d 01 [ ]*lea \(%bx,%di\),%ax 30: 8d 03 [ ]*lea \(%bp,%di\),%ax - ... +[ ]*[0-9a-f]+: 67 f7 13[ ]+notw[ ]+\(%ebx\) +[ ]*[0-9a-f]+: 66 f7 17[ ]+notl[ ]+\(%bx\) +[ ]*[0-9a-f]+: 67 0f 1f 03[ ]+nopw[ ]+\(%ebx\) +[ ]*[0-9a-f]+: 66 0f 1f 07[ ]+nopl[ ]+\(%bx\) +[ ]*[0-9a-f]+: 67 83 03 05[ ]+addw[ ]+\$0x5,\(%ebx\) +[ ]*[0-9a-f]+: 66 83 07 05[ ]+addl[ ]+\$0x5,\(%bx\) +[ ]*[0-9a-f]+: 67 c7 03 05 00[ ]+movw[ ]+\$0x5,\(%ebx\) +[ ]*[0-9a-f]+: 66 c7 07 05 00 00 00[ ]+movl[ ]+\$0x5,\(%bx\) +#pass --- a/gas/testsuite/gas/i386/intel16.s +++ b/gas/testsuite/gas/i386/intel16.s @@ -18,4 +18,14 @@ lea ax, [di][bx] lea ax, [di][bp] - .p2align 4,0 + notw [ebx] + notd [bx] + + nopw [ebx] + nopd [bx] + + addw [ebx], 5 + addd [bx], 5 + + movw [ebx], 5 + movd [bx], 5 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -135,34 +135,27 @@ mov, 0xa0, None, CpuNo64, D|W|No_sSuf|No_qSuf|No_ldSuf, { Disp16|Disp32|Unspecified|Byte|Word|Dword, Acc|Byte|Word|Dword } mov, 0xa0, None, Cpu64, D|W|No_sSuf|No_ldSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } movabs, 0xa0, None, Cpu64, D|W|No_sSuf|No_ldSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } -movq, 0xa1, None, Cpu64, D|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Disp64|Unspecified|Qword, Acc|Qword } mov, 0x88, None, 0, D|W|CheckRegSize|Modrm|No_sSuf|No_ldSuf|HLEPrefixRelease, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0x89, None, Cpu64, D|Modrm|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|HLEPrefixRelease, { Reg64, Reg64|Unspecified|Qword|BaseIndex } // In the 64bit mode the short form mov immediate is redefined to have // 64bit value. mov, 0xb0, None, 0, W|No_sSuf|No_qSuf|No_ldSuf, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32 } mov, 0xc6, 0, 0, W|Modrm|No_sSuf|No_ldSuf|HLEPrefixRelease|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } -movq, 0xc7, 0, Cpu64, Modrm|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|HLEPrefixRelease|Optimize, { Imm32S, Reg64|Qword|Unspecified|BaseIndex } mov, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|Optimize, { Imm64, Reg64 } movabs, 0xb8, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf, { Imm64, Reg64 } -movq, 0xb8, None, Cpu64, Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Optimize, { Imm64, Reg64 } // The segment register moves accept WordReg so that a segment register // can be copied to a 32 bit register, and vice versa, without using a // size prefix. When moving to a 32 bit register, the upper 16 bits // are set to an implementation defined value (on the Pentium Pro, the // implementation defined value is zero). -mov, 0x8c, None, 0, RegMem|No_bSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { SReg, Reg16|Reg32|Reg64 } +mov, 0x8c, None, 0, RegMem|No_bSuf|No_sSuf|No_ldSuf|NoRex64, { SReg, Reg16|Reg32|Reg64 } mov, 0x8c, None, 0, D|Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { SReg, Word|Unspecified|BaseIndex } -movq, 0x8c, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { SReg, Reg64 } -mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } +mov, 0x8e, None, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_ldSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } // Move to/from control debug registers. In the 16 or 32bit modes // they are 32bit. In the 64bit mode they are 64bit. mov, 0xf20, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Control, Reg32 } mov, 0xf20, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Control, Reg64 } -movq, 0xf20, None, Cpu64, D|RegMem|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Control, Reg64 } mov, 0xf21, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Debug, Reg32 } mov, 0xf21, None, Cpu64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Debug, Reg64 } -movq, 0xf21, None, Cpu64, D|RegMem|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Debug, Reg64 } mov, 0xf24, None, Cpu386|CpuNo64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Test, Reg32 } // Move after swapping the bytes @@ -492,9 +485,6 @@ set, 0xf9, 0, Cpu386, Modrm| // String manipulation. cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string compare. -cmpsd, 0xa7, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -cmpsd, 0xa7, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} @@ -509,9 +499,6 @@ slod, 0xac, None, 0, W|No_sSuf|No_ldSuf| slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -// Intel mode string move. -movsd, 0xa5, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -movsd, 0xa5, None, Cpu386, Size32|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Dword|Unspecified|BaseIndex, Dword|Unspecified|BaseIndex } smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} @@ -989,13 +976,13 @@ emms, 0xf77, None, CpuMMX, No_bSuf|No_wS // copying between Reg64/Mem64 and RegXMM/RegMMX, as is mandated by Intel's // spec). AMD's spec, having been in existence for much longer, failed to // recognize that and specified movd for 32- and 64-bit operations. -movd, 0x666e, None, CpuAVX, D|Modrm|Vex128|Space0F|VexW0|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { Reg32|Unspecified|BaseIndex, RegXMM } +movd, 0x666e, None, CpuAVX, D|Modrm|Vex128|Space0F|VexW0|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX|Pass2, { Reg32|Unspecified|BaseIndex, RegXMM } movd, 0x666e, None, CpuAVX|Cpu64, D|Modrm|Vex=1|Space0F|VexW1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64|SSE2AVX, { Reg64|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2, D|Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, RegXMM } movd, 0x660f6e, None, CpuSSE2|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|BaseIndex, RegXMM } movd, 0xf6e, None, CpuMMX, D|Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, RegMMX } movd, 0xf6e, None, CpuMMX|Cpu64, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg64|BaseIndex, RegMMX } -movq, 0xf37e, None, CpuAVX, Load|Modrm|Vex=1|Space0F|VexWIG|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } +movq, 0xf37e, None, CpuAVX, Load|Modrm|Vex=1|Space0F|VexWIG|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX|Pass2, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } movq, 0x66d6, None, CpuAVX, Modrm|Vex=1|Space0F|VexWIG|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { RegXMM, Qword|Unspecified|BaseIndex|RegXMM } movq, 0x666e, None, CpuAVX|Cpu64, D|Modrm|Vex=1|Space0F|VexW1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64|SSE2AVX, { Reg64|Unspecified|BaseIndex, RegXMM } movq, 0xf30f7e, None, CpuSSE2, Load|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Unspecified|Qword|BaseIndex|RegXMM, RegXMM } @@ -1159,7 +1146,7 @@ andpd, 0x660f54, None, , cmppd, 0x660fc2, , , Modrm||||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|ImmExt, { RegXMM|Unspecified|BaseIndex, RegXMM } cmpsd, 0xf20fc2, , , Modrm||||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|ImmExt, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } cmppd, 0x660fc2, None, , Modrm|||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } -cmpsd, 0xf20fc2, None, , Modrm|||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Imm8, Qword|Unspecified|BaseIndex|RegXMM, RegXMM } +cmpsd, 0xf20fc2, None, , Modrm|||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Pass2, { Imm8, Qword|Unspecified|BaseIndex|RegXMM, RegXMM } comisd, 0x660f2f, None, , Modrm||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } cvtpi2pd, 0x660f2a, None, CpuSSE2, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { RegMMX, RegXMM } cvtpi2pd, 0xf3e6, None, CpuAVX, Modrm|Vex|Space0F|VexW0|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { Qword|Unspecified|BaseIndex, RegXMM } @@ -1184,7 +1171,7 @@ movlpd, 0x6613, None, CpuAVX, Modrm|Vex| movlpd, 0x660f12, None, CpuSSE2, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Qword|Unspecified|BaseIndex, RegXMM } movmskpd, 0x660f50, None, , Modrm||IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_ldSuf|NoRex64, { RegXMM, Reg32|Reg64 } movntpd, 0x660f2b, None, , Modrm||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { RegXMM, Xmmword|Unspecified|BaseIndex } -movsd, 0xf210, None, CpuAVX, D|Modrm|VexLIG|Space0F|VexW0|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { Qword|Unspecified|BaseIndex, RegXMM } +movsd, 0xf210, None, CpuAVX, D|Modrm|VexLIG|Space0F|VexW0|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX|Pass2, { Qword|Unspecified|BaseIndex, RegXMM } movsd, 0xf210, None, CpuAVX, D|Modrm|Vex=3|Space0F|VexVVVV=1|VexW=1|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|SSE2AVX, { RegXMM, RegXMM } movsd, 0xf20f10, None, CpuSSE2, D|Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } movupd, 0x660f10, None, , D|Modrm||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } From patchwork Tue Oct 25 07:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp857843wru; Tue, 25 Oct 2022 00:27:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+88/GhhqOs+MgQ2dcEz8bX0DgHt6k3kkG0lTDbiy9BrKvR2F8wWS5ATYwF+oFGrI8qP/I X-Received: by 2002:a17:907:31c4:b0:78d:9b2f:4e1a with SMTP id xf4-20020a17090731c400b0078d9b2f4e1amr31363391ejb.306.1666682843203; Tue, 25 Oct 2022 00:27:23 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m13-20020a170906580d00b0079d5da30399si1764568ejq.427.2022.10.25.00.27.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:27:23 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OHPMmsSJ; 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 131473857B9D for ; Tue, 25 Oct 2022 07:27:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 131473857B9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666682842; bh=5PM+NHp4F8v8wpXai6kcN3ui4jV7hUSlqmxQm2jsY0M=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=OHPMmsSJVGANMk7nMGu0TmPFoHBAXYjNJ2WK/u9fibyxfNhHWRtcKaZsnqPIEMh8b QpNDfhsArXqStgZh1HofxLSz4z6HC1hKmysw4NL2oYSvPF/P5wu6zvTQOZJnhAsUSO /fZ1M2svUhps4LiohypLX1PwIWa4YdoUGv0MVuZM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2051.outbound.protection.outlook.com [40.107.247.51]) by sourceware.org (Postfix) with ESMTPS id 172923857B80 for ; Tue, 25 Oct 2022 07:26:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 172923857B80 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bhu6KikdiLEoMjPhqJ430aWuRDSUxtUw2eL+M1LmWL5tLWcDwESPV0c3nrS2ZGQlt2fceQvc9O+hmyUScwA6JEoR9SiTLHdbp+MhNm/oJWEFx7hJR8UXM2kI4Gs34QGLDh21TcT5SwfsQRj4sOI3F1pyTNsvJb4Vm97+oNpOiPPCBuIZFjU8ZWyrCm5bRk0osUcojRz9YpA//kAilYviehseYZH9yWdkytuZr+MFrH1XJs7M4jUXeoYzT3R2t2bsctD5Fi8UiMcljOeHOXxxz5EijwGxkluY6dp2UQhW4zie6wL2WX6K0KKXHHmAWtxoEhWs99vggJdLhvXCYmH3rA== 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=5PM+NHp4F8v8wpXai6kcN3ui4jV7hUSlqmxQm2jsY0M=; b=kixpPCUa6oekVlbhuovTrzK7PS8kp/RGzdcSjs0/3NFCNiki4ftU2gOQtbR8adL1kp6ydyxGgufINO80Qc/PHw9XqSkO6oieJJQ0lUHumZDv+HQjcxzvoYfUHOWxNkPaT59oN4u5gYSUPIeYnezMd4RGxmrKiulIKi4trid/HDTYa1Cm+jikkON9RZk3ZQtA1tJ1fFJeekiLv7vKrbFeB2xk6moYOJ3cNbGQ5VQG6gSFQPUzmu7W9ht4S4WE5SCuHnl2zqvotwYpKwghmmQQTO2K09gg8DqlYQMZni46OqQDXV39sbtn5KqXVMf3Zc2gmDyZLOfTw/gdjHT9eoj/ZQ== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:26:42 +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.5746.021; Tue, 25 Oct 2022 07:26:42 +0000 Message-ID: <13fc630f-e116-0099-5c9e-2697df6519d7@suse.com> Date: Tue, 25 Oct 2022 09:26:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 4/8] ix86: don't recognize/derive Q suffix in the common case Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0028.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::19) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d1aaf86-cbdd-458c-bba2-08dab65a435f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6mh3gaXEqe5YokFHZ4EH9kkP6BKjeH5x9EMgDn/88sCaFy2MKzxZ8/2iqtr07jU5nJUW/193Dg4yvqI2BOc69iO6d4fXqCMV8bAnB7VLCLTQfhEJ7h3M2rkid4v6+X/aFU3EaKZ9XZo0p9Ee+sCOKdYv7M4G5HqUlrkCX+qK72cnE38SrCY8iFbNHbBOVZ3kK6Z8Q7ETWK70ez1dlNdybxD0vPNgc3SxTiLX89SCJqjKVC/V25bysR9tvh2fRiGOttD6U+iM+gcuoa2p4x03Igsx/p4hCWgvsjElVHynCR2eEqpXlX/HlmggQMWK/y5QfsAHskgPRgSN+YQmpKu6jhOtA/IQP4wkNP+YCVASo4DZCVkmNKWE07/pxq4DjXPWGkYdEDpuL9kU+Y6aA1No3IrDOtLzwcgeuskR8jiNLtWhSqJ0NyAymjjfF3YrZpwM6RNMupGDag7Cck0DFAgp1yfYRHNpndR+8qz8jKOnr9BlCeM3hGK6nXE0zUnLXmHVDuQEWZjQxc4so4KgmvghV/wbzQCLyd2HFdmmqfr67n5vI9nzZdRWp3GnXtkuAcHVrwJvbcYcTEaKNF3Ha/cLjZm/ygyyn6gEiimMsf+vMicKJcApwlbHGWgi1IB1MuzGAIx7PIgaBHt7vk1wOHnVo0YXjYsBV1VGq22pvlC9WLJOQLNbkQduiHxhwp8NdjRu944vJY2ER2LifmeQHgndOhkfpv1aIhkik7vii5Mr3sTbv5ZOueWpLGM/l31UO6xulAaxLt39H07lV6ZqzGNXa0g8U759sishrvLjBYIC6a4= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(83380400001)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(30864003)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8W9/hBdUg34vnLCbKbDPmCwTQkk+?= =?utf-8?q?6jnWY73wJ/9sNFz0d4qf6KBjkTjPmAQFpmS1xYZEjXh777CwagI5K2mQId9YJZ3lh?= =?utf-8?q?j+ey0gxEQBDka0cRmCPBcuj7ZI61XZSTazknsM1hFs+xv5lp2DKVmaor2a8tvlCL/?= =?utf-8?q?lu1ISrktINTIiEjn3K8Zwx9HxO9yr4JLKDrlJSyHOihWzjWbhIrFfHIE0UtpW60CK?= =?utf-8?q?MuGTGO7muwc1+Z5PJE053gWiurK9CTsaXx/SHSFQxLMHFuldko0lxwcm1LeZDq1S1?= =?utf-8?q?VX/yFu6cjeSZOK55Msumwnjj+Bjf3J0HsYbA88TSVibZznT8koJF5loEX9TQlSFkl?= =?utf-8?q?Dad/yXR/a6jtQQoPzWxhiLxRMGQL7bIED4Mf9DcXWZNEA8hCXI/kSMD+tgGJF3RYK?= =?utf-8?q?hULnEKc7HxMOmsiBvnJJ1sxavAaIy6sEh9ihrsufTWKUc7rbsizezvsCgBGy0tHKl?= =?utf-8?q?a7x5qo+KVE4q70QbuTRf8X8YdllKX2gTT+jHWNiwzOBoyVPT4AhSJRUrQqTFjw7oo?= =?utf-8?q?c+oI8h3kQiXF5aLXGWHbBEOCgSS6cf/mJpTWy4YxGixkm+7NZvCR3E7Kq02u545kd?= =?utf-8?q?JrvBiRPMZUf9TMCcT9VFyQHoTy/0lU6em8atsWW3J6IAImSgPCyZ3dpiMqHJ9v1ay?= =?utf-8?q?OAckcfNRgeyHcwYrlCmmGHAUvHHVtZpwHBMuFTVV9vhtCMqxxRFl+d6dWLEE5+krv?= =?utf-8?q?zqD+iF8EN65FCjiVOSPsbm4cLQs5QtERbIqlZxAoicdthSPn/g+1ovQ3V6P7bRJBx?= =?utf-8?q?dlzZ2AdoJsEwqkA2PxMhhUD+dl/LxyT1TEbv+6wWZ4YXUG5SQsD1wJbOsaBVw1oQH?= =?utf-8?q?MYKirVOsJL9NUIf7LgIPejmguS2pPh1WL0NcF8oEIdQy2SfBAMwitGaA5iPqkkeNR?= =?utf-8?q?jhg/ZS2N1DCB3XetImaqAh6qG6YA6lHC0o6lycqJ9nFPenKUf7NS2kL5wcuQUWUQJ?= =?utf-8?q?nx6Eh4kOLe7SglUDx1675IMEJmB8lI0765Z3OA1agwm3aLZS+/tnehWCFkNYS0tnV?= =?utf-8?q?V4wRjldCf60uVh0xS8E6jEzFzPXt9WecXvNhOldtys4/lv/THwBnCP0RvEOziz+a0?= =?utf-8?q?hzKE5lAFkJ/vgQ9btqiw7hFP93di9a7+kAiy4kt3MrCCGl0Z5r+daHFnt4NDYWYjJ?= =?utf-8?q?UsuTfSIZcOJHUB+dUCFLs+jEp1e6jhw+gS5CeLvD4Z0WdAjIoirIUPqarIB4v4Au4?= =?utf-8?q?Pewa6flfSO3GUalkd+42fIGzdTP8ZBv3hiKDlKEZkcT6a/Lk0oJBB1k1jPxFzdHcT?= =?utf-8?q?fwLsd6PmnQcP0Hh2iPMdEKW1ECDlMyCPatWZhEG8PZPhI6nthDSuR5I456v3QJbST?= =?utf-8?q?cjyCawVswKLSn9ttUB9/BoGnST5gY80XC2IMDgGGuQ6qqcMNmLzn+hFjg7dePf8hj?= =?utf-8?q?SculXEUzFAJbDi9XLG2qs+qi2fW4QBGwKzXaQrfS/tG3hGzUJ3avM8gRQo+14hTJA?= =?utf-8?q?e67XImYHmb0mZESbEvzPG6hSwpOU9IPnJbxegA0kIVdmg0oBoMYI7n6ujYVlpNQuK?= =?utf-8?q?/bcpOpVM0sTY?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d1aaf86-cbdd-458c-bba2-08dab65a435f X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:26:42.1099 (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: V9vbRgXzAi1COy3wL0ZNid8OtlvphzLEpxYCNX9RXq0dp+J6TNzmyvdL+vbEqfW9r5a6JP5eFW4LN9w38Om7dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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?1747643628942141709?= X-GMAIL-MSGID: =?utf-8?q?1747643628942141709?= 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. --- v5: Re-base over re-arrangment of patch series, requiring pieces to be moved here. v3: Re-base over changes to earlier patches. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -236,6 +236,8 @@ enum i386_error unsupported_with_intel_mnemonic, unsupported_syntax, unsupported, + unsupported_on_arch, + unsupported_64bit, invalid_sib_address, invalid_vsib_address, invalid_vector_register_set, @@ -4823,7 +4825,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; @@ -4848,6 +4850,16 @@ md_assemble (char *line) { if (pass1_mnem != NULL) goto match_error; + if (i.error != no_error) + { + gas_assert (current_templates != NULL); + if (current_templates->start->opcode_modifier.pass2 && !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 (current_templates->start->opcode_modifier.pass2) @@ -4947,12 +4959,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: @@ -4985,6 +5006,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; @@ -5326,6 +5364,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) { @@ -5621,20 +5676,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; } @@ -6653,20 +6709,12 @@ match_template (char mnem_suffix) for (j = 0; j < MAX_OPERANDS; j++) operand_types[j] = t->operand_types[j]; - /* In general, don't allow - - 64-bit operands outside of 64-bit mode, - - 32-bit operands on pre-386. */ + /* In general, don't allow 32-bit operands on pre-386. */ specific_error = progress (mnem_suffix ? invalid_instruction_suffix : operand_size_mismatch); j = i.imm_operands + (t->operands > i.imm_operands + 1); - if (((i.suffix == QWORD_MNEM_SUFFIX - && flag_code != CODE_64BIT - && !(t->opcode_modifier.opcodespace == SPACE_0F - && t->base_opcode == 0xc7 - && t->opcode_modifier.opcodeprefix == PREFIX_NONE - && t->extension_opcode == 1) /* cmpxchg8b */) - || (i.suffix == LONG_MNEM_SUFFIX - && !cpu_arch_flags.bitfield.cpui386)) + if (i.suffix == LONG_MNEM_SUFFIX + && !cpu_arch_flags.bitfield.cpui386 && (intel_syntax ? (t->opcode_modifier.mnemonicsize != IGNORESIZE && !intel_float_operand (t->name)) --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -824,7 +824,7 @@ i386_intel_operand (char *operand_string continue; break; case QWORD_MNEM_SUFFIX: - if (t->opcode_modifier.no_qsuf) + if (t->opcode_modifier.no_qsuf || !q_suffix_allowed (t)) continue; break; case SHORT_MNEM_SUFFIX: --- a/gas/testsuite/gas/i386/opcode.d +++ b/gas/testsuite/gas/i386/opcode.d @@ -592,6 +592,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnp -0x6f6f6f70\(%eax\),%edx [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovp -0x6f6f6f70\(%eax\),%dx [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnp -0x6f6f6f70\(%eax\),%dx +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[a-f0-9]+: 82 c3 01 add \$0x1,%bl +[a-f0-9]+: 82 f3 01 xor \$0x1,%bl +[a-f0-9]+: 82 d3 01 adc \$0x1,%bl --- a/gas/testsuite/gas/i386/opcode.s +++ b/gas/testsuite/gas/i386/opcode.s @@ -592,6 +592,11 @@ foo: cmovpe 0x90909090(%eax),%dx cmovpo 0x90909090(%eax),%dx + fildq (%eax) + fildll (%eax) + fistpq (%eax) + fistpll (%eax) + .byte 0x82, 0xc3, 0x01 .byte 0x82, 0xf3, 0x01 .byte 0x82, 0xd3, 0x01 --- a/gas/testsuite/gas/i386/opcode-intel.d +++ b/gas/testsuite/gas/i386/opcode-intel.d @@ -593,6 +593,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnp edx,DWORD PTR \[eax-0x6f6f6f70\] [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovp dx,WORD PTR \[eax-0x6f6f6f70\] [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnp dx,WORD PTR \[eax-0x6f6f6f70\] +[ ]*[a-f0-9]+: df 28 fild QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 28 fild QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 38 fistp QWORD PTR \[eax\] +[ ]*[a-f0-9]+: df 38 fistp QWORD PTR \[eax\] +[a-f0-9]+: 82 c3 01 add bl,0x1 +[a-f0-9]+: 82 f3 01 xor bl,0x1 +[a-f0-9]+: 82 d3 01 adc bl,0x1 --- a/gas/testsuite/gas/i386/opcode-suffix.d +++ b/gas/testsuite/gas/i386/opcode-suffix.d @@ -593,6 +593,10 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 0f 4b 90 90 90 90 90 cmovnpl -0x6f6f6f70\(%eax\),%edx [ ]*[a-f0-9]+: 66 0f 4a 90 90 90 90 90 cmovpw -0x6f6f6f70\(%eax\),%dx [ ]*[a-f0-9]+: 66 0f 4b 90 90 90 90 90 cmovnpw -0x6f6f6f70\(%eax\),%dx +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 28 fildll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[ ]*[a-f0-9]+: df 38 fistpll \(%eax\) +[a-f0-9]+: 82 c3 01 addb \$0x1,%bl +[a-f0-9]+: 82 f3 01 xorb \$0x1,%bl +[a-f0-9]+: 82 d3 01 adcb \$0x1,%bl --- a/gas/testsuite/gas/i386/sse3.d +++ b/gas/testsuite/gas/i386/sse3.d @@ -13,29 +13,30 @@ Disassembly of section .text: 10: df 88 90 90 90 90 [ ]*fisttps -0x6f6f6f70\(%eax\) 16: db 88 90 90 90 90 [ ]*fisttpl -0x6f6f6f70\(%eax\) 1c: dd 88 90 90 90 90 [ ]*fisttpll -0x6f6f6f70\(%eax\) - 22: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%ebp\),%xmm4 - 27: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 - 2b: f2 0f 7c 37 [ ]*haddps \(%edi\),%xmm6 - 2f: f2 0f 7c f8 [ ]*haddps %xmm0,%xmm7 - 33: 66 0f 7d c1 [ ]*hsubpd %xmm1,%xmm0 - 37: 66 0f 7d 0a [ ]*hsubpd \(%edx\),%xmm1 - 3b: f2 0f 7d d2 [ ]*hsubps %xmm2,%xmm2 - 3f: f2 0f 7d 1c 24 [ ]*hsubps \(%esp\),%xmm3 - 44: f2 0f f0 2e [ ]*lddqu \(%esi\),%xmm5 - 48: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx - 4b: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx - 4e: f2 0f 12 f7 [ ]*movddup %xmm7,%xmm6 - 52: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 - 56: f3 0f 16 01 [ ]*movshdup \(%ecx\),%xmm0 - 5a: f3 0f 16 ca [ ]*movshdup %xmm2,%xmm1 - 5e: f3 0f 12 13 [ ]*movsldup \(%ebx\),%xmm2 - 62: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 - 66: 0f 01 c9 [ ]*mwait %eax,%ecx - 69: 0f 01 c9 [ ]*mwait %eax,%ecx - 6c: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx - 70: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx - 74: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 - 78: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: dd 88 90 90 90 90 [ ]*fisttpll -0x6f6f6f70\(%eax\) +[ ]*[0-9a-f]+: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%ebp\),%xmm4 +[ ]*[0-9a-f]+: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 +[ ]*[0-9a-f]+: f2 0f 7c 37 [ ]*haddps \(%edi\),%xmm6 +[ ]*[0-9a-f]+: f2 0f 7c f8 [ ]*haddps %xmm0,%xmm7 +[ ]*[0-9a-f]+: 66 0f 7d c1 [ ]*hsubpd %xmm1,%xmm0 +[ ]*[0-9a-f]+: 66 0f 7d 0a [ ]*hsubpd \(%edx\),%xmm1 +[ ]*[0-9a-f]+: f2 0f 7d d2 [ ]*hsubps %xmm2,%xmm2 +[ ]*[0-9a-f]+: f2 0f 7d 1c 24 [ ]*hsubps \(%esp\),%xmm3 +[ ]*[0-9a-f]+: f2 0f f0 2e [ ]*lddqu \(%esi\),%xmm5 +[ ]*[0-9a-f]+: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx +[ ]*[0-9a-f]+: 0f 01 c8 [ ]*monitor %eax,%ecx,%edx +[ ]*[0-9a-f]+: f2 0f 12 f7 [ ]*movddup %xmm7,%xmm6 +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: f3 0f 16 01 [ ]*movshdup \(%ecx\),%xmm0 +[ ]*[0-9a-f]+: f3 0f 16 ca [ ]*movshdup %xmm2,%xmm1 +[ ]*[0-9a-f]+: f3 0f 12 13 [ ]*movsldup \(%ebx\),%xmm2 +[ ]*[0-9a-f]+: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 +[ ]*[0-9a-f]+: 0f 01 c9 [ ]*mwait %eax,%ecx +[ ]*[0-9a-f]+: 0f 01 c9 [ ]*mwait %eax,%ecx +[ ]*[0-9a-f]+: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx +[ ]*[0-9a-f]+: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 +[ ]*[0-9a-f]+: f2 0f 12 38 [ ]*movddup \(%eax\),%xmm7 [ ]*[0-9a-f]+: 0f 01 c8[ ]+monitor %eax,%ecx,%edx [ ]*[0-9a-f]+: 67 0f 01 c8[ ]+monitor %ax,%ecx,%edx [ ]*[0-9a-f]+: 0f 01 c9[ ]+mwait %eax,%ecx --- a/gas/testsuite/gas/i386/sse3.s +++ b/gas/testsuite/gas/i386/sse3.s @@ -8,6 +8,7 @@ foo: addsubps %xmm4,%xmm3 fisttps 0x90909090(%eax) fisttpl 0x90909090(%eax) + fisttpq 0x90909090(%eax) fisttpll 0x90909090(%eax) haddpd 0x0(%ebp),%xmm4 haddpd %xmm6,%xmm5 --- a/gas/testsuite/gas/i386/sse3-intel.d +++ b/gas/testsuite/gas/i386/sse3-intel.d @@ -14,6 +14,7 @@ Disassembly of section .text: [ ]*[0-9a-f]+: df 88 90 90 90 90[ ]+fisttp WORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: db 88 90 90 90 90[ ]+fisttp DWORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: dd 88 90 90 90 90[ ]+fisttp QWORD PTR \[eax-0x6f6f6f70\] +[ ]*[0-9a-f]+: dd 88 90 90 90 90[ ]+fisttp QWORD PTR \[eax-0x6f6f6f70\] [ ]*[0-9a-f]+: 66 0f 7c 65 00[ ]+haddpd xmm4,(XMMWORD PTR )?\[ebp(\+0x0)\] [ ]*[0-9a-f]+: 66 0f 7c ee[ ]+haddpd xmm5,xmm6 [ ]*[0-9a-f]+: f2 0f 7c 37[ ]+haddps xmm6,(XMMWORD PTR )?\[edi\] --- a/gas/testsuite/gas/i386/x86-64-lfence-load.d +++ b/gas/testsuite/gas/i386/x86-64-lfence-load.d @@ -44,16 +44,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 @@ -27,12 +27,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 Tue Oct 25 07:27:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp858453wru; Tue, 25 Oct 2022 00:29:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wbvhLzfgF6LKIio9x+WNqOGKKiJT56G+5cAv859wpAAMe59Sn2cCSA7T9M6Em91whog8X X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr25752903ejc.474.1666682968167; Tue, 25 Oct 2022 00:29:28 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s24-20020a056402037800b0045cd50b7c65si1704866edw.266.2022.10.25.00.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hMws1Hjq; 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 E34F538582BF for ; Tue, 25 Oct 2022 07:29:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E34F538582BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666682954; bh=u5PpalHJrPiVNjaxzYwPTm/OmWfm9/ox7GdciLPMZXo=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=hMws1Hjq5/zNfuTjRyrWT1IUZCErMcVr+3U95Wmod4IEu9stTATe3VqiUhCAUK7Zi 75d4MZWMUWt/Wytdpiuft/81+2cmd2IPivNkp7+LdHRSBnIgqrBNQQjAyN3MOHyRAi dIWbOr+5nWeX230+5oUMzsoQJzr4JODlyq1v8Q7o= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2085.outbound.protection.outlook.com [40.107.247.85]) by sourceware.org (Postfix) with ESMTPS id DCDD93857C72 for ; Tue, 25 Oct 2022 07:27:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCDD93857C72 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNvqUHSUddoZGbNqss8GLOvmo0Jx5qFCTn1Dr6psBkdVNdqfYOzKdO+VRe6X+GPtcbio7gSSaQQwT3Ayy9Ly4LLCPN3O0e/GOvOtWeHZqawJNRa6/b81khSWim7zrxc75zTX2X5s7K/EfsOg2DVg2Iu+wvXS1IxF/S9cRRWK/WOpWy7AT92Q+SzEY5g9wkKeUDKd1VTSarLTn278b5Gfxpn3gJ0HHVs/CGt+GZeluFs0E2H0vqlceLcjtta4DG/5kmts+J1CBXF24EkKyg19yO0bGw7hsokdun8t4VF/pgTuSGQWKe5C7NoEyCzLf6PrsmWIlJjW6oPM96bS/m3mpg== 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=u5PpalHJrPiVNjaxzYwPTm/OmWfm9/ox7GdciLPMZXo=; b=LHzuElLpy/tmorbwfYdZtMQcVnyI2Nm2GoRGKruicjoEteo33LjmO2dMcVWLeSeMsTeCrZ38espqsev4vUpE3WBrrMsGiOBzqqJB2RZGVMQXhB4q/AZPfsvR7B7VBqWwA993J2oCkOQMRFygqKVgkcnlFmx/1UPq9tqv4XIMjiwxzABeKppB0Jp1GW5PsfzcjuihDMM4A9PnuehDWWyExhxTRXOhC48iB3jLdcyfUdgEgexR/YFdmXYbK41oYEcsPNnfFvNYnwZC4uYywsDx+iE0hKZwPs7ffLXS8abOsQ6wl0n9P+lBfDEKhNgmXMDDUK47ogmAvReXIUt+AZf0Qg== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:27:12 +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.5746.021; Tue, 25 Oct 2022 07:27:12 +0000 Message-ID: <74db429d-d203-eab8-4ae1-18b9ad416b02@suse.com> Date: Tue, 25 Oct 2022 09:27:11 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 5/8] x86-64: allow HLE store of accumulator to absolute 32-bit address Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::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_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: c2b8f4fc-d3b8-43ea-9897-08dab65a55a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FYXK+CAKDhbA/fycBAskeWiDeKNM50OQZMAmzhrjqoryxm3afqTknhfGnK4J+AIwRimB1I/6+17C9T7UJGJpvaYZzbJp0WycJ6ieC9miEg2ykuAtGme/nS6Oh3kY6gcvlSwghmuSnB5BFwoEfRj7GO72/eSGO25z1KmriVl4H8+RVO8b02xHZkC+go4C5KwXtVDw/978o5kdKOK9ghMxdIWhiCatrvYJg8FinBI3MCeGkVp/efSQi0BfrPYegeKeTcsklxTRbdnq8p0m/4PRm1KmJvFVXZp2LQ69IwGw8Sfn7VzHy7wyjgrV4Dj+LpqhFGqj1Fmt89EEOOVwEa6hG7z3v+pof692lS0NuuMeMCnPJ7I6E4fdmczUOqKy0Q6kO6X0dZKRU/nt7aQ33sSgOJtXUSpq61Mx6LuMVZ/HGjcgWdDECO3mgjXoy+CDlvhfZ+1EHiyMndXMuwlld6gkd+ndAFw1Y0HNlHZu/73MzeOpAt/Vzofsleb5doXiHfLeZPL9F+VuoQg9kJBKZs59csNBDhVEcjXkYKhXIG21YVtmJ5d58t0a05DuqjJXMRR9MkX3L8UNrvq3UdQ3gfyxgcVkfIJ2nzO8GMrlJmSdvRaJzaqMRxCzjWjTUDpjHLp+sTehkfUp3IUq/DxsKdzqU9rRKH9nOoI6TEVGyFGDVgwiUJyk9KCdyrPdw3+/bkD1t6fDTggmXTEomSn8kCI9AMEWUwLGbqrDgknml2BnatHNORYivEMwYqX4tspSyvm7+mC8bBjcWDdM754lBNUPIboeHA/vQxiEBLdT6pSiq7Q= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(83380400001)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GKGgM14hReG2MS9s4sqnN3F5rzmb?= =?utf-8?q?BBxV6LPDW3NYX31p5Sm10rrFhdKh4DW1kOqaFjl1a2oq9PQmNzUFNMvRABwPDHXS1?= =?utf-8?q?9PSjd4GyH6Ue+bbrqf7cCQ6eHdEVYlmmoK75afpG+va1F0YGD0NCnbZm7BzakgxpW?= =?utf-8?q?53P3NyX1UaDkEVLO3GpFwvSSGOUa6tO4+MDPGDr8ifAlIqw59L3pEhMi9jlD+qZGr?= =?utf-8?q?xjxLOK50tsXT7S/28Hxw0ngvGKzU+agHOg7ZwOMUcftgOELoPCCtXzvP8Cn9CkAvE?= =?utf-8?q?3PjqaO8c0AwZ9jOw1oMkBb71GytDPh4d3sZp7BtXPaocTX/MCU4u78C9jbBtuyJ6M?= =?utf-8?q?JIywOyDjzYOZcByYyGiKsfXxccBXjFII5Rln/tgjrbkRdyXpL+nU2ybfEhfIkJBql?= =?utf-8?q?oUyJEqy+X83OteZnjG3r6R4DDKlQQRpJsZlD8aWq+su8kDvFlIrob+vqbKo1covIk?= =?utf-8?q?ZVVpTu5Vju5XlvoEdZTkpOOTILxiNxsT+EABK8YiCx2vu2GtW/vqxyR/zbJDkagMx?= =?utf-8?q?uphKr7iZUEc9AtBCk3e04jEWkQRTJLfF2dNb9FDUMM3nGfbX7ZFIh6AGTyfxb0Qv8?= =?utf-8?q?PJhh87sJYdTwWFCIvXYDPSYt8YJOMspBgnGubuJ4JncmNqc3B4bhvCg+uZb+WPKf4?= =?utf-8?q?XVlfblUWwNMgSiUyuZEp/5RfmR1nEkQsB5o7HPtwlEXuYLw1FovHYMrBfLd+lIcfH?= =?utf-8?q?sz2bA2tqa0O5gEtOWdugeuyy7h9+GMgLQlvK9JWJBKLIg8g2/6S7VGbivlaxKGCgd?= =?utf-8?q?tMMnSSW72hvtIlxa8wF2/Wu8HtLMtydc4kRAKwatMlw14GoKtZblx22ry7fhT/eJJ?= =?utf-8?q?9CKd29uxgfPDNaE6NQwvgi5JGHYaO5flrpIz5TLetfZQyDx4iPj4Y0P434ywDT7Si?= =?utf-8?q?yHim42lwbSXGTHkr8uK9smKoxxGACgpcyEYtoeLRYgKbvqKcbu3tiTUjN4NIzqksV?= =?utf-8?q?x6hCbJ3pujIR+2pzuyl1slpdmJ6rUnoH3v230Vt1NhzkYzSYNyg61eqeE2zdDTojS?= =?utf-8?q?8nmRYNkQleeL+BVK0q9x+3CW5MSF33Ampog7Rscwop7K8gHUnTSwOIclM03qo6jET?= =?utf-8?q?QeqIohXw1tIgUOP4/T57X05CnNtjLah165itNp348Qu2hPhHlNNSDxro2GNLue1TW?= =?utf-8?q?CEI5p091sIPWlc82/ZRk9GhU4G39qB37HhwiwG5wYsTkeiP5Nn8lM3ZbHk9F9WA0j?= =?utf-8?q?Pr7l5u8jepTk4To2kMl/0j/Y5xE5W3+T+80WvyhMBm+nISGIlb8HJU3Wgz1QXa7Lo?= =?utf-8?q?UwTAWaeKtQUWPROdTo0to3UsV7NLwf/fZIbBQ070T5HedS6NNH9u/oyDgzuJSHT6y?= =?utf-8?q?pnpRdp7eglnWgdnRJb8+1Ues0ogs6lnug2FvCWnjFms8OsEulax05SvnW5WiCXEsR?= =?utf-8?q?E0nLWG64RU9NtwaqAF5YA5KYRTKF+jTZdJVQP/5jIXF2j2nNPOE9IoWS9gSF6+t0F?= =?utf-8?q?esu3Z3LtqVBnm7xB2k3k5niKsbALGLYNiJ1QiY4Jw9EM0MKrcOxH0vrSSuy5m56rM?= =?utf-8?q?vCGhaW9UgM3c?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2b8f4fc-d3b8-43ea-9897-08dab65a55a7 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:27:12.7955 (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: 8tt0CMQIpn3aX28SxwcWH+P47c7Wrvt/GShmCs+IbpXCgCl2y+KSsyENCkrTvTFrGmqUHBCTVUha/mpAzmEhLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.6 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?1747643760183442207?= X-GMAIL-MSGID: =?utf-8?q?1747643760183442207?= 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 @@ -6837,12 +6837,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 Tue Oct 25 07:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp858335wru; Tue, 25 Oct 2022 00:29:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MWLC+Wq0Xhn6OB60dQQ5Nkvf9U+NEoqHpHCok9AzkHKMxRWmh+Ei+a7bUruo7V0vTDgFH X-Received: by 2002:a05:6402:524e:b0:461:fa05:aff8 with SMTP id t14-20020a056402524e00b00461fa05aff8mr4265784edd.283.1666682940968; Tue, 25 Oct 2022 00:29:00 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b13-20020a056402350d00b00459fc3fcf3csi2091025edd.102.2022.10.25.00.29.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NISL1Irg; 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 613523857B81 for ; Tue, 25 Oct 2022 07:28:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 613523857B81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666682930; bh=SLBNqnEyXQJihwWPUKC/uBDm9D3Wk08ThguCdanHfyI=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NISL1Irg9CFFyDAhXWxKKXfKo9P+pR1wg8PPebbFlDBJnnWmLxTGri764a4hcUzlX p3fbBpH/AxZ7h6Exhne2lLZnrVFziDiCWodKmaR4O+LCfj2mtTPNkxobellmhjZ9VZ jxt8iXB19B6Xlb17m7XCLbTMX8Ld6UWKRN7fm41c= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2061.outbound.protection.outlook.com [40.107.247.61]) by sourceware.org (Postfix) with ESMTPS id 897413857402 for ; Tue, 25 Oct 2022 07:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 897413857402 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlB/fsI4U8YcgRi/LKjAiuT4ZhRMSLHQRqsIek81z1ZeaXnedDeOsBzyS1m/hIdHM3Vk4rxrnmQHZSUD+lyTSOtHemZcMuktNPkz9RfCgvH3SIuCLq8dxYGGjUUT/vSA07gctyDyYIzq4tmYT1FZKFYk4HrpfNQV981Ndkq65Y28uAT6eeOitbiHqJhUBNxBuZxEsSnFfh1IKzAjPBshF8jXLXX9Lrnczdr4rHn1nTSlgUnLPnEjI/OwAMO7GTWMSqC3bwg9/bxq8/HAUA2wH/qgn4OWmgisfVcBGgQXhdpn/Hm3G1ksIGVUH381L0fxpE8YK6FsEeNmLwIfcoMfmg== 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=SLBNqnEyXQJihwWPUKC/uBDm9D3Wk08ThguCdanHfyI=; b=lNOsLqFBS756UTC4qTkz2iUMPwGNgZqu1pDRAmGzZzxIGWuPjsV+wcnGWhoMscl2RuSe1BAwrOiSdVkb9uOUxiN/uz2/k/lLGamv3XqZ0cr15TvwKcs1djQql6bB/lHV8jTx5wDpYy3KiJEzTHOZUPCSEHyu+ShAB3ThuX16UBjZcqFg0DSUFVBUNsGQdFZzDgBGyp4Ln759KFBBtckJlbzvyUbW3jMJa/5YKK9wI/Gl/KpzrlaEdC/VusqUPGSbQz5lkrYKy6Zug+nFrymzSphJ06BBsnynjLxB/Bj1z+jcK1Reb77ydIBkjMUtHuk3DlMVnYv+K2haPm49gZBMFw== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:27:37 +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.5746.021; Tue, 25 Oct 2022 07:27:37 +0000 Message-ID: <2e2f7841-de4e-b5de-e8d9-a47a6a4113c8@suse.com> Date: Tue, 25 Oct 2022 09:27:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 6/8] x86: move bad-use-of-TLS-reloc check Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0127.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::13) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: 53b4bb81-06ec-4cb8-ee83-08dab65a640a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YDlBwaVJcm07Eiy5yM0p2Bx/HxBd1jK8fJ3JVRUh4kBmvUQ7km8fAn1OpJRQM2Vm+AG3slalm213B1lclei6HI6neInZSSD4LdTOtECmhIFJ9Am6DSo1D4GstYQaO0Va3W3jCxW/PONkPaxJI33Bhre4XLffGiGghgZG1cIsg9T1FZrTaYw7Kaeul5+RtdKP5ZgFBQU4GG0LKysAtfS+HUBOTev8wHJHL2WEqB5UIGhQNtRqnlFu3kxpzobxCXga55360LkRT9/uTtm7GVDS2XvC+xnsahFQ4fpUSed2HTp1P8qncjacb0YQD0CHcpqqdd1YMY4+WzQKcrg0SGW1Jegyz0RoYCllrlS8cdaYQCElwQWCLTBYFLiHYi6O6EdHm/TuVyd13VO4mGTeL3QPDymEL9lwonwXAZ1REaoM0NxS10OZJIGQ3kayGARMmiY1/oMjh9N5VpSuXiXDvugH6BLwbwATNe6B3huAEBZClg78wcC3BzTellAdge0RbwRY7gyeGZ011THEh0yMUmAX564ZLnav0pZ8Ta8MF9PrPeccEG09Oq7XMpeZBOPSKdSP+zjMdG6tvwEZe7LoOuyR3Lbx786Ne30gRjTVhuiw7W72qfZuMU6Kmyj9hMWZjTYHMQhN5xy7cahXKrzxnXC6unbCS2iZQMyrcoYFwC4zTXuu/YPAqXRHwGWRkmESCNljVqNeG4pVGzLbQhVqxiplySwgTFviNMkdWSkKXuULD3qb/up4aYQQ4qj9FQAxszuhoAE9yU0MPfyuqveNQJA/S2tFrghOnV2sy61cjMvLWQs= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?CULhXEW4ePsrM4fD2vwwd72/DHXP?= =?utf-8?q?fnHDYH0q4+d3ebYV5Zp0Prl7n5tlqHItuZwU+/jq9h4fk6CC4255waTW+XC4pq2sI?= =?utf-8?q?t5o8P5UzLZepRpoNjdQbCKuddOM5Kwx/8Di1+uGXlfngmmuaeUtuminVXX4SY1YNX?= =?utf-8?q?CDg5IJdJgE8d0amqaACBjbNixGU6WgpQiAn3X1vgdBVK0agG4hEG/FxH9kNVBzSGv?= =?utf-8?q?gz3K0W1JeQDy15Bgbav4DxHD56bPOkQ8MEgzKjxOz/++xlOsVJMSfHIhxiwXLfw9U?= =?utf-8?q?0bgL7JUyiTm/WXWoIa8Zu1MS7qsbvwPaURFnTMIs46Jii7XpYqa56u7l1t1F4VEVF?= =?utf-8?q?JuPguZ2BSlkNV3azDrdLKxU2VRc3KoTMHf/kCY+j1U8gXfmEeoo0uvu1ysTaZwmVr?= =?utf-8?q?m8TPc5FHSGizf6UQk8MBrecFFuVtOv84WCQdVwz+O0uJuigkUydCfrbQL3DqHtlIK?= =?utf-8?q?nt7MLozCJC2AQisG1sVlesz9P1b3LPc0y7wsHBSfkJnCXUbIDoHIFzu7F8YUz2ora?= =?utf-8?q?3alnkeFmxHZ0dS8nDlvwpHk7yQuIA124v1hBvrDWvfYfA8Qq/05vgh7mfrhclYtfN?= =?utf-8?q?fzkJxUJRUWyxfQ58fsA+zgS7mnRGP1bHMU1iZ/XJfCUIEKY3OtrhJFYN4qAduhJ9d?= =?utf-8?q?iHmd1GaV1ZXECW6U7IQvKMkOWYS4o4OzBp3TDA3qJn6/3JZfkq7hYHUt8lS5x5WUe?= =?utf-8?q?ZiNGp8iNUiT+sUglSttyu1V22YPK+50a8U7hEAhg+Sm1gTMqFQPPVopPdDxPmfBSJ?= =?utf-8?q?1OgNtQ9NlrcFP0YspKkMTPZtviNqrNsAkVldcQe3ZUEXbgsskI+1pt+tbt99mziNY?= =?utf-8?q?nwzWAPdmI36VjB2+Wy/+5iKUGcW5jnBX2+moLtGr+pd4riY0Ri38ta9vexcG+QhZh?= =?utf-8?q?VnDuJK9PxLJeE5Dk9wWr6n7MEOKKoP0/HCGqHZS2pUejfrdka2fjQPFcHHL+XZYJj?= =?utf-8?q?kUEs5taeFDDOU5NWoB6BWmLbA6ElzcEKIBG4Mkzn6IMG8e7CTIG+/5OHhC+e7izgo?= =?utf-8?q?JS58mHpa3OW+NaI54T2OI3Z+x+VQ2ATihhCnauZqys0dPzqre9IZzPGwqUnNnSadh?= =?utf-8?q?9F/xV/aGUd0PKR+fX0a0al1JQmnLgZSzl//ppScMD5fccHhI/gAKUJZDvbYJO2Kw1?= =?utf-8?q?9po9q9VWDk39eC+WFJyhr745/bQsszsL0lF0x/qoS+TpJtXxQSKKdWcuO2nxAvvAo?= =?utf-8?q?3Jki5Es0zHt3cmGtuIcBTWmdarqeGa7SJ+QIbhjedv3IYbDN2xhdzxkuSK5cIdBAL?= =?utf-8?q?2YpLameeu8/aywJyZIpwFH+BJwo5z5eKT3L+osFiAkojBox+AqYC13A3HwazVjdGV?= =?utf-8?q?bR4IZHkAd8POcjEA9WdIeS6Ghej3rAvBqfzmHAzZ3bueQEFIUA91PnrNsJQOghlL7?= =?utf-8?q?YykySYwiK1IG7oq/c2dqm99TCo1zl2D38UR10ALhitgGnG7fcTNhE5zMDWEzRi8ny?= =?utf-8?q?ty2Z5Z89sg/B48KtMQZZ4ROujaEO/ygwvxOC2Uu/TWDvsyOmfZYMFHV/Tx/AOumm4?= =?utf-8?q?Mc9yEodNAjSn?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53b4bb81-06ec-4cb8-ee83-08dab65a640a X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:27:37.0283 (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: mE1W9+68NL82jz/IHU9puBqQaj+owNdISyOp4lZHJq+e1W1K7oH/xDnqd985FPxFBG4ggjfyHJTpliZNSQ6Ipg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.6 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?1747643731925861777?= X-GMAIL-MSGID: =?utf-8?q?1747643731925861777?= 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 @@ -5118,14 +5118,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. */ @@ -6785,26 +6801,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) { @@ -6835,12 +6831,19 @@ match_template (char mnem_suffix) && i.types[1].bitfield.instance == Accum && i.types[1].bitfield.dword) continue; - /* xrelease mov %eax, is another special case. It must not - match the accumulator-only encoding of mov. */ - if (i.hle_prefix - && t->base_opcode == 0xa0 + + if (t->base_opcode == MOV_AX_DISP32 && t->opcode_modifier.opcodespace == SPACE_BASE) - continue; + { + /* Force 0x8b encoding for "mov foo@GOT, %eax". */ + if (i.reloc[0] == BFD_RELOC_386_GOT32) + continue; + + /* xrelease mov %eax, is another special case. It must not + match the accumulator-only encoding of mov. */ + if (i.hle_prefix) + continue; + } /* Fall through. */ case 3: From patchwork Tue Oct 25 07:28:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp858690wru; Tue, 25 Oct 2022 00:30:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pN6Ula1dx1QKNBMaN1cW5/fyh7KmjVHymy9oEQ3GjanxHcqCfeL8UfD1JwbcYEOquiJmk X-Received: by 2002:a17:907:2c59:b0:7a9:1134:db02 with SMTP id hf25-20020a1709072c5900b007a91134db02mr6967282ejc.508.1666683013614; Tue, 25 Oct 2022 00:30:13 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n23-20020a056402061700b00458cba4c78bsi1756097edv.416.2022.10.25.00.30.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:30:13 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="josVzFw/"; 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 D62B2385735A for ; Tue, 25 Oct 2022 07:30:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D62B2385735A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666683001; bh=bpxaWBMP5i/ufMaEBCnkbEUK3r3YPwclJCiwd9/xaVY=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=josVzFw/Az4PR6vpnaJF+g1LjGhUqawC54McXGPItlAflptltPPRl5FnF3RBA3+EM BBR0mWP5zw09AWVZcc3rHQIBv/P9rzSmcbuRWwPAsPyEK1Hr4gjpic3ePUMN7WAJKf 3eALRZGXerurw/UjAoFX7y+GL5fhs3UfK1b0vCyo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2071.outbound.protection.outlook.com [40.107.247.71]) by sourceware.org (Postfix) with ESMTPS id A0D15385782F for ; Tue, 25 Oct 2022 07:28:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0D15385782F ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W5biUFyj0CwneWdmcOn3MywsGmAcGbpFRWIo4Ch+R/0Tz99DKVxL0zx+Uk5ZtxiRVll3XIR8vte+90cA7qbq3UcgYS5kTLhYv5Dl5Pith+gTCH7EXsWU/9j1abYYp/6lXRFhXymDrmf48fjVttzv91cvJwHqrhG5wPR4Iuta9fDYq28j0E/wLrR2Gljz8+WSksm6+QatCC7PlokaAukff78y6L/Y6tiMieB6js2CpnMlmSkx2OWBtzSkj6mwFcPlCwhF2tTwFngVjA7acvQk+18qvEKsIOh7cf9DiIb2zgonwYscVMKu66Ub5t4xeNEAlp8Dgd3Ijs423sabbQcowA== 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=bpxaWBMP5i/ufMaEBCnkbEUK3r3YPwclJCiwd9/xaVY=; b=hcI27UJK6HEOV/Pe4CxBfrjium7xPY/Zbc3nGwkFUhaIgzHmSqDPD81TP3TzvnQZUFAJRTRTLrBVwsNOXeA06PoZ95kUbqgTAJTUb3TszUPHIYLjj0dF0kBeIi1Da8X78P5Hpwo3fu3NpjuMQ1S4Aai7IJPBp3EGY0x7zPXWTdZ2hifXOhFMLzCGu4AMWXbniXrcl8o1Gg3CuV/JAKznyKlEValRT8Z9OBoX2ZXysQAIP2eXoPCaWJNro7tHcI3Ub1Zn3VIG8zUXYLLUcwJ7hxy/JdKZpDwRVco8Ya8Ytw191kW8sO1/mEFFaOHNtg4B7ZFUBrDx3kFWMgplSDiOVA== 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 PA4PR04MB7933.eurprd04.prod.outlook.com (2603:10a6:102:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:28:29 +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.5746.021; Tue, 25 Oct 2022 07:28:29 +0000 Message-ID: <421bc96e-7591-6980-48e9-5af8c8b0775a@suse.com> Date: Tue, 25 Oct 2022 09:28:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 7/8] x86: drop (now) stray IsString Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR0P281CA0059.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::7) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB7933:EE_ X-MS-Office365-Filtering-Correlation-Id: 5df18db3-1330-41cd-75a3-08dab65a831e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vr/AR7PqzwTKu91TYQttJrj8w4SCC7hfg/TtWKVu+Nw5eDeVzcbV7P3/bRmllQZujcIparx3hDL9alDSVhDHGZPu4QK9ntD/sw8a4jNEBgv4aPrdrgHTz1wmnG1sLap29dcTLdd2Mhu8pUy3WJrGrQU0IXfGM8hq1svvEULevmutNiCo9+5x/rUClf7T4y/yN9roDeRYnRSuqLBlPeMOJa3JNrgXhJy/wilfsT4mNq7o3UBxZhi5i7hfvvwoZmc42dHa52GleFs8X3fCteYkba/7Rbt2UIGNGNkY033PHFOHmAjIGiPJEqQNG0o6xNyu8bIwE07apeQFg/l9kZbhBX4HNSaYsNUEvZt7zQrPXyXB7HVxRvXzNZsrxVAK8rOuI9tmDUjn+7887InoD53/Y8R67mdWgJryq5cZGfWNxVH0a1FxXkfFgSC+vHcXGKW5Tbv0PUXpcdV1yYzo5JVdsUAAdlKWcfeZt0CfyMh+l4uADYG4oWm3LukpekdcYUOC2laKcQ1s6K8dmWqaGsaH/iPJEADs+RJVXB8xO+8blV6gNMOY4GTAY7KNItYLYy6gDg5hfHSb6ooZKDZAfbmZ38pHnNFLYeF81vQjG6yjRzwtnGq1c5m1GFJ0QljUSx6jC0m3a6NCSqyZev79e2SDoC7FTtPBPSCCtL2lt9p0AD+txolHthWFjfyv8l6fFSLJzPGzeEmgjPvHeyx9XFIQFonQm39yJYg6+4jX9On6PxopR6KdWhpNdI8aa+waDXQmUy0g0Uh6JuDJ3KeVXcNrB0XF3WuahzS1alHBSBf/6zs= 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)(396003)(136003)(366004)(376002)(346002)(451199015)(86362001)(316002)(38100700002)(83380400001)(31696002)(6916009)(6512007)(66476007)(41300700001)(26005)(186003)(2616005)(30864003)(8936002)(5660300002)(2906002)(8676002)(4326008)(66556008)(66946007)(6506007)(36756003)(6486002)(31686004)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?rKAigvMJiEgX9mamFlXZY/z86KfC?= =?utf-8?q?iTn6dblg1bOlp49pCjlKPI6DoLvC4dboDoKVn8KyaguiHYgW2TqqVA7De92vdCuRg?= =?utf-8?q?GErJ9vR4a5Q5t6D2Cg2eUfsABj6KxTOcKXL12+ePTpHeGMUbrTRYi9YTsar7UOW6D?= =?utf-8?q?aOJTAsvLC5UXkoz2BC1lYzUrGyzQ4NhxfVELQojK36vHkq3SD0TKrDZgppeDtcH6E?= =?utf-8?q?kjt7Hads+MvT8ZtxODPEW94802a/KXezYOD1gq5qeYb0UaJBOHAjSDOwnhZG749ci?= =?utf-8?q?b8iYCyomEDr2VFsysJ4ow8lbkarl3EWgAXwREW/JzuMxJ1NOapNJox7c6YIo7eFNE?= =?utf-8?q?tkHIj1Kc3HFIJbWGXk4dfj+w/qtpRXhJ4Xcn6YndNKJ0JZkt0eE9FJXtYPS4WCQl+?= =?utf-8?q?xip9pQVBjseVONdiNIoGf2KNMdB4X2+EUyF2PX+WkfD3s34qL2g5dQpIbfGwxx8aL?= =?utf-8?q?0/KhOwjV/g479NQUCszTQVMuHpzowbN2RTTR3uFOsjTzNuuOdRPs8IEuuVG5uJU72?= =?utf-8?q?AuuyXPtTYNqmrnaKXXH/tYK0bLduEry0YK+704/4f78rf3pArKp5RyuQNDEYuZmjV?= =?utf-8?q?Y5XHKIAjWIONM9wbion5cfCe8ZNwJfDa5tPavqvnUQYml0wba3BLrvLSPRcPNHpe5?= =?utf-8?q?2vkoEaAbGcL7tHyx/xLDYDKWn012i1DsC23RGsTUDW22F54+N0p9cuYjxxeqeNWjf?= =?utf-8?q?QauZbIxYfal8xiK5qjYQvIyOQVq8zb1sexFIUlrzDiJlHTXSIVoDurPWWd04Ox1xZ?= =?utf-8?q?5EWNgtCSbfIBWSRFxGDFeo5CiOXoiG2fPzGD0MVq0Yr55EvcUcACQ2Gpx8EUe3x/7?= =?utf-8?q?QRkQO5jr5c6xboUAoKWSB6M7ahxpPUzFbevXVddsj7mnyin2kr7iSDebEIX1zGFyC?= =?utf-8?q?5+dBlAtmyYeqcPuS3dEeCT1KmquJU6+CLd+aMOFpiadgy787f3g0gB8JXfcZOSsqC?= =?utf-8?q?/MGGtoG+pLLndkosBH2Ww563+ibIaX1WQG0Qf+GWfR0Qi8+Gp8niYVJMnfDM1lq+N?= =?utf-8?q?xRbm9yFAuHtjFN/9m+E6Rl85VtKwWgZvyo2V9Nb9qezPPn02rwJx/nzavP/ZvOW4w?= =?utf-8?q?0j/aeb47hXrCt0jhonVMozMwCc+R65v6ffWOp4j0sGYQZwyMWUHyYTqQhMRQFVLNw?= =?utf-8?q?bcQ9TpBK+BfZ2M4euaU/YNZeSYGGWPbFx0TaVRy7rGcDFKo8vU8Wt/XpYYTJzPjy5?= =?utf-8?q?YvEyFhLx3UJk8mb0RQSP22COVy7/ZJ9+fkY6lUgqh9BCrLUIDYP2wFZSuPdOzNjVe?= =?utf-8?q?pYH66IPuC9zxZbImUhsDhzqahmV5yYb3FU91/6WlfllsfswrxxbYV/RVpVmGGB9/8?= =?utf-8?q?OwgYPEKYta01BSF9g2T66+kzGizuNBQmyvrZUFB1OACS3uQA73Nc3UHJHZCBxP/Fz?= =?utf-8?q?/g6gE1EdRwKdDEHM3GxL2ZrNL3tx9GdLX+FUeoFXqO3EHbU2X3oqhC6IksDUujBkO?= =?utf-8?q?v0sL3vQ4I0oySdMP3cnpD79DTtwvA+DHjabkYnDl1lOOnOSPGPuBZkfOXsnhEh34+?= =?utf-8?q?BJaD271/lobG?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5df18db3-1330-41cd-75a3-08dab65a831e X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:28:29.0563 (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: OvwfSs7GFt4RMVMgRrW+pfxb+X75op7sbED5JADmUeEypcmzANsijt5uqt3SeMzBHtN2rqwDjceBX4xn1ecDCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7933 X-Spam-Status: No, score=-3029.6 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?1747643807556222818?= X-GMAIL-MSGID: =?utf-8?q?1747643807556222818?= While I question the original need for IsString on the PadLock insns, the need for them on the operand-less string insns has gone away with the removal of maybe_adjust_templates() and associated logic. Since i386_index_check() needs adjustment then anyway, take the opportunity and also simplify it, possible again as a result of said removal (plus the opcode template adjustments done here). --- v4: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11262,12 +11262,9 @@ i386_index_check (const char *operand_st { const char *kind = "base/index"; enum flag_code addr_mode = i386_addressing_mode (); - const insn_template *t = current_templates->start; + const insn_template *t = current_templates->end - 1; - if (t->opcode_modifier.isstring - && !t->cpu_flags.bitfield.cpupadlock - && (current_templates->end[-1].opcode_modifier.isstring - || i.mem_operands)) + if (t->opcode_modifier.isstring) { /* Memory operands of string insns are special in that they only allow a single register (rDI, rSI, or rBX) as their memory address. */ @@ -11284,14 +11281,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, @@ -11334,6 +11329,8 @@ i386_index_check (const char *operand_st } else { + t = current_templates->start; + if (addr_mode != CODE_16BIT) { /* 32-bit/64-bit checks. */ --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -483,37 +483,37 @@ loopne, 0xe0, None, Cpu64, JumpByte|No_b set, 0xf9, 0, Cpu386, Modrm|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex } // String manipulation. -cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} cmps, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} scmp, 0xa6, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} ins, 0x6c, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { InOutPortReg, Byte|Word|Dword|Unspecified|BaseIndex } -outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} outs, 0x6e, None, Cpu186, W|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Unspecified|BaseIndex, InOutPortReg } -lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } lods, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } slod, 0xac, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} movs, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} smov, 0xa4, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } scas, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssca, 0xae, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } -stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } stos, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Acc|Byte|Word|Dword|Qword, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsString|RepPrefixOk, {} +ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|RepPrefixOk, {} ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp0|RepPrefixOk, { Byte|Word|Dword|Qword|Unspecified|BaseIndex } ssto, 0xaa, None, 0, W|No_sSuf|No_ldSuf|IsStringEsOp1|RepPrefixOk, { Acc|Byte|Word|Dword|Qword, Byte|Word|Dword|Qword|Unspecified|BaseIndex } -xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString, {} +xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, {} xlat, 0xd7, None, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString, { Byte|Unspecified|BaseIndex } // Bit manipulation. @@ -1966,24 +1966,24 @@ lzcnt, 0xf30fbd, None, CpuLZCNT, Modrm|C popcnt, 0xf30fb8, None, CpuPOPCNT, Modrm|CheckRegSize|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } // VIA PadLock extensions. -xstore-rng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-cbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-cfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcrypt-ofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -montmul, 0xf30fa6c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xsha1, 0xf30fa6c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xsha256, 0xf30fa6d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstore-rng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-cbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-cfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcrypt-ofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +montmul, 0xf30fa6c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xsha1, 0xf30fa6c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xsha256, 0xf30fa6d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Aliases without hyphens. -xstorerng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptcbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptcfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} -xcryptofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstorerng, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptecb, 0xf30fa7c8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptcbc, 0xf30fa7d0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptctr, 0xf30fa7d8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptcfb, 0xf30fa7e0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} +xcryptofb, 0xf30fa7e8, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Alias for xstore-rng. -xstore, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsString|RepPrefixOk, {} +xstore, 0xfa7c0, None, CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, {} // Multy-precision Add Carry, rdseed instructions. adcx, 0x660f38f6, None, CpuADX, Modrm|CheckRegSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_ldSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } From patchwork Tue Oct 25 07:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp858929wru; Tue, 25 Oct 2022 00:30:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70pFmW58cfm1Rqer/D/gj9QkwwCcb6lm0PM2Xie+deq18Ks9O+KKT6onPDUuYi4odDohtj X-Received: by 2002:a05:6402:c7:b0:457:cd5d:d777 with SMTP id i7-20020a05640200c700b00457cd5dd777mr33632401edu.245.1666683055321; Tue, 25 Oct 2022 00:30:55 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h17-20020a05640250d100b0045cd10a4c20si2368631edb.321.2022.10.25.00.30.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VWllQFtf; 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 2F6CD3856241 for ; Tue, 25 Oct 2022 07:30:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F6CD3856241 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666683035; bh=yVUs5FV0FKX+WcqIQtTMF1wsiYb/n2p55EkoRpGw2iA=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=VWllQFtfFDx//MVSf5ujs3OhOMUYfamiGrcOhiXuOKwStEq21UP4qD81TEUhiAFGA 0cnMQ8eW3wC6XveaXkQZyyHg3flmHV0DjWTRPNnB7hLx25gBxsrsF1YR7OTh6jKsyK Wl5oJqErDDMq2+4FZtSHVD+Dnr7ctKMotF4KzY0k= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80057.outbound.protection.outlook.com [40.107.8.57]) by sourceware.org (Postfix) with ESMTPS id 10AC03858017 for ; Tue, 25 Oct 2022 07:29:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10AC03858017 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JajFqinp7cFoCo3QjcLP/HsDBJz2sezxQeiTsjr6V2hPnJeaPtODivnkeSz6FFsYtkrBEkiY4IRCjfGh5k7Vquq9aEtV3uCw8cHfBKT7aOPa6YPgu2y35xMQImzj1ULfSC5CNyXJ7/e+VHJy6GtIJGRBl5jnQBogJcYy08YXKsnjDeope+YkV9ybssLdXx/Uxs3LXObOvMQRnaijrGpFzvne4gXpDBh/I/fHQNhzaInBAWbl6gNnxBKL3DmGgfsPk6G+K7ZJSj8BVjgl1wU1JrZ3OuNblZRsKKzQ71YyfpWGD6TKA3Wx/PctvRXvukgSsT0SLb6Nq3row3Sl5YUBcg== 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=yVUs5FV0FKX+WcqIQtTMF1wsiYb/n2p55EkoRpGw2iA=; b=la+tVca1olQHB9w5UdLrTNaWYDwGELJos+1JHr1wbsKJRd6sq/4fVzGLKsbGvJO0ZHjECiZHi0EadVZr3UF5OjbwuT5z7Elsx60HJ1h0FhaMn0ZeV50JV9GmCNRTqPWgO86LaBLMG0Ae+YsZXOMlx5XRooczz8wPeGLeDKx/ENlipcv09sYS1rr2c8uk2p384os0KSihdMjClGmo3VIESboVs6Rg/Rw6m3wThx479la5I4KIsIN/oZ5l/0cNf21jUHk/OU5XTSfhec2hXxRJJPpihgOlEHODD4ZwZni9CB/Ohg0oAMVCbv+DpMzrkD1dxTwfVqv7RDZyX6ip67Adnw== 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 DBBPR04MB7946.eurprd04.prod.outlook.com (2603:10a6:10:1ec::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 07:29:20 +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.5746.021; Tue, 25 Oct 2022 07:29:19 +0000 Message-ID: <06ff83d4-4633-a07b-70e5-a8e049981dd4@suse.com> Date: Tue, 25 Oct 2022 09:29:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: [PATCH v5 8/8] x86: further re-work insn/suffix recognition to also cover MOVSX Content-Language: en-US To: Binutils References: In-Reply-To: X-ClientProxiedBy: FR0P281CA0081.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::7) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DBBPR04MB7946:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d338f27-4fd7-4b70-0df4-08dab65aa11b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KAZ2iXDTqFgclBsNnBs5o3DmgDuHEmR0BI/kyLpW7WPfTvIr81Q3z10jT1pvAYUOQTUx9k2qkgjgDikaENSz1AsQK2IUB4TslmC6NEujPAShi8dYBtZGQqMaGKRBRV/QqSmXmNe8321kWHgz4K7qv6I46F4T+hWrRAbRl/PZ963qTEyYoYxszhP8PR0bRDL6kQCZLszgmEalavdKRkJDV14Lr/Xh1roBM3D1EEGROWyo9vhyaFhCiFrt36q0utmFNhI+Wg+KG/2vWTmrg74F0weDuTfA8JjWQtAhwn4pWZgFii1+R/0yxF2MIqQsy5pCB4jMnmFXi5ulNXtPUuew388xeutjHnq+FWCS0psya2xaT4MvZOnj1pFBjLQb3XoLUNzBRvz6lByXTx7x6nvbjqOCXJbO4OD+L2O+wU4Try/TMQ0UIxMMuN2FGaBvVY0t3wA+lWNvQuv1qY6owf5dKrBwxzqB6mVqawQQVznDrdOeETJWqeC9g5CRxuw2do8EtA2iIVHu6yqDkFC6GAJFel2nIWwa69v9edjAM8hKQRWRidNqL6vsemXP0Kld4RcRStrvXV+KIknyJtXiLFOl3zq9dwzSCmNEyJzyPOIHwSuIjzDzvCzreWOKNGZTPpie5Y1dgroRskK4WmvL2jBwK/JLnMm1G3gCuRvepIMgsLgtnZ954rGvLw/uC9NZmTw93XH798qymKqIaRwo5PGcTH9RGT96/7XVLlxAv1cYOu3WldTzedjjd6G98WV/+D4GwBaAAyaGbZR8x2cbeLaenq2B7htsJvK39SKG8e/zGXE= 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)(376002)(136003)(366004)(396003)(346002)(451199015)(8936002)(186003)(30864003)(5660300002)(2906002)(6512007)(26005)(2616005)(41300700001)(86362001)(38100700002)(31696002)(36756003)(66946007)(316002)(6916009)(6506007)(6486002)(478600001)(66899015)(31686004)(8676002)(66476007)(66556008)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZIhqkh/flKIlm81jhqFNffPsGmU7?= =?utf-8?q?mmwCIecAfiHbrhm8qW+8gnTleHCLVHHLYWZR2sAX/WOjuXgoqo5x+SgRCZa4uzaKL?= =?utf-8?q?SCIFiTGB3x5yCh1cVsDS47fB5/PviSKM7oSwnygxD8FkE5uybDBDHtrKXqXqP7HCO?= =?utf-8?q?A9wV9CT9lrnKDjJB/iwrjXc2X7GEDdvikn41bJdmPHg2QmXAUQZEsfXw9Yu5dcL9/?= =?utf-8?q?/ANCkRYeFav6JHFlPxnrthdSfqZYa7gI7p00wE95VtEI5ckaDtAmL6olAt+iPmP2g?= =?utf-8?q?1MRMMqr/wsZx7hArtoslLH5mPCk3DX48/fz3zb9laD3mNl6hKKCMngpvz9zfLGfPj?= =?utf-8?q?cnQaxf5i9mEiNpvbyRXtH71TUGA7K6BeoidkcgCugU4u3qMHRMtcy6SEhqor95+81?= =?utf-8?q?Bh+STJI4kQU8koCtUAHG2ULfgTd4Yq+T2rhyJhX+ZPzKFykNkuWnKL5xOZ9M8eWS2?= =?utf-8?q?PIVdGdmSVvjCgB4rwR/dgqmLB+scFl3Mcg8yBL8mFoejHR73wGCaVp+DZ5WRTPH2K?= =?utf-8?q?S/X0JCJONADWgmJy6GMWE2WFazEQ3nNdMX3q4OeuGPhaycqj8Kw6q1vzdBQbdVUfy?= =?utf-8?q?a67AywEU7TA6VbesGOuY28oXkCbxl0+p3NB3Zw3FtczDExBsYk+aUUcXqsaFm9/ec?= =?utf-8?q?FxVFjYUapfT41FxU5MnWUa+7x9LuKr15C9zX9Yp8eYX0Ma/q5vUoF8VmpkinZ0rPT?= =?utf-8?q?fwypWsrSf/JnZQE/lu3Rq3RcYupUdThtdlUCFkccbuC0LG7SgcxxkmrItU5cUy4tN?= =?utf-8?q?8rXtp0ACdwgskd7ZYjBvNNf64+kSU+WeYn3Gzse9OVOqtMUlSCSDc5KHQEjp6b1GB?= =?utf-8?q?0ctdT7FQ/3QNklYrfOrZx/RZ1dqG7yaEFn9sdHEmLBMTGz2BHMcowIwECQQcD9SAK?= =?utf-8?q?cGqfB/xuclk1JejR3WleBXE2w4XwnTcIzAzbmcV8/aPAb7YMiJekhKkktryPTrI9r?= =?utf-8?q?/ve8NrF+Rgb5VApibA9bUpZgmjTxlS0iPskin8vjww8SHzuRfzymNENb+xwbSQACR?= =?utf-8?q?LHaYGhyrs/nNInd4KFh2xWwH/MIikNlXdkXFplJdIhTvsJ9Yub9gcV7OsK92BqoLo?= =?utf-8?q?3XKN3YJnxTg5JVojiEx7MRDIZwhLJrpJDtrg4Suc69Vg24xY/C1XUT+sBWFTIvavT?= =?utf-8?q?VLT1PDwKYwBfyHFM5dCuusKQkIPQ5NacZPzjNvJ54Fap2sJbxEx4u6II7Fw/JC1SQ?= =?utf-8?q?PuJhp/2PB5DJi3s0GqlUaZH9j52nA7enA3vuo5X2s0sO/dObbbeiuBH8LECTR99Tq?= =?utf-8?q?pOA03WGHUHaqPzOxNdqqJeNjFjE9CZIx7x4yK05h536EarsmbT6c/jae/w1mhlGZo?= =?utf-8?q?bcv67KaBj7wlNIZ9udIelCd9dCQJ4dK+K6ajq54LetrV4sz5D0O+rCc4Xma/48Bre?= =?utf-8?q?n3c6A/AsfELy8oITMU+/+O7BdHqp/yc2vYbFoNTDqoT6sGZl/fveB1/BlbQ2BNRaB?= =?utf-8?q?S3BBDZkNTfHbeJZAe74DseBbcXFJQcv1qBGbrt1BiSNENSsNnugjX2EGVSiUs0kV4?= =?utf-8?q?e5haZeEiRUSu?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d338f27-4fd7-4b70-0df4-08dab65aa11b X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:29:19.4281 (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: ZdoDwbSvvBYt668pF4CQQWhzU+IdJ/i9J9AQEaKwveqkXIS5pJSBaX1CsU70kn3DlDTbHbqghgPLSuil34W6Ag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7946 X-Spam-Status: No, score=-3029.6 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?1747643851370486125?= X-GMAIL-MSGID: =?utf-8?q?1747643851370486125?= PR gas/29524 Having templates with a suffix explicitly present has always been quirky. After prior adjustment all that's left to also eliminate the anomaly from move-with-sign-extend is to consolidate the insn templates (and extend testsuite coverage). --- v5: Split off from earlier patch, merged with prior patch dealing with just x86-64's MOVSL. --- 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" @@ -804,6 +805,7 @@ if [gas_64_check] then { run_dump_test "x86-64-segovr" run_list_test "x86-64-inval-seg" "-al" run_dump_test "x86-64-branch" + run_dump_test "movs64" run_dump_test "movz64" run_dump_test "x86-64-relax-1" run_dump_test "svme64" --- /dev/null +++ b/gas/testsuite/gas/i386/movs.s @@ -0,0 +1,39 @@ + .text +movs: + movsb %al,%ax + movsb (%eax),%ax + movsb %al,%eax + movsb (%eax),%eax +.ifdef x86_64 + movsb %al,%rax + movsb (%rax),%rax +.endif + + movsbw %al,%ax + movsbw (%eax),%ax + movsbl %al,%eax + movsbl (%eax),%eax +.ifdef x86_64 + movsbq %al,%rax + movsbq (%rax),%rax +.endif + + movsw %ax,%eax + movsw (%eax),%eax +.ifdef x86_64 + movsw %ax,%rax + movsw (%rax),%rax +.endif + + movswl %ax,%eax + movswl (%eax),%eax +.ifdef x86_64 + movswq %ax,%rax + movswq (%rax),%rax + + movsl %eax,%rax + movsl (%rax),%rax + + movslq %eax,%rax + movslq (%rax),%rax +.endif --- /dev/null +++ b/gas/testsuite/gas/i386/movs32.d @@ -0,0 +1,22 @@ +#objdump: -dw +#source: movs.s +#name: x86 mov with sign-extend (32-bit object) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 0f bf 00 * movswl \(%eax\),%eax +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/movs64.d @@ -0,0 +1,30 @@ +#objdump: -dw +#source: movs.s +#name: x86 mov with sign-extend (64-bit object) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 67 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 67 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f be c0 * movsbq %al,%rax +[ ]*[a-f0-9]+: 48 0f be 00 * movsbq \(%rax\),%rax +[ ]*[a-f0-9]+: 66 0f be c0 * movsbw %al,%ax +[ ]*[a-f0-9]+: 67 66 0f be 00 * movsbw \(%eax\),%ax +[ ]*[a-f0-9]+: 0f be c0 * movsbl %al,%eax +[ ]*[a-f0-9]+: 67 0f be 00 * movsbl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f be c0 * movsbq %al,%rax +[ ]*[a-f0-9]+: 48 0f be 00 * movsbq \(%rax\),%rax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 67 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f bf c0 * movswq %ax,%rax +[ ]*[a-f0-9]+: 48 0f bf 00 * movswq \(%rax\),%rax +[ ]*[a-f0-9]+: 0f bf c0 * movswl %ax,%eax +[ ]*[a-f0-9]+: 67 0f bf 00 * movswl \(%eax\),%eax +[ ]*[a-f0-9]+: 48 0f bf c0 * movswq %ax,%rax +[ ]*[a-f0-9]+: 48 0f bf 00 * movswq \(%rax\),%rax +#pass --- a/gas/testsuite/gas/i386/movx16.l +++ b/gas/testsuite/gas/i386/movx16.l @@ -41,11 +41,11 @@ [ ]*[1-9][0-9]*[ ]+movsb %ax, %cl [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]* @@ -82,7 +82,7 @@ [ ]*[1-9][0-9]*[ ]+movsw %eax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 660FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movswl %al, %cl --- a/gas/testsuite/gas/i386/movx32.l +++ b/gas/testsuite/gas/i386/movx32.l @@ -41,11 +41,11 @@ [ ]*[1-9][0-9]*[ ]+movsb %ax, %cl [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]* @@ -82,7 +82,7 @@ [ ]*[1-9][0-9]*[ ]+movsw %eax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movswl %al, %cl --- a/gas/testsuite/gas/i386/movx64.l +++ b/gas/testsuite/gas/i386/movx64.l @@ -106,17 +106,17 @@ [ ]*[1-9][0-9]*[ ]+movsb %eax, %cl [ ]*[1-9][0-9]*[ ]+movsb %rax, %cl [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %cx +[ ]*[1-9][0-9]* \?\?\?\? 660FBEC8[ ]+movsb %al, %cx [ ]*[1-9][0-9]*[ ]+movsb %ax, %cx [ ]*[1-9][0-9]*[ ]+movsb %eax, %cx [ ]*[1-9][0-9]*[ ]+movsb %rax, %cx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBEC8[ ]+movsb %al, %ecx [ ]*[1-9][0-9]*[ ]+movsb %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %eax, %ecx [ ]*[1-9][0-9]*[ ]+movsb %rax, %ecx [ ]*[1-9][0-9]*[ ]* -[ ]*[1-9][0-9]*[ ]+movsb %al, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 480FBEC8[ ]+movsb %al, %rcx [ ]*[1-9][0-9]*[ ]+movsb %ax, %rcx [ ]*[1-9][0-9]*[ ]+movsb %eax, %rcx [ ]*[1-9][0-9]*[ ]+movsb %rax, %rcx @@ -192,12 +192,12 @@ [ ]*[1-9][0-9]*[ ]+movsw %rax, %cx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %ecx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %ecx +[ ]*[1-9][0-9]* \?\?\?\? 0FBFC8[ ]+movsw %ax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %eax, %ecx [ ]*[1-9][0-9]*[ ]+movsw %rax, %ecx [ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movsw %al, %rcx -[ ]*[1-9][0-9]*[ ]+movsw %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 480FBFC8[ ]+movsw %ax, %rcx [ ]*[1-9][0-9]*[ ]+movsw %eax, %rcx [ ]*[1-9][0-9]*[ ]+movsw %rax, %rcx [ ]*[1-9][0-9]*[ ]* @@ -241,6 +241,46 @@ [ ]*[1-9][0-9]*[ ]+movswq %eax, %rcx [ ]*[1-9][0-9]*[ ]+movswq %rax, %rcx [ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %cl +[ ]*[1-9][0-9]*[ ]+movsl %ax, %cl +[ ]*[1-9][0-9]*[ ]+movsl %eax, %cl +[ ]*[1-9][0-9]*[ ]+movsl %rax, %cl +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %cx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %cx +[ ]*[1-9][0-9]*[ ]+movsl %eax, %cx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %cx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %eax, %ecx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %ecx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movsl %al, %rcx +[ ]*[1-9][0-9]*[ ]+movsl %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 4863C8[ ]+movsl %eax, %rcx +[ ]*[1-9][0-9]*[ ]+movsl %rax, %rcx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %cl +[ ]*[1-9][0-9]*[ ]+movslq %ax, %cl +[ ]*[1-9][0-9]*[ ]+movslq %eax, %cl +[ ]*[1-9][0-9]*[ ]+movslq %rax, %cl +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %cx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %cx +[ ]*[1-9][0-9]*[ ]+movslq %eax, %cx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %cx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %eax, %ecx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %ecx +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+movslq %al, %rcx +[ ]*[1-9][0-9]*[ ]+movslq %ax, %rcx +[ ]*[1-9][0-9]* \?\?\?\? 4863C8[ ]+movslq %eax, %rcx +[ ]*[1-9][0-9]*[ ]+movslq %rax, %rcx +[ ]*[1-9][0-9]*[ ]* [ ]*[1-9][0-9]*[ ]+movzx: [ ]*[1-9][0-9]*[ ]+movzx %al, %cl [ ]*[1-9][0-9]*[ ]+movzx %ax, %cl --- a/gas/testsuite/gas/i386/movx64.s +++ b/gas/testsuite/gas/i386/movx64.s @@ -241,6 +241,46 @@ movsx: movswq %eax, %rcx movswq %rax, %rcx + movsl %al, %cl + movsl %ax, %cl + movsl %eax, %cl + movsl %rax, %cl + + movsl %al, %cx + movsl %ax, %cx + movsl %eax, %cx + movsl %rax, %cx + + movsl %al, %ecx + movsl %ax, %ecx + movsl %eax, %ecx + movsl %rax, %ecx + + movsl %al, %rcx + movsl %ax, %rcx + movsl %eax, %rcx + movsl %rax, %rcx + + movslq %al, %cl + movslq %ax, %cl + movslq %eax, %cl + movslq %rax, %cl + + movslq %al, %cx + movslq %ax, %cx + movslq %eax, %cx + movslq %rax, %cx + + movslq %al, %ecx + movslq %ax, %ecx + movslq %eax, %ecx + movslq %rax, %ecx + + movslq %al, %rcx + movslq %ax, %rcx + movslq %eax, %rcx + movslq %rax, %rcx + movzx: movzx %al, %cl movzx %ax, %cl --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -162,14 +162,9 @@ mov, 0xf24, None, Cpu386|CpuNo64, D|RegM movbe, 0x0f38f0, None, CpuMovbe, D|Modrm|No_bSuf|No_sSuf|No_ldSuf, { Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } // Move with sign extend. -// "movsbl" & "movsbw" must not be unified into "movsb" to avoid -// conflict with the "movs" string move instruction. -movsbl, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg32 } -movsbw, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg16 } -movswl, 0xfbf, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Word|Unspecified|BaseIndex, Reg32 } -movsbq, 0xfbe, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg8|Byte|Unspecified|BaseIndex, Reg64 } -movswq, 0xfbf, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg16|Word|Unspecified|BaseIndex, Reg64 } -movslq, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Size64, { Reg32|Dword|Unspecified|BaseIndex, Reg64 } +movsb, 0xfbe, None, Cpu386, Modrm|No_bSuf|No_sSuf|No_ldSuf|Pass2, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +movsw, 0xfbf, None, Cpu386, Modrm|No_bSuf|No_wSuf|No_sSuf|No_ldSuf|Pass2, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 } +movsl, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|Pass2, { Reg32|Unspecified|BaseIndex, Reg64 } movsx, 0xfbe, None, Cpu386, W|Modrm|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } movsx, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 } movsxd, 0x63, None, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32|Unspecified|BaseIndex, Reg32|Reg64 }