From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id AECFE3858D1E for ; Wed, 22 May 2024 06:22:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AECFE3858D1E 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 AECFE3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::536 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716358973; cv=none; b=Vdn5mz0QH9//pAzQDF0Tm0WYMgl0r0m13TtlrbiKV+z5ptkXVxtzs0wyYuyDMXfC3G/OKFHcKW3e8hUmv7lRgYc9Homz8r6FokaZAo9Py7jzsWk+cw1JHN5p3bjH2oAsDF1eWnC8x3t8vGpi7F1/+nXOmDLyn6kUogg3yTCl0Cw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716358973; c=relaxed/simple; bh=Jmyp4L7iAdSWAkqds8afEr9PpP0XcjJzJiDtPmAVZi4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Nd7k+nNmed5lh5lmTVol4itzwdgCpGadRDZeWfwB8/jzXWxcF1IGQqjW3YfiAlr7oQhOcE2r/m3j/t52kB8lF5OyPz4cVWjyN9+IX1SUOskeETZJ93G7ZMOFYaWm9Zii54et7nk3KDAt5540KNzMmiuVLrDITNTdEQWEjp85OmY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-572c65cea55so928053a12.0 for ; Tue, 21 May 2024 23:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716358968; x=1716963768; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oQW2BHi6S/M/UGBn/qPR/8PSycf6EyAzMD3o+8ltuWA=; b=LhPTsKOmyhjzqvORfomp0jF0YFjxVKj4h9oIUF/lKcTxijXqho6Mk/bNHnfwnJirwY skQFVuYYZjBPpjkPDkQiAiA3M55MT+Oj1NOJwhZmD8HbTAmRT+STjnmd7wLxq/RiU7e7 3LYPd3YgkuhS2Sr+HWSzD4Z7qVTWAykuDWqKar2UQe1RvmJZTxHq7HwghGdneM65FW8w v4CJ2YsEp9vB77T0g2o6cYMuTJStP6pmD3L8R6tdiPKKY3BKXoy1xmRIwBcD4cWumZ/k W/QjoHZbqYaJbdnm/3ALh39X83KzLqLs769UZtv1MQlFvflqjpoaEFLtP7/SK4mHwXKf o7Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716358968; x=1716963768; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oQW2BHi6S/M/UGBn/qPR/8PSycf6EyAzMD3o+8ltuWA=; b=d0ybR/Xic1mNfpfCXRQoRwqMsGm0CwDkI+9wiraYlEwb5d0yrA/u15FqS6afp3iDh3 Q6sCk3N2JZOzHKXx9SLWC4w/jZbGMdFY0nEA3TjHimCpDuKoQT02Mnw+VtKcB9BzvhCu s1k0P98qcMRlxDcSJ2OCNWpPWxFMwNtpNPqc8uwxNZcrTtzHE2TcFAzqnZG0MAiD7Dpb KyMRUN1GmrMFpwPkWMmfDfd0lU9KFlAbztiASYE38z21/3intnbePShvgKDX7pjrJEKY gL5mZCftGmfDmJYNqyt7EMhp5mUZa81WGV+YTNYF3UhFWMn9WB7LVcvqGtQOw3zjUzQr HchA== X-Forwarded-Encrypted: i=1; AJvYcCUZVR3WG1UT19a2KgznIpDcLXyPQpEQCCAVFPUCSV5F3MiNlu7rChIljdOsRK4whqSjoopiDCJoATX1xZcAopJKpEREo+8BWQ== X-Gm-Message-State: AOJu0YxsxU+W4peby7+xIuKtMPkfv4pTbj5I3jMqjUkkavXP063duRX6 wscsu4AzHFrMIW5UNUY+h0HILkPUpup08RWmWt9zwPxWN1JPxiosMNTPvBkWzQ== X-Google-Smtp-Source: AGHT+IHXfhZC/qHuxem64TdZ1ushplxVEnNWzPBFW6xvMWctIcLoKE9ll7UxrAf1LRAqfBxdn5OFEA== X-Received: by 2002:a50:d50a:0:b0:574:eb36:9cf5 with SMTP id 4fb4d7f45d1cf-5752b475d87mr10135802a12.11.1716358968320; Tue, 21 May 2024 23:22:48 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733bea65aasm17808715a12.5.2024.05.21.23.22.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 May 2024 23:22:48 -0700 (PDT) Message-ID: <0e11ed24-1622-43f4-ad35-e645098ee8af@suse.com> Date: Wed, 22 May 2024 08:22:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] x86: Split REX/REX2 old registers judgment. Content-Language: en-US To: "Cui, Lili" Cc: "hjl.tools@gmail.com" , "binutils@sourceware.org" References: <20240520062202.1297234-1-lili.cui@intel.com> <20240520062202.1297234-2-lili.cui@intel.com> <241011a5-1240-4a56-8749-ccc3a9d97a65@suse.com> <21daf000-afb4-4b25-a711-8a302140429e@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/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8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3024.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 22.05.2024 08:11, Cui, Lili wrote: >> On 22.05.2024 03:33, Cui, Lili wrote: >>>> On 20.05.2024 08:22, Cui, Lili wrote: >>>>> --- a/gas/config/tc-i386.c >>>>> +++ b/gas/config/tc-i386.c >>>>> @@ -4303,22 +4303,20 @@ static void establish_rex (void) >>>>> /* Respect a user-specified REX prefix. */ >>>>> i.rex |= i.prefix[REX_PREFIX] & REX_OPCODE; >>>>> >>>>> - /* For 8 bit registers we need an empty rex prefix. Also if the >>>>> - instruction already has a prefix, we need to convert old >>>>> - registers to new ones. */ >>>>> - >>>>> - if ((i.types[first].bitfield.class == Reg && i.types[first].bitfield.byte >>>>> - && ((i.op[first].regs->reg_flags & RegRex64) != 0 || i.rex != 0 >>>>> - || i.rex2 != 0)) >>>>> - || (i.types[last].bitfield.class == Reg && i.types[last].bitfield.byte >>>>> - && ((i.op[last].regs->reg_flags & RegRex64) != 0 || i.rex != 0 >>>>> - || i.rex2 != 0))) >>>>> - { >>>>> - unsigned int x; >>>>> - >>>>> - if (!is_apx_rex2_encoding () && !is_any_vex_encoding(&i.tm)) >>>>> - i.rex |= REX_OPCODE; >>>>> - for (x = first; x <= last; x++) >>>>> + /* For 8 bit registers without a prefix, we need an empty rex >>>>> + prefix. */ >>>> >>>> As you're touching this comment, can you please also correct it? It's >>>> not all 8- bit registers which are affected here (as expressed by the >>>> RegRex64 checks). >>>> >>> Done. >>> >>>>> + if (((i.types[first].bitfield.class == Reg && i.types[first].bitfield.byte >>>>> + && ((i.op[first].regs->reg_flags & RegRex64) != 0 )) >>>> >>>> Nit: Please parenthesize this line and ... >>>> >>>>> + || (i.types[last].bitfield.class == Reg && i.types[last].bitfield.byte >>>>> + && (i.op[last].regs->reg_flags & RegRex64) != 0 )) >>>> >>>> ... this one the same way, preferably like the latter. Also please >>>> omit the blanks before the closing parentheses. >>>> >>> Done. >>> >>>>> + && !is_apx_rex2_encoding () && !is_any_vex_encoding (&i.tm) >>>>> + && >>>>> + !i.rex) >>>> >>>> Is the !i.rex part needed? It wasn't there before. If it's needed, it >>>> would imo better come ahead of the APX/VEX checks. >>>> >>> Yes, I added it because there is already i.rex and we don't need to overwrite >> it. And I will put it ahead of the APX/VEX checks. >> >> I don't think conditionals should be added in such cases. Resulting code will do >> better without the extra conditional branch, when the update is really benign >> in the case where (here) i.rex is already set. See, btw, your own response to a >> pretty similar question of mine: >> https://sourceware.org/pipermail/binutils/2024-May/134157.html >> > Yes, they are the similar issues. Since I just pushed it to the trunk, I'll create a patch to remove it. Thanks, and pre-approved. Jan