From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id CAF5D3858D1E for ; Wed, 22 May 2024 05:49:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CAF5D3858D1E 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 CAF5D3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716356965; cv=none; b=WBbXJ4fNgASVUIvtmqUZnSPAmCYP8vB26T6jTicpTteNod5E0sU/cZmq3Kt/10hs8NF7IxiTwNTrwgFf3UgR25b5GpuiOlyTU4zxeEu40YgYKsl95VCr60+XP3cvCkf/7nLfPWeyOm0+D09XHWhMBZzlp0hJ930R1jPkVFLhQBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716356965; c=relaxed/simple; bh=1NmXyogoMF/i4zbs2a3FmhbBE9miJnDzIlTS1qcjPmo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=sdUJdMhckHJVzhgh/ZJIElQ1ezdVD+efaMeWHRcE5kBLKERlwRMgnQfr9GbqNouxWVoHRgk6Pglia/5YfJid32a75vSId78ufuL6+VPEo8pPRxUldJLpt3exZgyM9g889C9Zn0WyQXnah5Bcd347y0+WIKiOl2HMjR+Fy7jS29M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a5a2c05006aso498514366b.0 for ; Tue, 21 May 2024 22:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716356962; x=1716961762; 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=iu1gPlVT5kqN4T9sBvzFzB+MoG5InHpduWt8Ar1SBqQ=; b=Br5bxBF8LGbjs7NQeQoNpgiJ/NQPQt1ImKL2eNb/cu1cn4XUtvRYK1JpFRxwc6t91K al5/MZgOuSUX6TAPMLopH0AsmlOj/5n6DAOCkkXkaBGWJWgR/89t/MEmGO5tJt8Kf1Vq K+4Rqx5wXVff5NGx+9U6k6KYrVs451v+t4t3I3KZB4dKsRkYpN82+3VrGYkq9JR18UtU K9SvKS22Sw0CNU7/dWGvtr2U4ojZzFD2DcZFJu3PHlbWBuSPEb/LKM/OBykMVrdGN9cb ZCNS9nUTOl479G2kapqbycUppQj2ovrs4P5JqHqV5kCnr2fr5OgL3hTvKmIabeT9/RbV 2fIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716356962; x=1716961762; 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=iu1gPlVT5kqN4T9sBvzFzB+MoG5InHpduWt8Ar1SBqQ=; b=mE0VGkL1FQllkNTEbCuvdBiJHgG+7uRaIPcZQ8L73yiduTkAVfW1VFzDhBo8ojnqTl x2kLRvoP94DBbQWi1nXtvu9SH6oKKlKxeO1tYKJcMHs/IriQBwCwA/MxDmtZHuvb7v14 RozLVhssTUPhTnIoPb0vfTfSDKDTgAWscE51nzd68eJzhpE7WtKFKCOVfTSS24tei5Xm 2ZSfXp1XpthnTHFiBBo8EsShJfE3R+3T09Dn7zp3JqoeemhDjFZtFJtQzz5m6eholWl+ 0W8WVVq+Dt0jcRqfXUNjaYeUOYOpliTxYLvMJS8KZ6cTllnTBXo4M+foSg+4yRjQ/mbc EvuA== X-Forwarded-Encrypted: i=1; AJvYcCULjUZYRUt3+Xe57ovsAzm3J04rJHAYeYype4d/eXGYdOlbkoWEQ3MH5CE47Wf61x3YzoRfvxLs4USO75wqhfBv9+8+CiZUBg== X-Gm-Message-State: AOJu0YzPqwC8s0xAx5KCMGgzTo+M75emaRe+rBEcW1GAYKdBKaT8RIyd rzsVA7Z0MHkqKxpicfO7mxf/dWvkOvV5001XsLrxB5S/80XzvKJSDQoM6zkPpQ== X-Google-Smtp-Source: AGHT+IFGB52bccjbXMIDZfYFroovld5UqGXqSzkbR615mJ6CiLVr78m6pJWt9JqkmkmXfEDEEZO3bA== X-Received: by 2002:a50:8d11:0:b0:572:47be:831d with SMTP id 4fb4d7f45d1cf-57832a82d86mr682847a12.20.1716356962188; Tue, 21 May 2024 22:49:22 -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-5733bed0af0sm17730662a12.49.2024.05.21.22.49.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 May 2024 22:49:21 -0700 (PDT) Message-ID: <21daf000-afb4-4b25-a711-8a302140429e@suse.com> Date: Wed, 22 May 2024 07:49:21 +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> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbG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pwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+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 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 Jan