From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 2F5583849AD7 for ; Fri, 19 Apr 2024 09:37:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F5583849AD7 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 2F5583849AD7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713519449; cv=none; b=VtK3sjuMbvwFsjMauLA1s7jAvNGFKsoapP4ZgnydRq2fTAzFWXoXKUEpvxp4TQTMFme4GuJeTn1s6iJLY/OAqdsUydj8QZ8i4iYOUVTDSCh98b3+9NF70LkOM4aWDLkBYwiZ8XbmgVqowsIqhtPon3eBLLVU6TyCte7a0TBmZm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713519449; c=relaxed/simple; bh=q/YJaMSLD96+C8erwBIKGvUWC9AyrwJcxnydt2FBDIw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=LJjQR3zsDACw5PfWbJ7Wo2uElRlW+5JFth500mu6M+JxgjfrE0NABrBUfswT8IJVSM5ALzCnS/6wK6pv+t/B1RXwxwaJLQH0K5HN6gtJ8GqUeR9eV4FwW/NdhPkK7gHNH054eAhrQ3cro9Iz0ihL3GwQp0h/8blNsbls+/cfXzM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-418e4cd2196so13068695e9.1 for ; Fri, 19 Apr 2024 02:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713519446; x=1714124246; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=kpTfi5r1/yjCd458t9S8lmY5JotumcFfDjOEPZNrmFM=; b=c4T2KWgCHCIpShL6t8Z7iYC0WnZYRVX+Wy+KRYHYrmSBwaLTcp1Lu4Mr8quxmmgHgV sxisHVUH3kgSrZfjpu8Ddovzx5gyzohOJfDhsTvDdP56HaPhIIpJa2DPn3RRvzPZaXCl TFS/69G0lU3HOht7gCOHJE+AEe9JqmCk/k0KBnhsVsHMaCPs4exeOwf+0pDoXLmkFvsu MNqONid2K7/uBqvnzDer1XHN1pTXc9IcZ3dvCXShJTHELnan9SH1fizcCJflQT3D3Zez F2lpBy1hoLrwQQ6hrzzUlOIFCepqFdiuefFWxCRvgb3qIy2ggYxrbBGxnjlBmcV7P0FY TG8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713519446; x=1714124246; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kpTfi5r1/yjCd458t9S8lmY5JotumcFfDjOEPZNrmFM=; b=RNzjyH4MTPsbhyarOb4MrZ7iXFgiiWSaXny/1Y3a/+0SSZoWfNIeIlJlpVvAH32zpi ilB/1q0J6t4yNnutEvrGlWTDm9oBEXSrRygnkrY2YeVvqyL4vR5sYsY+p4KkcY8UuXgq L/Viy2BLRfub0+276rWzeLJO0fTgEdxPLPrp4WadlDlyUWF1UBeVEIf2lgjDg+BE3/uI r6s61biAtyjuTz6TfDRQb3/rZnyzjiPJYSm6boMMMPQNdKQI0LNL9yig/hTmwjpFprz1 2guCrytDzG9FePiynCuIe2wLcYvJUDCftvuyj0Z+NK9FFCfVdDgz9nkXL2ShQ5ugHZFf L2rg== X-Gm-Message-State: AOJu0Ywlbe3/vlkk4mwJzcHdGpN4AMuRD5V0/c/Y4TzmvMJ3AeOtJ1ni Bnc+6MRIvDZCA/mfnwMzNUAJFfYQ/hdk0Xm8E8Cyll0O5i6VaGJRcxZV4PazWxbITXh0x/yBlzY = X-Google-Smtp-Source: AGHT+IFgn/ePPZEdGo6biWQ7SIzXnLN9AGKoUV8Ikh+br+GBccmD0l5c+L+mjUfnhia8m2nB3GoR3g== X-Received: by 2002:a05:600c:524c:b0:418:d0fe:987b with SMTP id fc12-20020a05600c524c00b00418d0fe987bmr843679wmb.11.1713519445991; Fri, 19 Apr 2024 02:37:25 -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 b15-20020a05600c4e0f00b00418fdcc7168sm2940685wmq.2.2024.04.19.02.37.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 02:37:25 -0700 (PDT) Message-ID: <41696d73-4114-4adc-8491-bffddc5d72cc@suse.com> Date: Fri, 19 Apr 2024 11:37:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 1/4] x86: zap value-less Disp8MemShift from non-EVEX templates Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebw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BDZCH5Kx0cl0HVJuQKC+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: 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. No change in generated tables. --- This could be folded into the subsequent "x86/APX: extend SSE2AVX coverage", but I think it's better kept separate for being a little subtle. --- 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; + } /* Vex, legacy map2 and map3 and rex2_disallowed do not support EGPR. For templates supporting both Vex and EVex allowing EGPR. */