public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Cui, Lili" <lili.cui@intel.com>
Cc: "hjl.tools@gmail.com" <hjl.tools@gmail.com>,
	"binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: [PATCH V2] Support APX NF
Date: Mon, 11 Mar 2024 15:09:47 +0100	[thread overview]
Message-ID: <e8488320-e374-4db0-abc7-4181626e1ada@suse.com> (raw)
In-Reply-To: <SJ0PR11MB560015E6F5B866D7443D55699E242@SJ0PR11MB5600.namprd11.prod.outlook.com>

On 11.03.2024 14:54, Cui, Lili wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Friday, March 8, 2024 5:36 PM
>>
>> On 04.03.2024 09:15, Cui, Lili wrote:
>>> @@ -7218,6 +7229,11 @@ parse_insn (const char *line, char *mnemonic,
>> bool prefix_only)
>>>  		  /* {rex2} */
>>>  		  i.rex2_encoding = true;
>>>  		  break;
>>> +		case Prefix_NF:
>>> +		  /* {nf} */
>>> +		  i.has_nf = true;
>>> +		  i.encoding = encoding_evex;
>>> +		  break;
>>
>> It's not quite as easy, I'm afraid: Have you thought of the "{vex} {nf} ..."
>> case? (I think I previously indicated that their combination, actually in either
>> order, needs properly rejecting.) Without having spent much thought on it,
>> perhaps it would suffice to check here that the field is still encoding_default,
>> and leave the value alone otherwise (in order to reject bad combinations
>> elsewhere).
>>
> Oh, good point. Do you think it's ok to report bad outside of "switch"?
> 
>                 case Prefix_NF:
>                   /* {nf} */
>                   i.has_nf = true;
> -                 i.encoding = encoding_evex;
> +                 if (i.encoding == encoding_default)
> +                   i.encoding = encoding_evex;
>                   break;
>                 case Prefix_NoOptimize:
>                   /* {nooptimize} */
>                   i.no_optimize = true;
>                   break;
>                 default:
>                   abort ();
>                 }
> +             if (i.has_nf && i.encoding != encoding_evex)
> +               {
> +                 as_bad (_("{nf} cannot be combined with {vex}/{vex3}"));
> +                 return NULL;
> +               }

Where the checking is done is secondary to me. My primary point is that
the above isn't correct: There are more encoding variants than just
vex, vex3, and evex.

That said, reporting the error right here may lead to multiple identical
errors being reported for a single line of input. This wants avoiding,
at which point placing the check here is ruled out.

>>> --- a/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s
>>> +++ b/gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s
>>> @@ -23,7 +23,7 @@ _start:
>>>  	.insn EVEX.L1.66.M12.W0 0x60, %di, %ax
>>>
>>>  	#EVEX_MAP4 movbe %r18w,%ax set EVEX.z == 0b1.
>>> -	.insn EVEX.L0.66.M12.W0 0x60, %di, %ax {%k7}{z}
>>> +	.insn EVEX.L0.66.M12.W0 0x60, %di, %ax {%k3}{z}
>>
>> What's going on here ...
>>
>>> @@ -33,17 +33,25 @@ _start:
>>>  	.insn EVEX.L1.NP.0f38.W1 0xf5, %rax, (%rax,%rbx), %rcx
>>>
>>>  	#EVEX from VEX bzhi %rax,(%rax,%rbx),%rcx EVEX.P[23](EVEX.z) ==
>> 0b1
>>> -	.insn EVEX.L0.NP.0f38.W1 0xf5, %rax, (%rax,%rbx), %rcx {%k7}{z}
>>> +	.insn EVEX.L0.NP.0f38.W1 0xf5, %rax, (%rax,%rbx), %rcx {%k3}{z}
>>
>> ... and here? This is the kind of thing that wants mentioning in the patch
>> description. And once again, especially for larger patches it is generally a bad
>> idea if they come with only legacy ChangeLog entries:
>> These only say "what", never "why". (That said, I think I see why the change is
>> needed.)
> 
> Do you remember that you asked a bad report for illegal use of nf bit?

Yes.

> When we use K7 it sets the nf bit, not wanting to lose their original testing purpose due to the interception of nf, I adjusted its value.

Yes. What's missing is an explanation for the need of this in the patch
description. Without this you made me work out what this change is about,
when otherwise I would have had to merely check that what you say fits
what changes (i.e. me then knowing what exactly to look for).

Jan

  reply	other threads:[~2024-03-11 14:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  8:15 Cui, Lili
2024-03-08  9:36 ` Jan Beulich
2024-03-11 13:54   ` Cui, Lili
2024-03-11 14:09     ` Jan Beulich [this message]
2024-03-12  6:12       ` Cui, Lili
2024-03-12  7:46         ` Jan Beulich
2024-03-12  8:51           ` Cui, Lili
2024-03-12 13:22   ` Cui, Lili
2024-03-12 13:53     ` Jan Beulich
2024-03-13  2:54       ` Cui, Lili
2024-03-13  7:36         ` Jan Beulich
2024-03-18 11:21           ` Cui, Lili
2024-03-18 11:50             ` Jan Beulich
2024-03-18 13:43               ` Cui, Lili
2024-03-19  1:24         ` Cui, Lili
2024-03-08 10:40 ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8488320-e374-4db0-abc7-4181626e1ada@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=lili.cui@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).