From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id 9D320385D0E0 for ; Fri, 28 Oct 2022 16:04:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D320385D0E0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x136.google.com with SMTP id f37so8997386lfv.8 for ; Fri, 28 Oct 2022 09:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IYwLku091tky3P7i5NnjDW6FLWX8onhEAdsT3M6tNng=; b=TVgIZE0ykeRvJope8WVwmjGcyOOgVdUB7RJIoTMOYJLTHHtBkVPovJH4xgPWId46HN EKgEnTasEF/OX7GosM2YwnUfXa6MF2hJLafIczPXeD5Nk+J4+RkoanUhY7YKKNe/9aPj vL0w3dkFM2R54SP4U9AoX+iwYWTgOjTFEX/JhRyvLcpjZukSWbKzmpz26PlnrQZHHXIo chF5hcQhffdNnoqVSgE5FIOhIawwzfMIOpzDjt0yo9kIkKRquvn8uGjZzUflTfI7De75 mZCsoW8j1yHgpMptB4AJeIjrhndtVYcwZkH9Iq7IaQP+GJyE+0+eEOdUTgd7v+qfqDlj 17+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IYwLku091tky3P7i5NnjDW6FLWX8onhEAdsT3M6tNng=; b=Lrz/aOrMjAykhvbg4xEwAiJ/YdFGCZMh6Q6k/YO6sFj9QfPulLIi5W4D0s1IW55Geb 83VtelB25pEDRZHaTfcYuqyehTvCJ+xVqIGdjjI/on53TfL5OKntaE/YtU9YACiUAzrq Umo2zsDkippEXtTTrYeWWQBlViyskuhqzP9NUQNiDfgLNNbgFG42Ac0ibnJ2bPosglUu NYAHRhpFztMl4kLDQjtNzW7zQhNXBg5CHHmylfxtxxRWjFSt0qj50qPSZmk9IUSAE/+i 7d+7v6SJ2lqgIn0Xp6kQ4OD0door38dgwqAva7QXtPdZVUmJrY/Fs+Zz1uBunqfKVrAH 5YcQ== X-Gm-Message-State: ACrzQf0/dH0gPM7Qv7+u1ccSzFgSfdfpa1LvKoOn27Seaf0UErZzu5G3 uwuuaO2kuXPutANNaoSeGpj9bK8sYkYzipDPSIg= X-Google-Smtp-Source: AMsMyM6dds/GNkJldMc7uKFaM1lvdl3yEpTGpepLB7atdWGM3XChzRouNp4ggc7yqGzW98kwxL1//17IsS/5fi0qy5M= X-Received: by 2002:a05:6512:4002:b0:4a2:6243:8384 with SMTP id br2-20020a056512400200b004a262438384mr18474lfb.29.1666973042007; Fri, 28 Oct 2022 09:04:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Fri, 28 Oct 2022 09:03:25 -0700 Message-ID: Subject: Re: [PATCH] x86: minor improvements to optimize_imm() (part III) To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3016.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: On Fri, Oct 28, 2022 at 5:35 AM Jan Beulich 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 -- H.J.