From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id D17F63858C2C for ; Mon, 8 Jan 2024 10:38:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D17F63858C2C 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 D17F63858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704710295; cv=none; b=SSspVII73jKbZf0eT3soDFG422J80lSNgjLCLZCkU/P+VED96Z1oD/dN1gNoZDGQG10sn67GIl33dse4l1bXV5Rv2IUSLt6n4wMt93fUZk/QDhNw7wPeAZ0g3Mj48oPsoZwqTxl1n2gj1LwiVBwEk7D7fJ7//3l7STjF7JTbqe8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704710295; c=relaxed/simple; bh=yhGHVuik7vfXhYjzorwUHwqE/EfnRiCYUFmbZZC8HdE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=qgTvyFjBJpNR1Q8FuPqkI93H0LzJ2EhJsQc61xwuW+l/AP/msPMWTd9MNgdqWPmb8qkscuZbG9epN+NEqFqKcdk1LyVpoNNSXeuSpbEUWn3GZ5acZYOIYk5PMS0ftdzll53RHixsg8Pll9DY0g1GL4s6AgtnnivQFwrc0SZWIqo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2cd56dac1adso7166691fa.2 for ; Mon, 08 Jan 2024 02:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1704710291; x=1705315091; 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=WyAWLXfYI56BQF7/VHzycPTNc1YuxllGC1Fb0tX+W/c=; b=X/MKI7f2D6Kh5eKlqbceHhDBHo0mqoKF4wXPo6IjSH/sp+6Q+cNNN/ny6JIWUj0Hte 080YJjT7p10/rmhf+vjEao34wiRrLQVAU/FF+BcdA9BRM78Ip67LRL4uV3sfn2FcSUBj 8VzuFrmTdtXSDybYIx+8mzpe2jFfvt94mbQ37GWuvVBg99DfOZwmQ/Lhfbbd5OSgtzDq ujPJf+Xx3kp/21IxQv0DsRAsJ65tnU/y5bLJHM2RilDRfIl+IFma7xB86vdBSs791Eno pNfz47PdJvPEI8DUW0tEGaHJwlq8fcsEnz4HpNpQlZrDecoMJ3KHkPySHmQOa8N1Uo5R 6AGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704710291; x=1705315091; 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=WyAWLXfYI56BQF7/VHzycPTNc1YuxllGC1Fb0tX+W/c=; b=me8JY7/rqLM4jkHTObu/nl0gyvL0/poZgnhY2HyxZxnCMYcg7BmYYKU2ohouFHvZ5Q 0JV09Da/He7Io3JtL20B0vEh1jWSS6d9GH8QfZ6YCiSFt1bWeMdLjLz2M1fj2V7v61Ta O7CmUwvZAuO4PYOARA3Dznz4dD/NcfYRuTVVEyfHhNkcvw5D1oOsVukzkjqYpFqsN9qd gqsur8/SbIoWIHxxlQAEdKfMglqRr3sUA8sO6He/EuXUn3GSK6n0mOSa2lgN0wY8wq1Q sF62nV7RKlTZcYzrSey+QdgjIKy/XPfZho4GYVoPvcou0dN6m2VQHbmjnX098lyD+OHQ LeEA== X-Gm-Message-State: AOJu0YxCYhtQgN9yP5bcEMcRYyD8jNAt1nIpe1/xYvk/p4oou/Evk/fy tv/hv7bB5PvB5dpdZqlWMkJy+bhBr7QS X-Google-Smtp-Source: AGHT+IFAGWsSCu6uG4XPVMuOV71FaRG3l0p9gvGiZoi9HHNpLY1WLgDvazwokRjCgArg32s+FrrJ3g== X-Received: by 2002:a05:651c:10a2:b0:2cd:32db:1377 with SMTP id k2-20020a05651c10a200b002cd32db1377mr1469501ljn.47.1704710291380; Mon, 08 Jan 2024 02:38:11 -0800 (PST) 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 x4-20020a92de04000000b0036062f40c51sm2397357ilm.71.2024.01.08.02.38.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jan 2024 02:38:10 -0800 (PST) Message-ID: <10f488d4-3a7b-49f4-b288-6486c42b5433@suse.com> Date: Mon, 8 Jan 2024 11:38:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86: add missing APX logic to cpu_flags_match() Content-Language: en-US To: "Cui, Lili" Cc: "H.J. Lu" , Binutils References: <8662338c-e85a-4b84-a941-31170794dfe5@suse.com> <11d23d18-142c-4c32-bab2-6ddfd9257051@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJ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085mBDZCH5Kx0cl0HVJuQKC+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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 08.01.2024 11:28, Cui, Lili wrote: >> On 08.01.2024 09:30, Cui, Lili wrote: >>>>>> --- a/gas/config/tc-i386.c >>>>>> +++ b/gas/config/tc-i386.c >>>>>> @@ -1940,6 +1940,30 @@ cpu_flags_match (const insn_template *t) >>>>>> any.bitfield.cpuavx512vl = 0; >>>>>> } >>>>>> } >>>>>> + >>>>>> + /* Dual non-APX/APX templates need massaging from what >>>>>> + APX_F() in >>>> the >>>>>> + opcode table has produced. While the direct transformation of the >>>>>> + incoming cpuid&(cpuid|APX_F) would be to cpuid&(cpuid) / >>>>>> cpuid&(APX_F) >>>>>> + respectively, it's cheaper to move to just cpuid / cpuid&APX_F >>>>>> + instead. */ >>>>>> + if (any.bitfield.cpuapx_f >>>>>> + && (any.bitfield.cpubmi || any.bitfield.cpubmi2 >>>>>> + || any.bitfield.cpuavx512f || any.bitfield.cpuavx512bw >>>>>> + || any.bitfield.cpuavx512dq || any.bitfield.cpuamx_tile >>>>>> + || any.bitfield.cpucmpccxadd)) >>>>>> + { >>>>>> + /* These checks (verifying that APX_F() was properly used in the >>>>>> + opcode table entry) make sure there's no need for an "else" to >>>>>> + the "if()" below. */ >>>>>> + gas_assert (!cpu_flags_all_zero (&all)); >>>>>> + cpu = cpu_flags_and (all, any); >>>>>> + gas_assert (cpu_flags_equal (&cpu, &all)); >>>>>> + >>>>>> + if (need_evex_encoding (t)) >>>>>> + all = any; >>>>>> + >>>>> >>>>>> + memset (&any, 0, sizeof (any)); >>>>> >>>>> Wouldn't it make sense to put it in the else branch and clean out >>>>> APX-F >>>> specifically? Just like you did before. >>>>> >>>>> if (need_evex_encoding (t)) >>>>> all = any; >>>>> else >>>>> any.bitfield.cpuapx_f = 0; >>>> >>>> That was an alternative I did consider, yes, but the way I've done it >>>> is overall more self-consistent imo, at the expense of being less >>>> consistent with the >>>> AVX/AVX512 logic (the moving of "any" to "all" isn't consistent with >>>> that anyway). >>>> >>> >>> memset (&any, 0, sizeof (any)); >>> >>> I'd say this would make "any" not match the actual value, which might be >> used later, but it's been cleared here. >> >> I'm afraid I don't get what you're trying to tell me. >> > > What I mean is that memset will clear the variable "any", there is no problem in handling it this way. But I think the following way is more reasonable. > > For evex it should be: > any.bitfield.cpubmi = 1 > any.bitfield.cpuapx_f = 1 > > For vex it should be: > any.bitfield.cpubmi = 1 > any.bitfield.cpuapx_f = 0 > > Instead of clearing all values in "any". But why would you want to have the same in "any" that you already have in "all"? That would incur extra checks later in the function for no gain. Jan