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: Tue, 12 Mar 2024 08:46:58 +0100 [thread overview]
Message-ID: <874c75bf-5a07-406f-bd05-96a30d329c8f@suse.com> (raw)
In-Reply-To: <SJ0PR11MB56003A164C567DB1A86BB4C19E2B2@SJ0PR11MB5600.namprd11.prod.outlook.com>
On 12.03.2024 07:12, Cui, Lili wrote:
>
>
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Monday, March 11, 2024 10:10 PM
>> To: Cui, Lili <lili.cui@intel.com>
>> Cc: hjl.tools@gmail.com; binutils@sourceware.org
>> Subject: Re: [PATCH V2] Support APX NF
>>
>> 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.
>>
>
> Sorry, I didn’t get you here, do you think the current implementation is wrong? I think for parse_insn stage i.encodin only has those encoding variants,
Hmm, you're right - operands weren't parsed yet at this point. While ...
> do you think we need to move further back? Maybe put them together with REX/REX2 prefix checking?
>
> /* Check for explicit REX prefix. */
> if (i.prefix[REX_PREFIX] || i.rex_encoding)
> {
> as_bad (_("REX prefix invalid with `%s'"), insn_name (&i.tm));
> return;
> }
>
> /* Check for explicit REX2 prefix. */
> if (i.rex2_encoding)
> {
> as_bad (_("{rex2} prefix invalid with `%s'"), insn_name (&i.tm));
> return;
> }
... this would overall seem to be a more logical place to have such checks,
I'd like to take back my earlier comment then: By having the check in
parse_insn(), .insn handling is then also covered right away.
Jan
next prev parent reply other threads:[~2024-03-12 7:47 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
2024-03-12 6:12 ` Cui, Lili
2024-03-12 7:46 ` Jan Beulich [this message]
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=874c75bf-5a07-406f-bd05-96a30d329c8f@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).