From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 8D428385840D for ; Wed, 24 Apr 2024 07:15:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D428385840D 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 8D428385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713942949; cv=none; b=Deg9U800wmQPaZgM+maW+3v5LgXQKy9HWlCQB64taQr9L4Szt0tAbPujrSvzWCHWRh+uVbNiSq6cIowHsKF27LWFlMfLQ9iSeaCjB2tZxGtiG7vYw/vHk5OtkCsiFqL+138nYfhBDHnRE/xzmm0+poNdvd0pgUp4WFOHLbqsQbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713942949; c=relaxed/simple; bh=dkxiX2bjVyYDngRvATMeJnvtwAFL9JIaviWtbKBZbdo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=RN9V5ayyfk0ROA0bJ7flJiZ7w1C+E8UipyUy5RC3zYe6RbjVRqa77tSPCbC539v2plbAxgveAimE3TVwS3ypiLIXu4UP3GfMs5xaCWzdGIG+ILJMo4CZn+AtiQ1gNyGYwjk7swVFOZRMBu/GIktbZjrzh0U1oIBvymFeQwWNYwE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41a4f291f80so26038615e9.1 for ; Wed, 24 Apr 2024 00:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713942946; x=1714547746; 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=9nK0gasmDG2AXEwJ99qDoKMHErqeNf297Sv73W8mwOM=; b=JLvvj6YqRQm8Hwq5hkM7EAOIAi0LBi+rdXKEQv8XEl78GXQQvLxdZDSNEWBlHGBwoL azw+T2Ib6zJlhiX1hnQkOyah4LxW6mtKihEvNBfQe45mpc9P7df2No3CPnt/JBJKl4R+ mrwUkscDEgdDK+3fco1E2JQEnN0Dl2GLFVxmL092r2kISWzMlW8PepC+QPBavbTXVma8 gug6O34TUC3Imha3GStZTSEb5fy4GGlIgcYCdYBewnx3BSvgxE+T/ulqITDL8HqrO0jK l2Ad8OEhh8kcERVEO2LysPATdPua6rTN298nVwVVAIjGSrAZUMlDBCufkTnJe2Gg49WE uZ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713942946; x=1714547746; 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=9nK0gasmDG2AXEwJ99qDoKMHErqeNf297Sv73W8mwOM=; b=udv5bd1IWsoUZ99MRFj5vIEdyjBSs3bHn1sUqYBuYwfUdUZbctNIPFDYyaHEpEVNhn RaYYbb5IW72veZ3K+AmeHZD/TsaZlpuLvyuiElZUDGmgPuZjKl2YZ+Pbk5EhbKKfoT/D 4diPN19P5Jyajaf9+wdBHYiTvKzS4gmop8r9ClvxFffiS19JuZaIPuT6TkFrhjnqzRaW 7p0T9FE0En4rsvkZVuPQNq5itNGaR3wqNw9nZ+nquciKNnc7gf2trVnDCBtugr/jd75S nElSrW7r+lkZY+8NhqfEodqVwihLwaUaA7I1uFBrbexgqHu7SJngX/oqan7913oDqo/5 /4oA== X-Forwarded-Encrypted: i=1; AJvYcCVWitsmSKGSu7mTghSuFtUGg/iBu4mj0s/yWrfWd/J8SooSUcj4ySqdaWa01q0U6GxfZgRzRCoyP48nXj1a6iM3kkIk5QR78g== X-Gm-Message-State: AOJu0YwJddj5vQJWb06PG2UKKqGu6z0HtlDppKNYy8oLfjkifPlJIJjU yEENy7nOWfk1SE2px+da/ZExzklHh5WZq4+2Ga8MY6DVDS4WxQjAXRSNfG6oxA== X-Google-Smtp-Source: AGHT+IGE4VNhk+xQ42N2jvh8LVjxxtmvaLd2/zV5PzUMSYAP4EBJ1w2xAihH7/EDwM243WXCbUbOqA== X-Received: by 2002:a05:6000:18c2:b0:341:ce05:dba5 with SMTP id w2-20020a05600018c200b00341ce05dba5mr1053111wrq.30.1713942946068; Wed, 24 Apr 2024 00:15:46 -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 s9-20020a05600c384900b0041b0c3879c3sm681724wmr.26.2024.04.24.00.15.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Apr 2024 00:15:45 -0700 (PDT) Message-ID: <56656107-d953-4a66-aa25-d90c8e9a4c5d@suse.com> Date: Wed, 24 Apr 2024 09:15:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] x86: zap value-less Disp8MemShift from non-EVEX templates Content-Language: en-US To: "Cui, Lili" Cc: "H.J. Lu" , Binutils References: <41696d73-4114-4adc-8491-bffddc5d72cc@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0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H+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 24.04.2024 08:49, Cui, Lili wrote: >> In order to allow to continue to use templatized SSE2AVX templates when >> enhancing those to also cover eGPR usage, Disp8MemShift wants using to >> deviate from what general template attributes supply. That requires using >> Disp8MemShift in a way also affecting non-EVEX templates, yet having this >> attribute set would so far implicitly mean EVEX encoding. >> Recognize the case and instead zap the attribute if no other attribute >> indicates EVEX encoding. >> > > I'm confused about this patch, is it related to the movsd template? You removed the "Masking" for it and only left Disp8MemShift, but I thought it still belongs to EVEX template. > > +movsd, 0xf210, AVX512F, D|Modrm|EVexLIG|Space0F|VexW1|Disp8MemShift=3|NoSuf|SSE2AVX, { Qword|Unspecified|BaseIndex, RegXMM } There's no "masking" in an SSE2AVX template. Use of masking in a legacy-form input instruction is simply wrong, and wants rejecting. >> --- a/opcodes/i386-gen.c >> +++ b/opcodes/i386-gen.c >> @@ -1126,6 +1126,7 @@ process_i386_opcode_modifier (FILE *tabl >> char **opnd, int lineno, bool rex2_disallowed) { >> char *str, *next, *last; >> + bool disp8_shift_derived = false; >> bitfield modifiers [ARRAY_SIZE (opcode_modifiers)]; >> static const char *const spaces[] = { #define SPACE(n) [SPACE_##n] = #n >> @@ -1190,7 +1191,10 @@ process_i386_opcode_modifier (FILE *tabl >> if (strcasecmp(str, "Broadcast") == 0) >> val = get_element_size (opnd, lineno) + BYTE_BROADCAST; >> else if (strcasecmp(str, "Disp8MemShift") == 0) >> - val = get_element_size (opnd, lineno); >> + { >> + val = get_element_size (opnd, lineno); >> + disp8_shift_derived = true; >> + } >> >> set_bitfield (str, modifiers, val, ARRAY_SIZE (modifiers), >> lineno); >> @@ -1243,13 +1247,21 @@ process_i386_opcode_modifier (FILE *tabl >> >> /* Rather than evaluating multiple conditions at runtime to determine >> whether an EVEX encoding is being dealt with, derive that information >> - right here. A missing EVex attribute means "dynamic". */ >> - if (!modifiers[EVex].value >> - && (modifiers[Disp8MemShift].value >> - || modifiers[Broadcast].value >> + right here. A missing EVex attribute means "dynamic". There's one >> + exception though: A value-less Disp8MemShift needs zapping rather than >> + respecting if no other attribute indicates EVEX encoding. This is for >> + certain SSE2AVX templatized templates to work reasonably. */ if >> + (!modifiers[EVex].value) >> + { >> + if (modifiers[Broadcast].value >> || modifiers[Masking].value >> - || modifiers[SAE].value)) >> - modifiers[EVex].value = EVEXDYN; >> + || modifiers[SAE].value) >> + modifiers[EVex].value = EVEXDYN; >> + else if (disp8_shift_derived) >> + modifiers[Disp8MemShift].value = 0; >> + else if (modifiers[Disp8MemShift].value) >> + modifiers[EVex].value = EVEXDYN; >> + } >> > > Why not just delete the Disp8MemShift? Maybe I missed something. > > if (!modifiers[EVex].value > && (modifiers[Broadcast].value > || modifiers[Masking].value > || modifiers[SAE].value)) > modifiers[EVex].value = EVEXDYN; There are templates where Disp8MemShift is the only indication of EVEX encoding, e.g. VMOVNTDQ and VMOVNTDQA. Those could all gain EVexDYN (I think), but that would be a somewhat more intrusive change then. I'm willing to be convinced of going that route (assuming it actually would work out). Jan