Message ID | b3625235-faf6-00ad-69c2-82583531fe43@suse.com |
---|---|
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp787344wrd; Fri, 10 Mar 2023 02:17:51 -0800 (PST) X-Google-Smtp-Source: AK7set8C/NexCjH8mWbt/91thLkXkU02sXx8/fuVYugXqPMnmT5kJihvL3Lye7AeKsBGiblquTjC X-Received: by 2002:a17:906:3197:b0:8b1:3293:ead2 with SMTP id 23-20020a170906319700b008b13293ead2mr26449164ejy.25.1678443471153; Fri, 10 Mar 2023 02:17:51 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y5-20020a1709064b0500b008f1ce937174si1642458eju.886.2023.03.10.02.17.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 02:17:51 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=MRbpN+CG; 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 364BA3858298 for <ouuuleilei@gmail.com>; Fri, 10 Mar 2023 10:17:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 364BA3858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678443470; bh=78imU/1tMzEjQpFbm9hwyIBC4hr4a0BKeAd3NVtRL30=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=MRbpN+CGGtYcAqD6GqR4jOVNkMiQCx9zDlCVs0JElJnMShZWTFghk3wcmOhvEwGAG EoGRGWl6zBbdtmkfKZf8Rm1PVW1LbsRqLiczNamUcIBW1PfVJC8VqliEI2yZTujQ+S R/+Ga60+TDuJWWgY0pUgv6B8MhCPTACQ/SA4vmKQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by sourceware.org (Postfix) with ESMTPS id 354D83858C54 for <binutils@sourceware.org>; Fri, 10 Mar 2023 10:17:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 354D83858C54 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i76oYZxKui0qRoHFcIG/c4L6SzdEwkimL7UD7MJPHxJlv1JkKljP52RKA6PdNtp/aRVF41peR721jENn6SJaNNlcz7N/IlNsEC6go3pK8/5OYdv+CaEHTr+2pOqL4rLY0VvMf6VYHVrtDw+pOFOTVbkn1reFiMCxM4YoV7d8M6/8yYq44TMKPFsep1FpR5wFR4tJ/SukTKNgYJPA8FyP+X7syYNnknYG243bEsfeXuwlEIi+/Mfr5ECZ2R6nMIW+1bWeVj5DzWCb9LJW6oSjAiQsDYkaigJWP8qh+RHSsa6iMV+MzEq2ZEiIwHn/vkHONw0xlfeyvt7e5yWLZP7wzQ== 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=78imU/1tMzEjQpFbm9hwyIBC4hr4a0BKeAd3NVtRL30=; b=DwKj+y5qKvy2S2spiMFdC5zf3kVGWtdVYZzobegTo4lG425rykq23yEZg4LRSzrr7Zunbt/i9L9dP7KlnYvoZ+KLDXb5b+bY/4BZOIIsMOgg7ciHCjfcUQT2jywMH8hsvCaoQ550845YBhIyP5v/wN1Zk4aOsnkPaJPFkO7JSTtl0YITcwE+iDlsnBUekIrw8ck7h92zulvYqwIF6sF/QROlCS/v8IB/qjyNVGmvuHW3DXpQxBBWNfaMbFxVjRA5kW1A9sxzeZghyDzhcjhPXLLVidkd2yZBnQ6ztQD009MFZgczBbB3iyafeGBgSQxPNNsA2hqPK3IJbFuvij+aFQ== 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 VI1PR04MB7005.eurprd04.prod.outlook.com (2603:10a6:803:136::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.17; Fri, 10 Mar 2023 10:17:38 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%5]) with mapi id 15.20.6178.019; Fri, 10 Mar 2023 10:17:38 +0000 Message-ID: <b3625235-faf6-00ad-69c2-82583531fe43@suse.com> Date: Fri, 10 Mar 2023 11:17:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH v2 00/14] x86: new .insn directive To: Binutils <binutils@sourceware.org> Cc: "H.J. Lu" <hjl.tools@gmail.com>, "Jiang, Haochen" <haochen.jiang@intel.com> Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0153.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::11) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|VI1PR04MB7005:EE_ X-MS-Office365-Filtering-Correlation-Id: dd9043bf-e1a4-4a0b-e498-08db2150acf2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IBbzOzAZweCWcw6mYnt0KlaUlviyjGv9kbvm6tZvRZELR01aRqT49u8TR53rLfFTs9GfuYeHZ8VDdqzJ10IJKwswlL345ev2J0Q0cL3/DZuPe1hpAhqYEtVtZyH7GLt4FEpjeZa6m101RLDfF6S/Iy03Nl+MssuLtBFbuVLyDKCJyRIY1r1yMQMOgfEv+qz9HMlGplBaQ98yl5v6CQ9Oh6BysL38oGDxZmE9bLJ6OTBsP2QpiOvo668hTnjAH3WAYQEbXWzYfGulbUUvcS78N+tZRiL1GwDOW2e/IsHhqdTjHfkBHiIZnulJZOLz7qMq+uWbf2ARFqeQu3Wkn5K0neD9TrQnrOlKqyXfPmDfF910UQbowCWs3sZ0RmuG0XpTNezDr9E6UYANuI8CCdtkNXqM3d1ReJDct4rlaPPtS4z3edaUrpb4L90iqVKPj0Ie4ByLRPmCmmX8SEca3VXoVz9vLKf5jrP+gRyRZ/BpIdRWfM5GOD1D2ncGC6jjw5OAKDCWQ9hKn710gSv8GqkRl689+sHFChrJHF/+4i1CKgq+dZQRFNLcYeDYkya6kEY75eFzn+kKUZrLnBWUGLk1iPBK5P8cEB2mPMNxI6sZc6WJ5nSCcqcmT9vTWjfo2jk2rcdUHkPfZ4JHuaOQbdMd3M1AtBHlLQD2DLwyVtIT6seLp9TP9qZmaZPbK7n1PYMXYtLBvQjiEXwjX7ve22tAqoAEB5bgMzEkCDm5Cdo9jgXjks/orv9Yh7kAjWzk2MEhI4D3Lkj0yp5LbTIeVTATtQ== 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:(13230025)(39850400004)(346002)(376002)(366004)(396003)(136003)(451199018)(26005)(186003)(2906002)(2616005)(38100700002)(6512007)(6506007)(31686004)(5660300002)(31696002)(6486002)(8936002)(41300700001)(316002)(66556008)(4326008)(86362001)(66476007)(8676002)(66946007)(83380400001)(6916009)(36756003)(54906003)(478600001)(142923001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ushLznk6XJrEWRCHEFPBq847j2wm?= =?utf-8?q?yBFnwJw/V5Or1I6T1jmkGl8rxeIMKZgC3JWlON9r1Ov533TBRRtShyIy1Wupe0iZt?= =?utf-8?q?QewCrgXgYTCBsjn9HRahI7rvok4MJY4zeKIFE18qCJ0HHMcPlZ6vEI2pMVAwBlHun?= =?utf-8?q?PWLhl0IUiIacAzfbDzmG9zFPpRdSp9/OhaN/0Ecod9Am2dcbUIsRXazNUIXmfkgID?= =?utf-8?q?pXeA9tAOer93VBneFnHX6/La/dpzsXmIcAk4/qNJimUXCVu+/WI3aW2WGtXgmA4DZ?= =?utf-8?q?2s3JPmZTQjTDs0q13pxQP2IxzuHybDJe8JSOijIzNmFlr2YWF/yNjKPqOuSZtwVo7?= =?utf-8?q?rpNrXV/BPwgb5XN9HWAMEJCGftGDaw24Yb4nfZyam54DKLyC4Jx6TkOhP4QIDgj2O?= =?utf-8?q?U0zCSUAON9eGCn2jpf0shOd3eUUrl92y21c99WJbvEkN+qMiSfB8sD6Pw34zFdDkV?= =?utf-8?q?BXt2O6TkC1D3dzNAVli3tLcXi7Kao/6yiZRcUwdtSthBci4xkelTU1z/5B/z7JInP?= =?utf-8?q?qDBmqMVFH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Hfk+8rpatkFb+lCDNg3XbC54iEJ3Nm0LCof5/QCx+XMf6RIvKuhVaf5T?= =?utf-8?q?M97N15hfkbNALUJFUaBYDYqap3vPEci8xOZU41kKzZ1f09t6zy+D2JY01gscBiZGH?= =?utf-8?q?lvzx2tjgE9Ym?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd9043bf-e1a4-4a0b-e498-08db2150acf2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 10:17:38.7162 (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: pncBf+c9FFysVsgj3bufBzBcwQr6mLR8kJ1go/X9jBhmf3VWswQSXlhCdWNnDt9Hmvc2HYuFMAnoEv820xsRcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7005 X-Spam-Status: No, score=-3028.2 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 <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Jan Beulich via Binutils <binutils@sourceware.org> Reply-To: Jan Beulich <jbeulich@suse.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759975541394291456?= X-GMAIL-MSGID: =?utf-8?q?1759975541394291456?= |
Series |
x86: new .insn directive
|
|
Message
Jan Beulich
March 10, 2023, 10:17 a.m. UTC
Especially when instructions which are not known to gas yet also take register or, yet worse, memory operands, encoding such in code actually wanting to make use of them is often difficult. Typically people resort to hard-coding the involved registers, thus being able to express things via .byte. To overcome this limitation (to a sufficient degree at least), introduce .insn. This allows users to specify operands in their "normal" shape (possibly in slightly altered order). Peculiarities require two small syntax extensions; see the implementation or documentation for details. In order to re-use sufficiently much of the functionality md_assemble() already uses, some adjustments to existing code were necessary. The one item to call out here is the partial re-write of build_modrm_byte() (patch 7), which actually turned out to simplify things. Subsequently possible further tidying is carried out right away (patches 8 and 9), even if not strictly related to the .insn work. I'm pretty sure there are still corner cases which aren't taken care of correctly. It's also quite possible that I've overlooked further places in pre-existing code which need tweaking for .insn. People taking a close look and/or playing with the new functionality would be much appreciated. The last patch in the series continues to be RFC, as I'm uncertain whether we actually want this kind of a testcase. Main changes in v2 are testsuite adjustments for certain non-Linux targets, resulting from me not properly having re-run wider tests with the last few patches in the series in place. 01: introduce .insn directive 02: parse VEX and alike specifiers for .insn 03: parse special opcode modifiers for .insn 04: re-work build_modrm_byte()'s register assignment 05: VexVVVV is now merely a boolean 06: drop "shimm" special case template expansions 07: AT&T: restrict recognition of the "absolute branch" prefix character 08: process instruction operands for .insn 09: handle EVEX Disp8 for .insn 10: allow for multiple immediates in output_disp() 11: handle immediate operands for .insn 12: document .insn 13: convert testcases to use .insn 14: .insn example - VEX-encoded instructions of original Xeon Phi Jan
Comments
On 10.03.2023 11:17, Jan Beulich via Binutils wrote: > Especially when instructions which are not known to gas yet also take > register or, yet worse, memory operands, encoding such in code actually > wanting to make use of them is often difficult. Typically people resort > to hard-coding the involved registers, thus being able to express > things via .byte. To overcome this limitation (to a sufficient degree > at least), introduce .insn. This allows users to specify operands in > their "normal" shape (possibly in slightly altered order). Peculiarities > require two small syntax extensions; see the implementation or > documentation for details. > > In order to re-use sufficiently much of the functionality md_assemble() > already uses, some adjustments to existing code were necessary. The one > item to call out here is the partial re-write of build_modrm_byte() > (patch 7), which actually turned out to simplify things. Subsequently > possible further tidying is carried out right away (patches 8 and 9), > even if not strictly related to the .insn work. > > I'm pretty sure there are still corner cases which aren't taken care of > correctly. It's also quite possible that I've overlooked further places > in pre-existing code which need tweaking for .insn. People taking a > close look and/or playing with the new functionality would be much > appreciated. > > The last patch in the series continues to be RFC, as I'm uncertain > whether we actually want this kind of a testcase. > > Main changes in v2 are testsuite adjustments for certain non-Linux > targets, resulting from me not properly having re-run wider tests with > the last few patches in the series in place. > > 01: introduce .insn directive > 02: parse VEX and alike specifiers for .insn > 03: parse special opcode modifiers for .insn > 04: re-work build_modrm_byte()'s register assignment > 05: VexVVVV is now merely a boolean > 06: drop "shimm" special case template expansions > 07: AT&T: restrict recognition of the "absolute branch" prefix character > 08: process instruction operands for .insn > 09: handle EVEX Disp8 for .insn > 10: allow for multiple immediates in output_disp() > 11: handle immediate operands for .insn > 12: document .insn > 13: convert testcases to use .insn > 14: .insn example - VEX-encoded instructions of original Xeon Phi Unless I hear back otherwise with some good reasons not to, I intend to commit the remaining patches (with one further !BFD64 build fix) some time next week. Would certainly be nice to have an explicit view voiced by somebody on whether to include the last patch ... Jan