From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id A984D3846410 for ; Thu, 25 Apr 2024 13:22:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A984D3846410 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 A984D3846410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714051365; cv=none; b=eFl/441+F3VIjfEVstjzd1smJqZqo5rT7h2Ua7vDFmqldb4ZfWdgSmzCF1pn876tuLEoxIamooyvihLwsU4Ti35U7sOFcd3nKLg4fTQqobqZsGHsG/di0CLZS38Aypgw0F0F9Qh3ZgyGt1sgXaIHZrCPYpeJovsBwgNxp9TYSZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714051365; c=relaxed/simple; bh=q3EcoesuNE8EUvEDwXlBZD46n7V7IwlzprehnmGIWUw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=XTXzF4qefNJq6gDb3nmKABlgJV+3J+TDO83mGyPc+SoUeVFqPs6dSvApkScJmVfjtA/DPJ0evxe5b3IlwihDOQcp+Q0Zwj3r41AI/o5M7A30/vv97ITE9/xqkGDT/XJhHPplCMJrVMigNHml8CKy5aRdvjKEXZpZjw+gNsL1pkQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a55b2f49206so363405066b.1 for ; Thu, 25 Apr 2024 06:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1714051362; x=1714656162; 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=scYmAxFQiX2t+pmZd37VfqIvf9iDh0EdUlN68NdzOOQ=; b=FIj8IzS/NV8zy+AeILzAB4X3CcsdcT1Qq1MNBsDCJGX2lrvTqhScq6DehXtopUnpop /n6Ba2hTF5CiTod/5VW/rbIBXAhr0PKriX9QXrllmMI0OjVHCRlo2dMpYW3gsFeE4D5p kpgdJ01zkHZ/VX66wCv+PylRK9zGAo+ZMfDnigGUCJdh22ehSlR6Nnvc93PFvKbm6Xs+ nZcJ02o6UHTyudRkV7x5cmtDmibwDE19J4xDdGdzkc7WufLsytvI4tJnf4AxRTz5jNw3 ldqMztXqCOzXZJz+UXfDk/D+vkYxcVuVZ7ULYCQ3CzI+Csd5lTSHZGLuvufAX+MefSGM FwGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714051362; x=1714656162; 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=scYmAxFQiX2t+pmZd37VfqIvf9iDh0EdUlN68NdzOOQ=; b=J5Pv1mGkd3+YBrhqk5fTQAvnpDA3+6XxkeWRdg4a+iN+bUi7Lp+7oniqDXvw7SX+Nc bEo1W1LHf3exS8lSAKPcWNL/BdXhdKIQDVlCNUp/d+MEBoXQ5/3OP08NNhqVv7cchoh4 Kw8XW76N7zPj4zvJnj7myBzByW7+inJVJe+9IrqlIFWOVNhtRwgRzYIyPGqIxKecsgjG hCx1/HRJPSQVFk2Gq1sdFceaRcoF4869XMLejcOCIgnIYLNKtnKdjl/mFbFWBd7gTXY1 r0zUkD5vjxkkCIPUW0wU3sKAcxRn+w0N8YX80wJr6kJ+yTzDUujsU9r51EmRa/erTKOD YaVA== X-Forwarded-Encrypted: i=1; AJvYcCXQ71ScnhsNHdQtiEmFetauwsUgIPTq5cfoiYUxjm6NDo4aRebBD7A9/mTty3cu0mf1BssEhihTInky40/cYVHB/MGg5aEUiQ== X-Gm-Message-State: AOJu0YxK4zKUlQcoSQmS5il0aaG5cyTuZXwpYY+5TiNCGmojl635zC44 nIcbOEdl2rKvKbRd9Ep1HPJvhzmkHwN/OQ7gBw5TUsjNS9dGLPqJBllZP/ELNg== X-Google-Smtp-Source: AGHT+IGFXq2gkd+ob4tXfvZQoACiOdaf954yBDq/zcwWCGkw30i9AbIkQIl/y8ZTELdGsx+qqX3Juw== X-Received: by 2002:a17:906:ecb4:b0:a58:c09a:71bf with SMTP id qh20-20020a170906ecb400b00a58c09a71bfmr443429ejb.38.1714051362085; Thu, 25 Apr 2024 06:22:42 -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 lk19-20020a170906cb1300b00a526418d0ebsm9532218ejb.74.2024.04.25.06.22.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Apr 2024 06:22:41 -0700 (PDT) Message-ID: Date: Thu, 25 Apr 2024 15:22:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] x86: Use vexvvvv to encode the vvvv register Content-Language: en-US To: "Cui, Lili" Cc: "hjl.tools@gmail.com" , "binutils@sourceware.org" References: <20240424072356.2433122-1-lili.cui@intel.com> <20240424072356.2433122-2-lili.cui@intel.com> <8a239b53-b713-473d-a8c4-87e28ec407cd@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3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PMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+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=-3025.0 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 25.04.2024 15:14, Cui, Lili wrote: >> On 24.04.2024 09:23, Cui, Lili wrote: >>> --- a/gas/config/tc-i386.c >>> +++ b/gas/config/tc-i386.c >>> @@ -5045,7 +5045,7 @@ optimize_encoding (void) >>> */ >>> i.tm.opcode_space = SPACE_0F; >>> i.tm.base_opcode = 0x6c; >>> - i.tm.opcode_modifier.vexvvvv = 1; >>> + i.tm.opcode_modifier.vexvvvv = VexVVVV_SRC1; >>> >>> ++i.operands; >>> ++i.reg_operands; >>> @@ -10432,19 +10432,19 @@ build_modrm_byte (void) >>> || i.encoding == encoding_evex)); >>> } >>> >>> - if (i.tm.opcode_modifier.vexvvvv == VexVVVV_DST) >>> + switch (i.tm.opcode_modifier.vexvvvv) >>> { >>> - v = dest; >>> - dest-- ; >>> - } >>> - else >>> - { >>> - for (v = source + 1; v < dest; ++v) >>> - if (v != reg_slot) >>> - break; >>> - if (v >= dest) >>> - v = ~0; >> >> Replacing this by ... >> >>> - } >>> + case VexVVVV_SRC1: >>> + v = dest - 1; >>> + break; >> >> ... just this could do with a word of explanation in the (sadly once again empty) >> description. While I'm sure this tests out okay for you, it's not immediately clear >> why the loop can be replaced this easily. Whereas by the end of the series (with >> SwapSources dropped) this simplification is pretty obvious. >> > > SDM said "VEX.vvvv encodes the first source register operand". It should be "dest -1". The old logic did not check vexvvvv first, which made the logic here very complicated. I'll add some comments here. > >> As to the deecription once again being empty: This is even more of an issue >> considering that the title suggests the patch isn't doing anything. >> After all we already use vexvvvv for the stated purpose. > > The title is "Use vexvvvv to encode the vvvv register", which means that use vexvvvv for the stated purpose. Well, yes and no: We did so before already, so the title suggests "no change". >>> vpgatherqq, 0x6691, AVX2, Modrm|Vex256|Space0F38|Src1VVVV|VexW1|SwapSources|NoSuf|VecSIB2 >> 56, { RegYMM, Qword|Unspecified|BaseIndex, RegYMM } >> >> Anything using SwapSources wants leaving alone in this patch. There's no point >> touching any of these twice (here and when subsequently you replace >> SwapSources). >> That'll also help to limit patch size a little. >> > > If we keep the old value VexVVVV here, we still need to deal with it in tc-i386.c and i386-opc.h, which is a bit strange. VexVVVV without a value is the same as Src1VVVV, hence I don't think tc-i386.c would be affected by leaving those in place. Jan