From patchwork Tue Nov 7 16:35:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 162674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp354619vqo; Tue, 7 Nov 2023 08:35:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFt7D1KsDt8jYKUlJ8T6vVCiPWyhejcc38VHH9vkGv+kdaHlTGJf7GZbATuuQkxH+Ok0+uS X-Received: by 2002:a05:6214:e64:b0:66d:59d2:4310 with SMTP id jz4-20020a0562140e6400b0066d59d24310mr3438824qvb.14.1699374922735; Tue, 07 Nov 2023 08:35:22 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1699374922; cv=pass; d=google.com; s=arc-20160816; b=KuePLTPR0jObQvbiFggTxTKIkCBhujocQoM2GOZgmZ2r4sD7vJGKjNhXUVGI8+DjAQ 41JGWdUXwR3LVDFnO0IQAuEDSslu5PXW9kNIABVa14Tns0eOn6/nCVNdlR1mUUpoZt6J AMTwn4MXqdJt2KeVK55XNV+yGWI41iPe0w/Ymz/jvQuvo7m8xmZ+iz/rw2TI+yGlc30p hrO87EVQdN9emgvA5EXgL18xRvH0m3DBQbVQz19nqMfWjrcnnRaAnWXGzyndT94f9iT4 7RfUNWLU0g5Mou2hhE7+9zJbbmxAZpFT6KwbHk0dMJtxhqelI4tcQY3XCdENgh6y7mgp HwbA== 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:in-reply-to:references:cc:to:from :content-language:subject:user-agent:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Lp6uy3RrlOSFmdCJu3IdoCGIlzIfCybogX9kXDlRdUM=; fh=2DbSPqOhyO7CNtGa024QKgSiHKlKGVt2h+1rlgWLnZI=; b=0hjrI+8w0+RyGaBaCM/b5olIZ6B7Z85LMtKS457v/tkl0eWF+Lj7vu+4SK8HiF/183 uGp027pFTj67fD7PMTbndI1C87b8x/w3ycgstyrXRO49gPUKV2UcFtwxCtA/uA92QWNz QVxdZ0eGwE5Jvw0jH7NGA64cAqK1n9R4bmto4X6u4ybhmnfz/8fLZDcnL7rstqWQxSoJ UkoVOwc8P/odWqHwDVWOwboViKTLXgI+0QtiGC5IAfdBS9IhfwRhbLHupvzf3mY2bCvu qn483MtbVIEfqDl5yMLLjk1xe7coRlwTBzKo8hQjQSj4WJY0G0fO3cge6WUDQx/x9Hiq 4B/w== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=lUw1QE85; arc=pass (i=2); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j17-20020a056214033100b0065af74b868dsi62888qvu.381.2023.11.07.08.35.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 08:35:22 -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=@suse.com header.s=selector1 header.b=lUw1QE85; arc=pass (i=2); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CB643857727 for ; Tue, 7 Nov 2023 16:35:22 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2079.outbound.protection.outlook.com [40.107.21.79]) by sourceware.org (Postfix) with ESMTPS id C7F043858C5E for ; Tue, 7 Nov 2023 16:35:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7F043858C5E 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 C7F043858C5E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.79 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699374914; cv=pass; b=amOFN9gK4TuaQhPq8fOrmeVU1X5OMoQLMs0RR94fLhf/xsaBaim3IFgH2MrphGeBYaGqF55v8LvaJfhIVqL+pLXCp8bz1u+OzNCOQBbb+g4IwdhkMs9Oq1VTwCD3MQQ8M28i+j7/BZSKLPrRTBlrKdmaI9xPhsEVB3bSBPfRJmk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699374914; c=relaxed/simple; bh=S0m53Cqo3sfOG2nTbPaxkdK5ddXHSpQwmsHnREzNW7E=; h=DKIM-Signature:Message-ID:Date:Subject:From:To:MIME-Version; b=jryY8RbVfwqa0CMdW8oft4hmWP6mCRbyIAHoq9b12lhkKGBm9oMKBDbaKOYc0GV8nhatI7yw4uwW+7Xr++Qt17GJGhB0ir7VtmFi2cvZXRKfEV1kwCtIFmHb10JAxbsnxhAImDCRxN0auXejExESLBJKjWIFAaItEZv0UZDXpvo= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=juqU/Bf2yydVLgvCK6NqyYEq0Fl5uZqBgDz9XRF8zRrVdWf8m+9Ubot5XDBF/UAi1+zcz1oGJckB2TiWLo544UNTjVmoH8HevVaWu1hdvthe/uza38RlSiENMre18QVzQo62fr1CmxpRbN1O6E7bnsNqxVeV4eQWIJuqhHtJ5XyQFLsJ7JwuTsryZ+h6BvuGhioxwaxuQgT7ZvhC+zdCchfsnp3Dqd/oMzupdCF3oLFmG5kci3gV5cGp34YA+BjkKZBAI5zLRk6HBBhnUsc6N1swQJNt3w/VNPhf29aMcFviO20dDsA+qHW0o/DYxf8GIxyxTAW7x7TYvNNEsceY6w== 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=Lp6uy3RrlOSFmdCJu3IdoCGIlzIfCybogX9kXDlRdUM=; b=Bi3q6VN2UK4Iqmep4++4ykEbzpLnLtbJ9mpWenEIRlgV6H953SlWq7VWy5AAxOiE4bSVAYuO5GP1iy0dORwez2F50ZuSaQqaycInKA/nWSAVyDcSEDiaPxnrvhuThSQ3Au0tE4iXmg69ned88QqYDUptbD8mN29Bkvw4knFKBina9IVBQmAHmUYFVqKMKkfQu9+dvGeVBdjJOxEwIeIRia+LiTmSRU2NcdzK48a98977h2Oajt3u+jbgxapSsw6HIT9X5A1L9rVgpmJbl5HSxg0+RjqABRpYYN6WP7+HEOeEJC+an4cucd5zEO0qaNKcYHIUdY0GY2swslU0gc306A== 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=Lp6uy3RrlOSFmdCJu3IdoCGIlzIfCybogX9kXDlRdUM=; b=lUw1QE85uOsr83Dhrzv7scSywXsR83A33C+rMldzEyPumzhvftdsFh7bWrGnMcPbioHj8uHa9uz3cr4/Oh7Y7peSv3mS85eyeFPiv/zzPKKRsjZ5uDGDxcSktuLODbWgh5E73+84dy3KH1utvqxCzfRLvbR/u5OoHRjUANZLvakY+Tlw52IH52+OTbtj8T2lJLIufHCYfTrBn1w5ImFTT9ZI2RDi5hoz/9c+9mEOLqHALOmPS3elKaWS7v21sK4PcG4Vl2QJwMY2D0Ms6Kyk0OleqiwPlAHiclhEbrlwCYEs6C7WvXKaBsYpLilarBuF2j5vhYBxU7kqJCWFPnu4uw== 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 PAXPR04MB9090.eurprd04.prod.outlook.com (2603:10a6:102:227::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.16; Tue, 7 Nov 2023 16:35:09 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.6977.017; Tue, 7 Nov 2023 16:35:09 +0000 Message-ID: <6871d921-5971-3f39-3d9a-6d216fd06a28@suse.com> Date: Tue, 7 Nov 2023 17:35:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: [PATCH v3 3/2] x86: do away with is_evex_encoding() Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: In-Reply-To: X-ClientProxiedBy: FR5P281CA0026.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f1::11) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|PAXPR04MB9090:EE_ X-MS-Office365-Filtering-Correlation-Id: 159c8e62-3425-4c70-43e0-08dbdfaf8197 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cgay6Z+dPF7vlUYZmd/9Ezw3F61dt7godHJuQGgmubIheHfDcJPqA6TwBgwnjej6beL/nU8lC/eFlqjcxR7nyqRPoHwOblmns59hUwWG4ZPyUfKsiMybOMvIhYVvN5KIck7vau2sz0BA/iy3hNNvOlTDfQ3nSM0oLD/zSymllwK4cmnx9EyeUmro5ZiChouiIrcQi9obGQjIAIiLcjJDxk1Pwn57M3ZPDnT6wFg8tm7654WxUGRbZOWFS6xTTttZIDwOw+7EoUfHKV27bpKlozdgxu9Kl45VdRk2nmE+/Ies08lcxWd/EgWWw3sZ7mCgSypSipmEMmKIlOjkBKZATPCbV8PuXKp7RIsrcxCIgSUSoPFhQFHYEeWNAg2ZrJN8n/LPNffw3ZMZfJROyppDLFWt1pFLrsUMwBzn1r+PZO+7J7K0C5EThmLXYfZrZHbI4mFEsiWNVtk2jDNjsdp9Pw+iP0S10J8sXoJBGWHVzh3ot1qgFKpN68znTl78tMTL310xkH/xuETU3zYVkLsJg3Q0EUKGKLoAYqOE6r5lE+vXTY1lqDZEkDHrCbeUQ7L6icUvWlEfEYRE/GG9COUWWL7wKbxdnO6ho2Bcx+pFHVRP3NMrG11590Ng2rGrogDP/U4+zHXwvkHioOb0cgLytQ== 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)(396003)(346002)(136003)(39860400002)(376002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(4326008)(31686004)(2906002)(41300700001)(5660300002)(6486002)(8936002)(478600001)(8676002)(54906003)(66899024)(66556008)(66946007)(6916009)(66476007)(316002)(26005)(86362001)(6512007)(6506007)(2616005)(36756003)(38100700002)(31696002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KvMuqWCcAcIbuP+hupWnQmocRa95?= =?utf-8?q?I5NCw6Y5+EfObzLpbL6Ul5wlQHUxiYCmAxjrUfIoN4Vk5KU1ZzSLU5AW4UEcheOU/?= =?utf-8?q?HtKfg77LClB8cBZiFR0EOcVn3tcKoshIQ7NBA+fbB6BJUEtGmvv76ryeHX4vY2W5a?= =?utf-8?q?78DAQMMAjjitikBa/5jrc8V3u2trqF2cu4+fKGJw5p0AI/803fxuR3EToF8qY4L4e?= =?utf-8?q?pL00qw+T+Q5p5Tb3vZQwxEqwH1qu8lkl6ejDmyDhSg50FdIw0RUPU9inPGms68epN?= =?utf-8?q?ykwVewL4K3p0pBuwkW88Bah2bSROrEj12bb5h/lW9GjhkVYerL5JWvcVNr+qhG296?= =?utf-8?q?0S9iovI5Ku68XPOnPlLpASPX74nR9MC7/jP5WwAJOLAgtahQquF8fNxZ0oVCsIP75?= =?utf-8?q?C8z4EnICGzN8G6jMd1M2DAYkJg5fnHsA7tk83CZi6wi5DXMpF82TBLV7MS83fwsJ5?= =?utf-8?q?gT6WZiRgiAFad/bGlLuiLHQuM/ECDKNeUDq8dHrGZ9Nu02QLse3b0c+cpI6DnAYo1?= =?utf-8?q?uuxUd0WnJpjEcDILAoqSn6NNtiM/sbvJtPkuMqqwL/6FuryXljnyx7SuezJ8AJkt+?= =?utf-8?q?gcTHW2UTgsCyk/LnidC73Jw5bCvlglZRKFDy3Eh2aPT7U8TAAQ0Wb+4X7NrzdEn4B?= =?utf-8?q?pbsJbSmi1dIxBLsqEGV6SAo7qB9Bvawnb6BK7oivCF4ZwOIBXvie17iTaea8nZgK/?= =?utf-8?q?6nIiNDMJtW735w2un73O6Bk1AQ/YJ3lCAlF3rxRQRBFZba9JP+GLphodunFDf+vUj?= =?utf-8?q?NMtv/2/35gr3bnWEcMuUkLu70kPzqBDDV+nYRL/ia/e/2Vx6P4jSzNHW3KksrLZQ5?= =?utf-8?q?qek2xWonY00y2Qy7dzXhkiOGJP8d1VNVnwnq48pwMzM3OHyvjSxVPObJOlVfTd3kE?= =?utf-8?q?Fa7BujwZPsFc2LPS9H9IhoEfsurVKVTOWlB6ohnvFstBsjCeHoyXyLVnMtHDgI8zW?= =?utf-8?q?Aq32fCCDKknT0EJTKWP1Px3w2HahmbkTaJvnyp+cTZMWaYNMms8XILvpSzUF2mfjI?= =?utf-8?q?4vi1tHNjXTHXVWTXxoK1Xa8WDLATp/XExveDEW/fELnw5MeMIUlRttweBZKLyDelC?= =?utf-8?q?vVmWkBzo6dyZuG9EV19/FJTuXMpNYsNKiS/8TDBJTLIl/JaSW+mAjMjnhLqkDtAGd?= =?utf-8?q?bTT+shjrQcPcRfsezRowX7sqqSFC4o+6WIlsX8hRkMEAqfLUbg8XVYlPUy0slAsGv?= =?utf-8?q?O1hJfAabna92jWi9LmZAlPpbpPo+vliwQ1iAMjlrjY5dqDQTRTEsdwo9yhFK8L2c9?= =?utf-8?q?rRIiN8kWR1ayPkgaOT6KSFkakqpVyIP8VPA9/daMI/Clh9RGmey82iiZ1AAx50SiK?= =?utf-8?q?+gIVzQnZtxZVB1LNNl7dAVdZvcO9X8yMiA+Dk0ZGreCMGcG9B5g0Xsh7OEMilnFXU?= =?utf-8?q?IxpzsktYSfgVhHn33mJj5/Jktz7gk3hw7hy6IEhGZ36M8vtpIzohkpJ5paqpm1tYU?= =?utf-8?q?8ISyoqHW39ezlNa/IxyBrh1oiRvDEUHft7NDkZ5Etygh9LI04If5louRjqEPbcjsJ?= =?utf-8?q?YFsMlaX8FXob?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 159c8e62-3425-4c70-43e0-08dbdfaf8197 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2023 16:35:09.0805 (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: cy2mc1FdvBJ1BAfX+1KyVcJxA1WDPADB+VNPB7DpDIAYvyMVVmG3elUNyHL0WIaYmvrdJ8A5IkbgBW9kKbSz4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9090 X-Spam-Status: No, score=-3026.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781923758706942848 X-GMAIL-MSGID: 1781923758706942848 As we have grown more uses of it, it becomes increasingly more desirable to replace it by a simpler check. Have i386-gen do at build time what so far was done at runtime: Deal with templates indicating EVEX-encoding by other than the EVex attribute, and set that to "dynamic" in such cases. This then allows simplifying a number of other conditionals as well. --- v3: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3861,17 +3861,9 @@ build_vex_prefix (const insn_template *t } static INLINE bool -is_evex_encoding (const insn_template *t) -{ - return t->opcode_modifier.evex || t->opcode_modifier.disp8memshift - || t->opcode_modifier.broadcast || t->opcode_modifier.masking - || t->opcode_modifier.sae; -} - -static INLINE bool is_any_vex_encoding (const insn_template *t) { - return t->opcode_modifier.vex || is_evex_encoding (t); + return t->opcode_modifier.vex || t->opcode_modifier.evex; } static unsigned int @@ -3891,8 +3883,7 @@ get_broadcast_bytes (const insn_template gas_assert (op < t->operands); - if (t->opcode_modifier.evex - && t->opcode_modifier.evex != EVEXDYN) + if (t->opcode_modifier.evex != EVEXDYN) switch (i.broadcast.bytes) { case 1: @@ -4040,8 +4031,7 @@ build_evex_prefix (void) /* Encode the vector length. */ unsigned int vec_length; - if (!i.tm.opcode_modifier.evex - || i.tm.opcode_modifier.evex == EVEXDYN) + if (i.tm.opcode_modifier.evex == EVEXDYN) { unsigned int op; @@ -4539,7 +4529,7 @@ optimize_encoding (void) && !i.types[2].bitfield.xmmword && (i.tm.opcode_modifier.vex || ((!i.mask.reg || i.mask.zeroing) - && is_evex_encoding (&i.tm) + && i.tm.opcode_modifier.evex && (i.vec_encoding != vex_encoding_evex || cpu_arch_isa_flags.bitfield.cpuavx512vl || is_cpu (&i.tm, CpuAVX512VL) @@ -4588,7 +4578,7 @@ optimize_encoding (void) VEX VOP %kM, %kM, %kN -> VEX kandnw %kM, %kM, %kN */ - if (is_evex_encoding (&i.tm)) + if (i.tm.opcode_modifier.evex) { if (i.vec_encoding != vex_encoding_evex) { @@ -4624,7 +4614,7 @@ optimize_encoding (void) && !i.mask.reg && !i.broadcast.type && !i.broadcast.bytes - && is_evex_encoding (&i.tm) + && i.tm.opcode_modifier.evex && ((i.tm.base_opcode & ~Opcode_SIMD_IntD) == 0x6f || (i.tm.base_opcode & ~4) == 0xdb || (i.tm.base_opcode & ~4) == 0xeb) @@ -4703,7 +4693,7 @@ optimize_encoding (void) && i.op[0].regs == i.op[1].regs && (!i.tm.opcode_modifier.vex || !(i.op[0].regs->reg_flags & RegRex)) - && !is_evex_encoding (&i.tm)) + && !i.tm.opcode_modifier.evex) { /* Optimize: -Os: pcmpeqq %xmmN, %xmmN -> pcmpeqd %xmmN, %xmmN @@ -4720,7 +4710,7 @@ optimize_encoding (void) && i.tm.opcode_space == SPACE_0F38)) && i.operands == i.reg_operands && i.op[0].regs == i.op[1].regs - && !is_evex_encoding (&i.tm)) + && !i.tm.opcode_modifier.evex) { /* Optimize: -O: pcmpgt[bwd] %mmN, %mmN -> pxor %mmN, %mmN @@ -6956,7 +6946,7 @@ VEX_check_encoding (const insn_template || i.vec_encoding == vex_encoding_evex512) { /* This instruction must be encoded with EVEX prefix. */ - if (!is_evex_encoding (t)) + if (!t->opcode_modifier.evex) { i.error = unsupported; return 1; @@ -7786,27 +7776,22 @@ process_suffix (void) { i.tm.operand_types[op].bitfield.ymmword = 0; if (i.tm.operand_types[op].bitfield.xmmword - && (i.tm.opcode_modifier.evex == EVEXDYN - || (!i.tm.opcode_modifier.evex - && is_evex_encoding (&i.tm)))) + && i.tm.opcode_modifier.evex == EVEXDYN) i.tm.opcode_modifier.evex = EVEX128; } else if (i.tm.operand_types[op].bitfield.ymmword && !i.tm.operand_types[op].bitfield.xmmword - && (i.tm.opcode_modifier.evex == EVEXDYN - || (!i.tm.opcode_modifier.evex - && is_evex_encoding (&i.tm)))) + && i.tm.opcode_modifier.evex == EVEXDYN) i.tm.opcode_modifier.evex = EVEX256; } - else if (is_evex_encoding (&i.tm) + else if (i.tm.opcode_modifier.evex && !cpu_arch_flags.bitfield.cpuavx512vl) { if (i.tm.operand_types[op].bitfield.ymmword) i.tm.operand_types[op].bitfield.xmmword = 0; if (i.tm.operand_types[op].bitfield.zmmword) i.tm.operand_types[op].bitfield.ymmword = 0; - if (!i.tm.opcode_modifier.evex - || i.tm.opcode_modifier.evex == EVEXDYN) + if (i.tm.opcode_modifier.evex == EVEXDYN) i.tm.opcode_modifier.evex = EVEX512; } @@ -7834,7 +7819,7 @@ process_suffix (void) suffixes |= 1 << 7; if (i.tm.operand_types[op].bitfield.zmmword) suffixes |= 1 << 8; - if (is_evex_encoding (&i.tm)) + if (i.tm.opcode_modifier.evex) evex = EVEX512; } } @@ -8728,7 +8713,7 @@ build_modrm_byte (void) exp = i.op[0].imms; } exp->X_add_number |= register_number (i.op[reg_slot].regs) - << (3 + !(is_evex_encoding (&i.tm) + << (3 + !(i.tm.opcode_modifier.evex || i.vec_encoding == vex_encoding_evex)); } --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1192,6 +1192,16 @@ process_i386_opcode_modifier (FILE *tabl fprintf (table, " SPACE_%s, %s,\n", spaces[space], extension_opcode ? extension_opcode : "None"); + /* Rather than evaluating multiple conditions at runtime to determine + whether an EVEX encoding is being dealt with, derive that information + right here. A missing EVex attribute means "dynamic". */ + if (!modifiers[EVex].value + && (modifiers[Disp8MemShift].value + || modifiers[Broadcast].value + || modifiers[Masking].value + || modifiers[SAE].value)) + modifiers[EVex].value = EVEXDYN; + output_opcode_modifier (table, modifiers, ARRAY_SIZE (modifiers)); }