From: "Hu, Lin1" <lin1.hu@intel.com>
To: "Beulich, Jan" <JBeulich@suse.com>, "Cui, Lili" <lili.cui@intel.com>
Cc: "Lu, Hongjiu" <hongjiu.lu@intel.com>,
"binutils@sourceware.org" <binutils@sourceware.org>
Subject: RE: [PATCH V5 8/9] Support APX NDD optimized encoding.
Date: Mon, 8 Jan 2024 02:49:12 +0000 [thread overview]
Message-ID: <SJ0PR11MB5940611117DC195A14D39009A66B2@SJ0PR11MB5940.namprd11.prod.outlook.com> (raw)
In-Reply-To: <416c0efb-8cc0-4f5b-9bbe-177a21226a77@suse.com>
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, January 5, 2024 10:36 PM
> To: Cui, Lili <lili.cui@intel.com>
> Cc: Lu, Hongjiu <hongjiu.lu@intel.com>; Hu, Lin1 <lin1.hu@intel.com>;
> binutils@sourceware.org
> Subject: Re: [PATCH V5 8/9] Support APX NDD optimized encoding.
>
> On 28.12.2023 02:27, Cui, Lili wrote:
> > @@ -7754,6 +7804,60 @@ match_template (char mnem_suffix)
> > i.memshift = memshift;
> > }
> >
> > + /* If we can optimize a NDD insn to legacy insn, like
> > + add %r16, %r8, %r8 -> add %r16, %r8,
> > + add %r8, %r16, %r8 -> add %r16, %r8, then rematch template.
> > + Note that the semantics have not been changed. */
> > + if (optimize
> > + && !i.no_optimize
> > + && i.vec_encoding != vex_encoding_evex
> > + && t + 1 < current_templates.end
> > + && !t[1].opcode_modifier.evex
> > + && t[1].opcode_space <= SPACE_0F38
> > + && t->opcode_modifier.vexvvvv == VexVVVV_DST
> > + && (i.types[i.operands - 1].bitfield.dword
> > + || i.types[i.operands - 1].bitfield.qword))
>
> While you check the last operand's type here, ...
>
> > + {
> > + unsigned int match_dest_op = can_convert_NDD_to_legacy (t);
> > +
> > + if (match_dest_op != (unsigned int) ~0)
> > + {
> > + size_match = true;
> > + /* We ensure that the next template has the same input
> > + operands as the original matching template by the first
> > + opernd (ATT). To avoid someone support new NDD insns and
> > + put it in the wrong position. */
> > + overlap0 = operand_type_and (i.types[0],
> > + t[1].operand_types[0]);
> > + if (t->opcode_modifier.d)
> > + overlap1 = operand_type_and (i.types[0],
> > + t[1].operand_types[1]);
> > + if (!operand_type_match (overlap0, i.types[0])
> > + && (!t->opcode_modifier.d
> > + || !operand_type_match (overlap1, i.types[0])))
> > + size_match = false;
>
> .. why is it the first one's here? That may be a memory operand, which in AT&T
> mode cannot possibly have a size.
>
These two places serve different purposes, I check last operand is for 8/16-bit operand don't have zero_upper (you mentioned). If the insn is a NDD insn, it's last operand must be a register operand, so it doesn't have the problem about memory operand.
The reason for checking the first operand is stated in the comment; it doesn't need to care about the size. It ensure the original matching template have same input like the next template (exclude the last operand). Because the original template is a NDD template and the next template is it's legacy version (If the future developer put them in right order).
BRs,
Lin
next prev parent reply other threads:[~2024-01-08 2:49 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 1:27 [PATCH V5 0/9] Support Intel APX EGPR Cui, Lili
2023-12-28 1:27 ` [PATCH V5 1/9] Support APX GPR32 with rex2 prefix Cui, Lili
2023-12-28 1:53 ` H.J. Lu
2024-01-04 8:02 ` Jan Beulich
2024-01-04 11:27 ` Cui, Lili
2024-01-05 14:45 ` Jan Beulich
2024-01-08 3:41 ` Cui, Lili
2023-12-28 1:27 ` [PATCH V5 2/9] Created an empty EVEX_MAP4_ sub-table for EVEX instructions Cui, Lili
2023-12-28 1:54 ` H.J. Lu
2023-12-28 1:27 ` [PATCH V5 3/9] Support APX GPR32 with extend evex prefix Cui, Lili
2023-12-28 1:54 ` H.J. Lu
2023-12-28 13:48 ` Cui, Lili
2023-12-28 1:27 ` [PATCH V5 4/9] Add tests for " Cui, Lili
2023-12-28 1:54 ` H.J. Lu
2023-12-28 1:27 ` [PATCH V5 5/9] Support APX NDD Cui, Lili
2023-12-28 1:55 ` H.J. Lu
2023-12-28 1:27 ` [PATCH V5 6/9] Support APX Push2/Pop2 Cui, Lili
2023-12-28 1:55 ` H.J. Lu
2023-12-28 1:27 ` [PATCH V5 7/9] Support APX pushp/popp Cui, Lili
2023-12-28 1:56 ` H.J. Lu
2023-12-28 1:27 ` [PATCH V5 8/9] Support APX NDD optimized encoding Cui, Lili
2023-12-28 1:56 ` H.J. Lu
2024-01-05 14:36 ` Jan Beulich
2024-01-08 2:49 ` Hu, Lin1 [this message]
2023-12-28 1:27 ` [PATCH V5 9/9] Support APX JMPABS for disassembler Cui, Lili
2023-12-28 1:56 ` H.J. Lu
2024-01-05 12:08 ` Jan Beulich
2024-01-08 2:32 ` Hu, Lin1
2024-01-08 7:41 ` Jan Beulich
2024-01-08 7:44 ` Hu, Lin1
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=SJ0PR11MB5940611117DC195A14D39009A66B2@SJ0PR11MB5940.namprd11.prod.outlook.com \
--to=lin1.hu@intel.com \
--cc=JBeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=hongjiu.lu@intel.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).