Message ID | eb0e1bff-675e-72db-b8b1-b0f0e50b7121@suse.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp803562wru; Fri, 28 Oct 2022 05:35:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61fiOEOVGvuLNnVC0IPvBoDZuQLIuKxQ5Wx8wYZB1OyayzpwmfvjcpPUTdf0Ge/DIm73H5 X-Received: by 2002:aa7:c041:0:b0:45c:1584:23db with SMTP id k1-20020aa7c041000000b0045c158423dbmr50368325edo.184.1666960552588; Fri, 28 Oct 2022 05:35:52 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hc40-20020a17090716a800b00791a4f70674si1826397ejc.24.2022.10.28.05.35.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 05:35:52 -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=p983pkT1; 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 0A89F385151A for <ouuuleilei@gmail.com>; Fri, 28 Oct 2022 12:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A89F385151A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666960551; bh=1GwSVzEegJtryxJxzQd2o88saa9Po/o9a2jYghsHHBY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=p983pkT1ynInbf7SRkVy3bTpBad3oiw55gTZqkCDNoHuQKOPs7IIC0lY8eoNfeoeX koQHQ5OB9MwXm7f9WNbB6BzhnSxcilavSdUXeMUI99JFO0nXgf+9VOn5XL5YHB0SyX z2o2GM6aq/Jtzxd/VuSaAJFjvWsHGMMPxhzrhGxo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by sourceware.org (Postfix) with ESMTPS id B4B72385D0F2 for <binutils@sourceware.org>; Fri, 28 Oct 2022 12:35:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4B72385D0F2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGmtrHjiZ+trqptGJrk7/LtGRUXN3Gzhg4RZ5yWLfJPMf1QsIb5RhObamWxadhBw5BgRjwOx/LIiqsfUZ1Nf04sQHQRPezq0r8q0wn+do4lxAIkBzHPdHWVcPTPy2lKzc6t5QQpoSLPHo7ynW0z6oJHAmZehbsy9JSQ8/+TdXOVw6uM/ZgFz/GY0kwFYW11lRjdZTd3eDcw9vy0RCU1q59z6No7rA4q7H6kjqaVV7FrohICcmQgVft5uXU27pvPQ1W5m86RXT1GbZiZsbmaIevFDCPeZybb2UtBzJSke3cM+dTDo7r9cS5yen0/A3GxbwgmfPp9wiEBV1Zm9pk2L/A== 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=1GwSVzEegJtryxJxzQd2o88saa9Po/o9a2jYghsHHBY=; b=IarHLOIttN2BSUGz18cDwijVGxfM9m0YUEyrgvXjutJXSenDhXv0SONNlZLvGYCkxdytleo7mll+xsL7xuF6obonUVGIX+E56kFpfXFZGY0bO4URixPH+0e1/TFHlRCE+7MxDMjSUy/Lv54sBfi7s65uMgcpWOrcNgDxDAWSMkjfWpN3qjZ4niT7ipDCpyutZdFHOSiwK6dZFHL/IP5/aiXT4e01E6gMnhu2Pu9TK6SNZVllkNZC9rzK4H5ZOgqZG1cDNIBj0oyUkp+3ly4/V2GScbtTV2RxPkAA5E2UJ/TEx5C+qDDo/ID5tMxXfEpbBxPhQmcRFeuX9Qdimoj04g== 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 VI1PR04MB7151.eurprd04.prod.outlook.com (2603:10a6:800:129::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 28 Oct 2022 12:35: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; Fri, 28 Oct 2022 12:35:37 +0000 Message-ID: <eb0e1bff-675e-72db-b8b1-b0f0e50b7121@suse.com> Date: Fri, 28 Oct 2022 14:35:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US To: Binutils <binutils@sourceware.org> Subject: [PATCH] x86: minor improvements to optimize_imm() (part III) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0046.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::23) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|VI1PR04MB7151:EE_ X-MS-Office365-Filtering-Correlation-Id: 115ad028-ac4c-4121-01ea-08dab8e0ea87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lunoqS4l4pP+oPSNgKmS17a6f3LT0WwKOOoHvTiZC1k9POv6aZHu4Y1ZIUySVcG6S2ir8VIdIPtqTWjrHsTKUDzCKNSfMq5eFMVAjHjbgSW578F/nx4ybrDEEUrga9ciWOEBvJbAfv0flYW67MqAv9Y3Imw3PwEpo9zaRPChVdfIuxhpcMBS17iRx/62V9h0zt0Gec1lsQv7gWw96JP6xIs8gozH1jN0qokuEFkhkgN12ojTvEylKXNRqrpS5zKID5eCKGDbur7Hyop3aGLKczMnoEpoH0Vs30FsgqdQX9QPc6a7uYBkcuCM7S3NoqAsDEcjADIJGfa84/E6X/McQvT36hZsgBBlV09RLZNdBPzIwRIFTueI5+5Y/mKwFoOAsMULsPoDXbPzCEhDTzZqgD8adJK2SQME36+ci9jkaxO8qvK5lgRn8pMCGHGIzs+EzoT9cz+EN833hP+kvjmR21McNAb4JixgHkrPyDJd9nbDhopeonfT+CabBvvyW+UI3ub9zy4tfNidHl+nV/7rVc1yBHGh2QlCXQlvo1gDvAf3X0Jf848B2BHpj7mHtMcGJHSLpZE6JY2tWMsY+4AuZJRQ1QJ51iS1YGCh3IAqyofArlR1L1nU3xq2AnWTks8uym/jgH2dShklYikGRV3r4EcyFFS/I10EKFSRxcW8AwEpI/YwcdbZPO5nivl9IdFhZq7ungsHVgODXZ9WKTMYoJBx9wHEZ70rde0bNioOliot+JcepKWISiJGHIPNAzBSNMNVsUUTvajLUnfEiD5mm+aTOH/iU7/5Q4B1LIar088= 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)(366004)(136003)(396003)(346002)(39860400002)(376002)(451199015)(31686004)(36756003)(5660300002)(2906002)(38100700002)(86362001)(31696002)(2616005)(186003)(6512007)(26005)(6486002)(478600001)(316002)(6916009)(41300700001)(8936002)(66946007)(4326008)(8676002)(66476007)(66556008)(6506007)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hXFfZzPBGPS6swKEWJPimmapGyLN?= =?utf-8?q?n5hzeJxZROF8WSQaDSCAp+55m6Ad000wrvfg5vfJJmpqOfNRTYzYghthYjST6QnGu?= =?utf-8?q?vF77EMXvjgUNXmtqeiy6wRmTlDio/MeYhZoeM0bQp2xFvnmNKiJzvqEeKbFIEhRok?= =?utf-8?q?eHghmegpWrk+sK5+B/aDKRJdo0Chn4shgph6AiMM8Poj+CfNJP/HZKtT91Zp2iobU?= =?utf-8?q?gSCCJxCyQCgrptvb8uloiRiUngY5k4ewxThCk236WQF4IZIt9IyZyYBc+dPiG5c4s?= =?utf-8?q?9Yy3gVv0Qg0nsqDguM/BXIehgmDdiqaS5cOGNtMgxQT3R8HR8njGkL7AojgFV6+w7?= =?utf-8?q?UdLjkHSLXKltm/LGCRyVE/+Z7KlwRcO0TbN1mHh+aILDs7tJi6Y5ktB4zupLGPLwD?= =?utf-8?q?xxpuCdnqcXxF5EjV0phjqIG99OLOroYixLVHSPJVZtoE20WF4gNaRhIwbTDuXF5ot?= =?utf-8?q?Bq1OM0TXzZ7GvVJDsGM4Rnej4qvjMHmh22Pfg4Zfb78EJkjL5fcqqR3BmiOzl559C?= =?utf-8?q?L6QfUgALIOsLPRqUdwr67buzEbFreEWrCMCkVyOpOyYc/5heitrPTLsuA5P2MlrHC?= =?utf-8?q?Ony6YjUoXQx8AEOSgnz5apgYXnCehlTunKpt6rgVHd44yS37GBazezfm5/nNVtNAp?= =?utf-8?q?uL7U6HYpaoMILRItQBKxZgLAAn/eyEziDeiWj+zO+Hivo0tw/ht0slHbfKYdmEb+3?= =?utf-8?q?vRgODe45rjLnM6/D5VksvclYNtfruRyNU6XtBgEpoNRObll8lFRvgwAtwPr2Lt+EV?= =?utf-8?q?+27xIs6Q3MqQi3CegBCMia7VTk6kHvwGYiqIw6WXCJDEO28yKOr8hb5p6DI/HPmty?= =?utf-8?q?L6zQMgJF4vcfcVJdcDAM6RC82tlhzFyQyu0axT36BonKimM4ecIoCmqorDzjyrhLR?= =?utf-8?q?4HD0qQKsaWM7R3aj837xprDTATP831amEhYcuTfmd4TExB8dHaBhGqg3Mtd0gGAFC?= =?utf-8?q?LZHVLDdE9C8spe7PZDdI9Wadd6j5tuI2whsEwt1/sYDHJbclPQio9X9qHVQkWWI2e?= =?utf-8?q?72Qhsvi2Z/o5sThBW0gj6Ce/KGkWgrAXxNNekzEAobPpPkYtgg5qeigdOwZ+02rIn?= =?utf-8?q?PvzPNDJo7zoMtn6ppfTRwc5vf+s9IPz23RwKv2LoLOmslj5k3x9hxr2ttugtvsZkY?= =?utf-8?q?LOXnFgqN7EM4p6dUAvUeHOtY3eJ4sVAjDmwybsBgCxmNXa155lAM7g/7QyoBQ87Cy?= =?utf-8?q?Q/Ikk6BYny940FfQwwGEIHumgWPFroFhasOQlYG4biYcG2CvIJaZntW4N278wuRsj?= =?utf-8?q?k191yFV9hy9sh3yiXejOU4RLcrAix5cff0PFwM5O+ZKOyU+OAxh6CPPGWITDs4GDi?= =?utf-8?q?7F5vaCb5yaL1yT9rNd/zMV4e/VI0Mv3NU2nBZjC2Spsn2VPBEprMf3u2fht3FVsR7?= =?utf-8?q?x1bjwcw66LPZ7RBOy1KquXaP2mj8jg0Q/uGRu97jmy+xDVlzTRqk+lpbNsbWq9VKj?= =?utf-8?q?yHZI5dGER/npgpeAz4fqIJNegIdio5zkm46CRme0fcVHSqVaKraVCt/6j7yJjEYEH?= =?utf-8?q?MaYuQ1WsLwgC?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 115ad028-ac4c-4121-01ea-08dab8e0ea87 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 12:35:37.4341 (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: FL1/3hmKUOfSscO8Ixr0pp5pNtSDmwmJ4uUr5tsswRqKAFqtBPOYF6avT3bJRXUrvIbNLUPFBuCSdhOXXFCsAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7151 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 <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?1747934828496077434?= X-GMAIL-MSGID: =?utf-8?q?1747934828496077434?= |
Series |
x86: minor improvements to optimize_imm() (part III)
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Jan Beulich
Oct. 28, 2022, 12:35 p.m. UTC
Earlier tidying still missed an opportunity: There's no need for the "anyimm" static variable. Instead of using it in the loop to mask "allowed" (which is necessary to satisfy operand_type_or()'s assertions) simply use "mask", requiring it to be calculated first. That way the post-loop masking by "mask" ahead of the operand_type_all_zero() can be dropped.
Comments
On Fri, Oct 28, 2022 at 5:35 AM Jan Beulich <jbeulich@suse.com> wrote: > > Earlier tidying still missed an opportunity: There's no need for the > "anyimm" static variable. Instead of using it in the loop to mask > "allowed" (which is necessary to satisfy operand_type_or()'s assertions) > simply use "mask", requiring it to be calculated first. That way the > post-loop masking by "mask" ahead of the operand_type_all_zero() can be > dropped. > > --- a/gas/config/tc-i386.c > +++ b/gas/config/tc-i386.c > @@ -1906,7 +1906,6 @@ operand_type_xor (i386_operand_type x, i > > static const i386_operand_type disp16_32 = OPERAND_TYPE_DISP16_32; > static const i386_operand_type anydisp = OPERAND_TYPE_ANYDISP; > -static const i386_operand_type anyimm = OPERAND_TYPE_ANYIMM; > static const i386_operand_type regxmm = OPERAND_TYPE_REGXMM; > static const i386_operand_type imm8 = OPERAND_TYPE_IMM8; > static const i386_operand_type imm8s = OPERAND_TYPE_IMM8S; > @@ -5812,13 +5811,6 @@ optimize_imm (void) > const insn_template *t = current_templates->start; > > operand_type_set (&mask, 0); > - allowed = t->operand_types[op]; > - > - while (++t < current_templates->end) > - { > - allowed = operand_type_and (allowed, anyimm); > - allowed = operand_type_or (allowed, t->operand_types[op]); > - } > switch (guess_suffix) > { > case QWORD_MNEM_SUFFIX: > @@ -5837,7 +5829,14 @@ optimize_imm (void) > default: > break; > } > - allowed = operand_type_and (mask, allowed); > + > + allowed = operand_type_and (t->operand_types[op], mask); > + while (++t < current_templates->end) > + { > + allowed = operand_type_or (allowed, t->operand_types[op]); > + allowed = operand_type_and (allowed, mask); mask isn't changed in the loop. Can the AND operation be moved after the loop? > + } > + > if (!operand_type_all_zero (&allowed)) > i.types[op] = operand_type_and (i.types[op], mask); > } > --- a/opcodes/i386-gen.c > +++ b/opcodes/i386-gen.c > @@ -537,8 +537,6 @@ static initializer operand_type_init[] = > "Imm32|Imm32S|Imm64|Disp32" }, > { "OPERAND_TYPE_IMM32_32S_64_DISP32_64", > "Imm32|Imm32S|Imm64|Disp32|Disp64" }, > - { "OPERAND_TYPE_ANYIMM", > - "Imm1|Imm8|Imm8S|Imm16|Imm32|Imm32S|Imm64" }, > }; > > typedef struct bitfield
On 28.10.2022 18:03, H.J. Lu wrote: > On Fri, Oct 28, 2022 at 5:35 AM Jan Beulich <jbeulich@suse.com> wrote: >> >> Earlier tidying still missed an opportunity: There's no need for the >> "anyimm" static variable. Instead of using it in the loop to mask >> "allowed" (which is necessary to satisfy operand_type_or()'s assertions) >> simply use "mask", requiring it to be calculated first. That way the >> post-loop masking by "mask" ahead of the operand_type_all_zero() can be >> dropped. >> >> --- a/gas/config/tc-i386.c >> +++ b/gas/config/tc-i386.c >> @@ -1906,7 +1906,6 @@ operand_type_xor (i386_operand_type x, i >> >> static const i386_operand_type disp16_32 = OPERAND_TYPE_DISP16_32; >> static const i386_operand_type anydisp = OPERAND_TYPE_ANYDISP; >> -static const i386_operand_type anyimm = OPERAND_TYPE_ANYIMM; >> static const i386_operand_type regxmm = OPERAND_TYPE_REGXMM; >> static const i386_operand_type imm8 = OPERAND_TYPE_IMM8; >> static const i386_operand_type imm8s = OPERAND_TYPE_IMM8S; >> @@ -5812,13 +5811,6 @@ optimize_imm (void) >> const insn_template *t = current_templates->start; >> >> operand_type_set (&mask, 0); >> - allowed = t->operand_types[op]; >> - >> - while (++t < current_templates->end) >> - { >> - allowed = operand_type_and (allowed, anyimm); >> - allowed = operand_type_or (allowed, t->operand_types[op]); >> - } >> switch (guess_suffix) >> { >> case QWORD_MNEM_SUFFIX: >> @@ -5837,7 +5829,14 @@ optimize_imm (void) >> default: >> break; >> } >> - allowed = operand_type_and (mask, allowed); >> + >> + allowed = operand_type_and (t->operand_types[op], mask); >> + while (++t < current_templates->end) >> + { >> + allowed = operand_type_or (allowed, t->operand_types[op]); >> + allowed = operand_type_and (allowed, mask); > > mask isn't changed in the loop. Can the AND operation be moved after > the loop? Initially I thought it could, yes, but it cannot: As said in the description the AND-ing "is necessary to satisfy operand_type_or()'s assertions". Jan
On Mon, Oct 31, 2022 at 3:11 AM Jan Beulich <jbeulich@suse.com> wrote: > > On 28.10.2022 18:03, H.J. Lu wrote: > > On Fri, Oct 28, 2022 at 5:35 AM Jan Beulich <jbeulich@suse.com> wrote: > >> > >> Earlier tidying still missed an opportunity: There's no need for the > >> "anyimm" static variable. Instead of using it in the loop to mask > >> "allowed" (which is necessary to satisfy operand_type_or()'s assertions) > >> simply use "mask", requiring it to be calculated first. That way the > >> post-loop masking by "mask" ahead of the operand_type_all_zero() can be > >> dropped. > >> > >> --- a/gas/config/tc-i386.c > >> +++ b/gas/config/tc-i386.c > >> @@ -1906,7 +1906,6 @@ operand_type_xor (i386_operand_type x, i > >> > >> static const i386_operand_type disp16_32 = OPERAND_TYPE_DISP16_32; > >> static const i386_operand_type anydisp = OPERAND_TYPE_ANYDISP; > >> -static const i386_operand_type anyimm = OPERAND_TYPE_ANYIMM; > >> static const i386_operand_type regxmm = OPERAND_TYPE_REGXMM; > >> static const i386_operand_type imm8 = OPERAND_TYPE_IMM8; > >> static const i386_operand_type imm8s = OPERAND_TYPE_IMM8S; > >> @@ -5812,13 +5811,6 @@ optimize_imm (void) > >> const insn_template *t = current_templates->start; > >> > >> operand_type_set (&mask, 0); > >> - allowed = t->operand_types[op]; > >> - > >> - while (++t < current_templates->end) > >> - { > >> - allowed = operand_type_and (allowed, anyimm); > >> - allowed = operand_type_or (allowed, t->operand_types[op]); > >> - } > >> switch (guess_suffix) > >> { > >> case QWORD_MNEM_SUFFIX: > >> @@ -5837,7 +5829,14 @@ optimize_imm (void) > >> default: > >> break; > >> } > >> - allowed = operand_type_and (mask, allowed); > >> + > >> + allowed = operand_type_and (t->operand_types[op], mask); > >> + while (++t < current_templates->end) > >> + { > >> + allowed = operand_type_or (allowed, t->operand_types[op]); > >> + allowed = operand_type_and (allowed, mask); > > > > mask isn't changed in the loop. Can the AND operation be moved after > > the loop? > > Initially I thought it could, yes, but it cannot: As said in the > description the AND-ing "is necessary to satisfy operand_type_or()'s > assertions". > > Jan OK. Thanks.
--- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1906,7 +1906,6 @@ operand_type_xor (i386_operand_type x, i static const i386_operand_type disp16_32 = OPERAND_TYPE_DISP16_32; static const i386_operand_type anydisp = OPERAND_TYPE_ANYDISP; -static const i386_operand_type anyimm = OPERAND_TYPE_ANYIMM; static const i386_operand_type regxmm = OPERAND_TYPE_REGXMM; static const i386_operand_type imm8 = OPERAND_TYPE_IMM8; static const i386_operand_type imm8s = OPERAND_TYPE_IMM8S; @@ -5812,13 +5811,6 @@ optimize_imm (void) const insn_template *t = current_templates->start; operand_type_set (&mask, 0); - allowed = t->operand_types[op]; - - while (++t < current_templates->end) - { - allowed = operand_type_and (allowed, anyimm); - allowed = operand_type_or (allowed, t->operand_types[op]); - } switch (guess_suffix) { case QWORD_MNEM_SUFFIX: @@ -5837,7 +5829,14 @@ optimize_imm (void) default: break; } - allowed = operand_type_and (mask, allowed); + + allowed = operand_type_and (t->operand_types[op], mask); + while (++t < current_templates->end) + { + allowed = operand_type_or (allowed, t->operand_types[op]); + allowed = operand_type_and (allowed, mask); + } + if (!operand_type_all_zero (&allowed)) i.types[op] = operand_type_and (i.types[op], mask); } --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -537,8 +537,6 @@ static initializer operand_type_init[] = "Imm32|Imm32S|Imm64|Disp32" }, { "OPERAND_TYPE_IMM32_32S_64_DISP32_64", "Imm32|Imm32S|Imm64|Disp32|Disp64" }, - { "OPERAND_TYPE_ANYIMM", - "Imm1|Imm8|Imm8S|Imm16|Imm32|Imm32S|Imm64" }, }; typedef struct bitfield