Message ID | 05f45405-17c9-4e52-84e7-87c428a6ee56@suse.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1011279vqu; Fri, 3 Nov 2023 06:02:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcFllpPh2OoZm9yttAe5XvM4Myzj5jVWmNoiRT0tHnJz6txuHPJmb87vwgFAdLtY6UvS0C X-Received: by 2002:a05:6214:240d:b0:655:d9b1:7980 with SMTP id fv13-20020a056214240d00b00655d9b17980mr29774139qvb.62.1699016555108; Fri, 03 Nov 2023 06:02:35 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1699016555; cv=pass; d=google.com; s=arc-20160816; b=H2FkP4uZBOiN/X9AdLQujUXXRezk0P/AdEaRfFGzQhz3lldltI7W35oWp4TjfBCpWZ doE08qlLDKcruz3ZEASHlyqJwKqwT/F+5P0NHIVf0MslxvvLeCYXgv1x+RGEu8eOobG4 MtW7zUBfAmRCrZ8asI5h1I5LBt4L7iVlH6ou5Ezp5DKQhintD8NyhMRfGG+PfWR2hL7o tR8hHbOazbD71PwZYV1SUZzFcpwdH6h9ooiVie380yBLUH7xVVUF6OebKs26V/c0gRAB Jkht8174GvAcWMTCHbATRwYc+t5lbacZDkJ95t+QIS3Hn53rWZ8ilMGtQYOO5TYyuYzo jsTA== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:subject:from:cc:to:content-language :user-agent:date:message-id:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=7yLFvNgCtWICMUPkpYZ6dKnA5Buy2uyK3N7gtPnjNPo=; fh=Plzit+QOfT4w9lMb6sCEH7MLCHiIRZ4B4v+R+r5+YtY=; b=QV6ynlRGPRQ8S2O6m/o+eA5BTL9Yd88kXB+GY36xxdDUU1F+ZQtkgUHPtGj9fQVhSZ +UReRL0YAaRj24+IQaorPjoWzeBsvp5UMPgQyMkM0ixCNm0Sc4JUm6I9xFOxLc5w5mHa tfszK4YeocLQvgEuSt6c2er5Z6v1wiK5Tfc2opjU20s5ggux8Ba/hbe2geFG6Q500gzU 0QElFCTwZXooe0Wz/ymijvkunFwyRqcDZqRmjNslYSmx3bjK8qV5WTN16Wh22d+QNVQt /qw9i/Dsteb6Bbwue8YZlcnc1B/csb7lywKLFl42QXsfyMuFiw3WvDVhvcfNTVZjNzDc QWhw== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=szj0GXty; arc=pass (i=2); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d20-20020a056214185400b00670927d2ab2si1428204qvy.102.2023.11.03.06.02.35 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:02:35 -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=@suse.com header.s=selector1 header.b=szj0GXty; arc=pass (i=2); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D86963858D28 for <ouuuleilei@gmail.com>; Fri, 3 Nov 2023 13:02:34 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2044.outbound.protection.outlook.com [40.107.247.44]) by sourceware.org (Postfix) with ESMTPS id 5937B3858D28 for <binutils@sourceware.org>; Fri, 3 Nov 2023 13:02:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5937B3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5937B3858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.44 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699016549; cv=pass; b=T6QPe7NgweZWfvqc91vp5n7WpDc+zU24OXDY8I5xLTtI/UwK+KGDgYA4XjUXTlbqWLJIalF98LwylNCn3lvx0lSCcgrH4iYVNgj5r47AN5tdb67HmUSad2PI70rYPsjpagCYvq72c4bwd28ViX16UX2WY2DiYFFipUNFY4JUPJ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699016549; c=relaxed/simple; bh=/C2TaeV6Dxh7geNsjUUAf7d02/LiSgrZX+STyWyuLBs=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=QlV9cDP759/c23Ct2++Ms29mpuCi9Xxq8fjs9qM9ldk7sl9QcXd8UNxO2CXiFRF8B2xzp835CsKXiBaEbxkIT8YtqPQXALd/PwrPNwTiRK3ZOYbznaHAyeNp1JaMskvs7Gy8ndOuZwATru1rhoDNzn/QuU0bGgr1wbUd/uz3DA4= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMSFbTKgU4ZGdiqyxObEmpJw6+FlmD5MEzFhfjX4JKihupI2cQhHmNAg2PUz1nx/TfjOv2Yy5CFC5X7SibusNOPYX85qX8wVxWu7MbTu5IERHYLep4IuqVRl48lYNLcXEiSMNcLJH+J59isIgy+n5my+N/9xPcEZJ26z0QnNZYsZ4bwIJlNujZBlHWhPgemk9jMcR0Ti7qxU9J7XoLQtDYbNFQGxSArmLL6QSUyST4zyrJfFNMkNLtKMiaq4FmzyGIQP4ijQMWVdKZVV1zLZ4G9paOUz4MZNWM6m7PjE0/IwcYTnKK4b+4xmxYrWcRRiHjkNUvcw6Bi/T6uD2S8e5w== 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=7yLFvNgCtWICMUPkpYZ6dKnA5Buy2uyK3N7gtPnjNPo=; b=Du4kEg3K1Y6fma609RLXLJCIQ/T1+FXN+haXOl9ge0pjBHYBQk45raG3p0feRr1a6pBNYnnwsNkUsopmgpuyKXRRb1bzxPzt/pb3Jk2ZjyBNgR/2pW/GtMdXRkvaKm3DWfnM9jrDf0fqgkUfIXc4mDryh3ybEGebVaM6Bq/d7sEaPMaAyxsLvAhGjRYZhzRhi08I9ttn3ufE/IpPfbhu3w7ZuX5hZMeyKiuvigczi489N9b9Rg45EvzPkEzePkQnGAIsDCwL1qisiE56q2+1rY72WqTfkVegyBh+w1sBMOgiN9Z5/GcrgB4ML4AdSgBdbKJ92bvXYur+DyW6aNt9Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7yLFvNgCtWICMUPkpYZ6dKnA5Buy2uyK3N7gtPnjNPo=; b=szj0GXtyi6uko/ZmpHyDYpSsnPXcd1Mdha2ILltbAJksWvhDVApH6QXPqMvUOOZErC1PCH57XYcY3edmHWFoTpWlKsTXEqubFf9+beoTy6b06bDF+8qWRwCC3fKMFRUz5S8g2pp4+3xZX7j8G+hekVPwFcU74TcUWa9Z28ExhFPs09PuktImWj+FIyEELeJGdgfqkGunYhG3OEUmgKNPzi0SyvpNR5Rukec38mzozQ/xyFOT3Wu0ShcVqibm5ZL4AWvG+hrxIBECbgYaCFW+DK6xyFhpi2SWZ3lPp9miP5XtwtfgcySG5LMDy/IbccGDYkocTMoBxLFZUFvIZ2GWrg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Fri, 3 Nov 2023 13:02:16 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::d924:b650:a2ad:7b25]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::d924:b650:a2ad:7b25%3]) with mapi id 15.20.6954.019; Fri, 3 Nov 2023 13:02:16 +0000 Message-ID: <05f45405-17c9-4e52-84e7-87c428a6ee56@suse.com> Date: Fri, 3 Nov 2023 14:02:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: Binutils <binutils@sourceware.org> Cc: "H.J. Lu" <hjl.tools@gmail.com>, "Hu, Lin1" <lin1.hu@intel.com> From: Jan Beulich <jbeulich@suse.com> Subject: [PATCH] x86: rework UWRMSR operand swapping Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0149.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::16) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AM8PR04MB7779:EE_ X-MS-Office365-Filtering-Correlation-Id: 1197e4b4-369a-42c0-dd1a-08dbdc6d1af2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 82MOs0S2a7dcLyCeu7yC8hW0iQLiJDIuk8wmIZ81jcCyM+skqZ2ljwMUrh119zc7VxgCxUelmKzTZ7Z7qKzncudLj3J64OvWFCEOFlMF/lmaDp/FFrOHu0qxOg9f8q/iZ35q3X5BRQmXjfo7siUBehdOHfEskZzVZhtukmLgECkywCOgN5pTmEJvxVWr8aIb2I6Z0N7lKFSb7tUQYaSzdTVtB2bjwxYYX2fBE6uIVyv+Ty4J8hWcLbm75mlASt0x+bNxuDdTTPMjeT+aG9PzmCVCsV65wYsTtO8Ou+t7GGjMJHK8Ia4ja4jtXo5VG12aWNlQXrZLGvEPq9xBuT+3d8Pw+ZHZZTzGphQZqnZGxf1cuh73/+TgVdrttyKruDNoY5yHRH1NRSJ/a3ywAMZZjrXydwvl+RxjscmQ9rmq4N4sf6DvpJ3Pd40qeQDYTsMvXJJ6UhCeodL4+iQvVhlltU3poSCYW07VjpH0pCU2kYXfjOvwYjl4E3m5Eb/Om7zwmLwMugSjc8PPFdpjcyWUpa2r6BcldNDW1QZ761YXTdSNoYYInZv19iU2jw/YI4qxiMDLRCHYgnCyDnzC9ojw49geWaXVD2j2wiTZSngs96RJfW7iq3f7C89HexMtDNV61gq1MCdEjiAa2Lf94BXRkA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8790.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(26005)(2616005)(6512007)(478600001)(54906003)(6486002)(8676002)(6506007)(5660300002)(2906002)(41300700001)(66946007)(8936002)(66556008)(4326008)(6916009)(66476007)(316002)(31696002)(36756003)(86362001)(38100700002)(31686004)(83380400001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1G/OFeRgvR1Hyxn2X1hNexUC5O/s?= =?utf-8?q?/73r8701nQ/wtbD23GLzTOTaYVWGjYeb+DM1NfUz9VU4zUL6A6f0GJxwiUZTzCcQz?= =?utf-8?q?p3H5ru6beSNZqab3/fe31mNa7lHZn5kc+Iqn7qj+29cLEIqfowNacW2aElA0AB1xw?= =?utf-8?q?eh1z6bqv2GKCX4Fj5+003pIAqBI5zljtv8f8OabVPu7RoAEyYqJI/JZ1ZLCYarLqz?= =?utf-8?q?7n74WlWzz1I0Sx+a09rhjbmkrB7nBJT608DO3oRvKIsLbWQflO7GzuWuohDXdk0rH?= =?utf-8?q?kl3PvjH3oP86Slmfj2acpvX2VY0VBqNCgID4tYCRWLvMNISLOgSke7VpjQHP5kRmH?= =?utf-8?q?z2slnXSIecmBVCH0WwKAVwQoVghJxR2S/DSXHGjsVU8dNGtQMGQF0qhjNe5LvXn+x?= =?utf-8?q?6KDpNshUuBLJ2Waal/bJjDk4PIjzEPiEQhe+8OIZu/C/k3jlH7BxHWCFk4aEteEcw?= =?utf-8?q?UYTngPtohCAA8eWqUaAr7UM8KFeVAqcpKwu2xbS9kYo4MX4Rk7zDDAPA9/qnfDP4m?= =?utf-8?q?Avs/ntWdE9/qss9OGAtyQJ7SfFTBrn08FyQtspZCEJI3CDc8zUtNW2OFuCLHRzeLI?= =?utf-8?q?FBbp8AxaZMdIz/nnra0GHsGCJUwarUxXO/w8DZo2N0XwR1yL+oY0sLOGFy0v+MbNR?= =?utf-8?q?zdBIqIbd8/Mbx0cvg34PEbue8wiNMHNyWiHJJCq77ilyHNcMyREL8Pkxh9s++Yaed?= =?utf-8?q?gjZfBHT8upoUhDOVQjbCo9HCx99Z6EQiQQJbGFZ++0niibOVpzpbeDZ30ScnhHzLd?= =?utf-8?q?pJwtIDwT0TeUfZHOCfSpfZqDXqVKEh+mkSAifQ7iciJKRSrSrLfrdL4ASaDhVknaZ?= =?utf-8?q?tV/BOuvZYthqlLqVzxR6aqCx49S+6UPmcHKkOPicT5fLctJvLMJVLhEsERNjzyIWz?= =?utf-8?q?fFmFLkys/q3GQNG4Wf21gDxbUg0MNeua1MzQdbn3CejEIb/JrjOKt4E1kZAxQ3sGQ?= =?utf-8?q?ubz/t7+b+32D9/t96kgKMLOF+4NLEN0RpGZMeccYAvnH/vYZs6RIR5332E6/ItQBw?= =?utf-8?q?WbB16Hw5PJkjReQ/kr9xXP+ZveUcbOmzbKlQV5S+RUMnPcSJP7PiPifVrbsOeYKiO?= =?utf-8?q?DJNcsE9Jnbj6NV5O8kJ3fmvAbGQfIRmkvl+vi6wrzg/mGaC7Of07CqpmwefL2cHDP?= =?utf-8?q?806GPlqcgVapz6QHWu5/I7ezL82d+HKF2AmGnBrHr8zlhKUJ3yC8mZXn4kKOHKL1V?= =?utf-8?q?oJkku16nu754qbjfAOSyVUohxpIvkJ+i2BDyHWaf0YFOxeHjsYiG2Zy+1444bd7fP?= =?utf-8?q?HGU+7b14jdfK5+s/Yc+EXqWiBtIs2LJxF2psbq3kOl4Drww+pe4rPCYs6UDlitfy9?= =?utf-8?q?jE9AWlwLvIjOj2qBRR2ZMEnv4EDOZ0hJg1KW1/UPUWd+VhXp5yQBWyUXJfGDHntbH?= =?utf-8?q?dAfHZzpA7s6hSGmZkXv4D8Zu4WNj6kldxiRbJVSBKVUxh1VDjB2Tsl7gNnXy4FOhY?= =?utf-8?q?d3+ouffIzCOGlRNonkdrTNFBTJ9woMeDGw3aYXSqKGu5kDlkbpYDQ1IJIuf557H2m?= =?utf-8?q?MFvnaYUHewn0?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1197e4b4-369a-42c0-dd1a-08dbdc6d1af2 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:02:16.5704 (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: cd+xXNUA2AHeVzu7GpGWAxiqYA+v1ii1aR+ZAEEe8qgMe74PSnYF5X8zD7S9jBZUJa17E7PH+fv5BQ3MkOpqqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7779 X-Spam-Status: No, score=-3026.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, T_SCC_BODY_TEXT_LINE 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.30 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> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781547983627624642 X-GMAIL-MSGID: 1781547983627624642 |
Series |
x86: rework UWRMSR operand swapping
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | warning | Git am fail log |
Commit Message
Jan Beulich
Nov. 3, 2023, 1:02 p.m. UTC
As indicated during review already, doing the swapping early is overall cheaper than doing it only after operand matching.
Comments
I'm OK. So, the order of operands in .tbl isn't required to be consistent with the doc. BRs, Lin > -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: Friday, November 3, 2023 9:02 PM > To: Binutils <binutils@sourceware.org> > Cc: H.J. Lu <hjl.tools@gmail.com>; Hu, Lin1 <lin1.hu@intel.com> > Subject: [PATCH] x86: rework UWRMSR operand swapping > > As indicated during review already, doing the swapping early is overall cheaper > than doing it only after operand matching. > > --- a/gas/config/tc-i386.c > +++ b/gas/config/tc-i386.c > @@ -5201,10 +5201,14 @@ md_assemble (char *line) > && operand_type_check (i.types[1], imm))) > swap_operands (); > > - /* The order of the immediates should be reversed > - for 2 immediates extrq and insertq instructions */ > - if (i.imm_operands == 2 > - && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq)) > + /* The order of the immediates should be reversed for 2-immediates extrq > + and insertq instructions. Also UWRMSR wants its immediate to be in the > + "canonical" place (first), despite it appearing last (in AT&T syntax, or > + because of the swapping above) in the incoming set of operands. > +*/ > + if ((i.imm_operands == 2 > + && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq)) > + || (t->mnem_off == MN_uwrmsr && i.imm_operands > + && i.operands > i.imm_operands)) > swap_2_operands (0, 1); > > if (i.imm_operands) > @@ -7557,17 +7561,6 @@ match_template (char mnem_suffix) > break; > } > > - /* This pattern aims to put the unusually placed imm operand to a usual > - place. The constraints are currently only adapted to uwrmsr, and may > - need further tweaking when new similar instructions become available. */ > - if (i.imm_operands && i.imm_operands < i.operands > - && operand_type_check (operand_types[i.operands - 1], imm)) > - { > - i.tm.operand_types[0] = operand_types[i.operands - 1]; > - i.tm.operand_types[i.operands - 1] = operand_types[0]; > - swap_2_operands(0, i.operands - 1); > - } > - > return t; > } > > --- a/opcodes/i386-opc.tbl > +++ b/opcodes/i386-opc.tbl > @@ -3354,6 +3354,8 @@ eretu, 0xf30f01ca, FRED&x64, NoSuf, {} urdmsr, > 0xf20f38f8, USER_MSR|x64, RegMem|NoSuf|NoRex64, { Reg64, Reg64 } > urdmsr, 0xf2f8/0, USER_MSR|x64, Modrm|Vex128|VexMap7|VexW0|NoSuf, > { Imm32, Reg64 } uwrmsr, 0xf30f38f8, USER_MSR|x64, > Modrm|NoSuf|NoRex64, { Reg64, Reg64 } -uwrmsr, 0xf3f8/0, USER_MSR|x64, > Modrm|Vex128|VexMap7|VexW0|NoSuf, { Reg64, Imm32 } > +// Immediates want to be first; md_assemble() takes care of swapping > +operands // accordingly. > +uwrmsr, 0xf3f8/0, USER_MSR|x64, Modrm|Vex128|VexMap7|VexW0|NoSuf, > { > +Imm32, Reg64 } > > // USER_MSR instructions end.
On 06.11.2023 02:19, Hu, Lin1 wrote:
> I'm OK. So, the order of operands in .tbl isn't required to be consistent with the doc.
Well, in our code we are free to implement things how we see fit. When things
are different from the doc, of course some commenting is usually advisable.
Jan
--- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -5201,10 +5201,14 @@ md_assemble (char *line) && operand_type_check (i.types[1], imm))) swap_operands (); - /* The order of the immediates should be reversed - for 2 immediates extrq and insertq instructions */ - if (i.imm_operands == 2 - && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq)) + /* The order of the immediates should be reversed for 2-immediates extrq + and insertq instructions. Also UWRMSR wants its immediate to be in the + "canonical" place (first), despite it appearing last (in AT&T syntax, or + because of the swapping above) in the incoming set of operands. */ + if ((i.imm_operands == 2 + && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq)) + || (t->mnem_off == MN_uwrmsr && i.imm_operands + && i.operands > i.imm_operands)) swap_2_operands (0, 1); if (i.imm_operands) @@ -7557,17 +7561,6 @@ match_template (char mnem_suffix) break; } - /* This pattern aims to put the unusually placed imm operand to a usual - place. The constraints are currently only adapted to uwrmsr, and may - need further tweaking when new similar instructions become available. */ - if (i.imm_operands && i.imm_operands < i.operands - && operand_type_check (operand_types[i.operands - 1], imm)) - { - i.tm.operand_types[0] = operand_types[i.operands - 1]; - i.tm.operand_types[i.operands - 1] = operand_types[0]; - swap_2_operands(0, i.operands - 1); - } - return t; } --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -3354,6 +3354,8 @@ eretu, 0xf30f01ca, FRED&x64, NoSuf, {} urdmsr, 0xf20f38f8, USER_MSR|x64, RegMem|NoSuf|NoRex64, { Reg64, Reg64 } urdmsr, 0xf2f8/0, USER_MSR|x64, Modrm|Vex128|VexMap7|VexW0|NoSuf, { Imm32, Reg64 } uwrmsr, 0xf30f38f8, USER_MSR|x64, Modrm|NoSuf|NoRex64, { Reg64, Reg64 } -uwrmsr, 0xf3f8/0, USER_MSR|x64, Modrm|Vex128|VexMap7|VexW0|NoSuf, { Reg64, Imm32 } +// Immediates want to be first; md_assemble() takes care of swapping operands +// accordingly. +uwrmsr, 0xf3f8/0, USER_MSR|x64, Modrm|Vex128|VexMap7|VexW0|NoSuf, { Imm32, Reg64 } // USER_MSR instructions end.