From: "Cui, Lili" <lili.cui@intel.com>
To: "Beulich, Jan" <JBeulich@suse.com>
Cc: "hjl.tools@gmail.com" <hjl.tools@gmail.com>,
"binutils@sourceware.org" <binutils@sourceware.org>
Subject: RE: [PATCH 1/3] x86: Use vexvvvv to encode the vvvv register
Date: Thu, 25 Apr 2024 13:14:24 +0000 [thread overview]
Message-ID: <SJ0PR11MB560045EC9F0BD5C396BCBEE69E172@SJ0PR11MB5600.namprd11.prod.outlook.com> (raw)
In-Reply-To: <8a239b53-b713-473d-a8c4-87e28ec407cd@suse.com>
> On 24.04.2024 09:23, Cui, Lili wrote:
> > gas/ChangeLog:
> >
> > * config/tc-i386.c (optimize_encoding): Replaced 1 with VexVVVV_SRC1.
> > (build_modrm_byte): Used vexvvvv to encode the vvvv register.
> > (s_insn): Replaced 1 with VexVVVV_SRC1.
> >
> > opcodes/ChangeLog:
> >
> > * i386-opc.h (VexVVVV_DST): Adjusted the value.
> > (VexVVVV_SRC1): New.
> > * i386-opc.tbl: Replaced VexVVVV with VexVVVV_SRC1.
>
> Not quite: You replace by Src1VVVV now.
>
OK.
> > --- a/gas/config/tc-i386.c
> > +++ b/gas/config/tc-i386.c
> > @@ -5045,7 +5045,7 @@ optimize_encoding (void)
> > */
> > i.tm.opcode_space = SPACE_0F;
> > i.tm.base_opcode = 0x6c;
> > - i.tm.opcode_modifier.vexvvvv = 1;
> > + i.tm.opcode_modifier.vexvvvv = VexVVVV_SRC1;
> >
> > ++i.operands;
> > ++i.reg_operands;
> > @@ -10432,19 +10432,19 @@ build_modrm_byte (void)
> > || i.encoding == encoding_evex));
> > }
> >
> > - if (i.tm.opcode_modifier.vexvvvv == VexVVVV_DST)
> > + switch (i.tm.opcode_modifier.vexvvvv)
> > {
> > - v = dest;
> > - dest-- ;
> > - }
> > - else
> > - {
> > - for (v = source + 1; v < dest; ++v)
> > - if (v != reg_slot)
> > - break;
> > - if (v >= dest)
> > - v = ~0;
>
> Replacing this by ...
>
> > - }
> > + case VexVVVV_SRC1:
> > + v = dest - 1;
> > + break;
>
> ... just this could do with a word of explanation in the (sadly once again empty)
> description. While I'm sure this tests out okay for you, it's not immediately clear
> why the loop can be replaced this easily. Whereas by the end of the series (with
> SwapSources dropped) this simplification is pretty obvious.
>
SDM said "VEX.vvvv encodes the first source register operand". It should be "dest -1". The old logic did not check vexvvvv first, which made the logic here very complicated. I'll add some comments here.
> As to the deecription once again being empty: This is even more of an issue
> considering that the title suggests the patch isn't doing anything.
> After all we already use vexvvvv for the stated purpose.
>
The title is "Use vexvvvv to encode the vvvv register", which means that use vexvvvv for the stated purpose.
> Finally with the reg_slot use gone here (assuming, as per above, that this is
> actually correct at this point), that variable wants to move into the more
> narrow scope it's now solely used in, and it wants to have its initializer dropped.
Ok.
> > @@ -10462,10 +10462,7 @@ build_modrm_byte (void)
> > }
> >
> > if (v < MAX_OPERANDS)
> > - {
> > - gas_assert (i.tm.opcode_modifier.vexvvvv);
> > - i.vex.register_specifier = i.op[v].regs;
> > - }
> > + i.vex.register_specifier = i.op[v].regs;
>
> I have to admit I'm not entirely convinced of it being a good idea to drop the
> assertion. At least as long as the SWAP_SOURCES logic is still there.
>
Ok, I will move it to the patch 2/3.
> > vpgatherqq, 0x6691, AVX2, Modrm|Vex256|Space0F38|Src1VVVV|VexW1|SwapSources|NoSuf|VecSIB2
> 56, { RegYMM, Qword|Unspecified|BaseIndex, RegYMM }
>
> Anything using SwapSources wants leaving alone in this patch. There's no point
> touching any of these twice (here and when subsequently you replace
> SwapSources).
> That'll also help to limit patch size a little.
>
If we keep the old value VexVVVV here, we still need to deal with it in tc-i386.c and i386-opc.h, which is a bit strange.
Thanks,
Lili.
next prev parent reply other threads:[~2024-04-25 13:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 7:23 [PATCH 0/3] x86: Optimize the encoder of " Cui, Lili
2024-04-24 7:23 ` [PATCH 1/3] x86: Use vexvvvv to encode " Cui, Lili
2024-04-24 7:52 ` Jan Beulich
2024-04-25 13:14 ` Cui, Lili [this message]
2024-04-25 13:22 ` Jan Beulich
2024-04-26 5:33 ` Cui, Lili
2024-04-26 6:52 ` Jan Beulich
2024-04-24 7:23 ` [PATCH 2/3] x86: Drop SwapSources Cui, Lili
2024-04-24 8:07 ` Jan Beulich
2024-04-26 8:14 ` Cui, Lili
2024-04-26 10:37 ` Jan Beulich
2024-04-28 4:47 ` Cui, Lili
2024-04-29 6:40 ` Jan Beulich
2024-04-29 12:23 ` Cui, Lili
2024-04-29 13:08 ` Jan Beulich
2024-04-29 13:41 ` Cui, Lili
2024-04-29 13:49 ` Jan Beulich
2024-04-30 2:56 ` Cui, Lili
2024-04-30 6:18 ` Jan Beulich
2024-04-30 7:34 ` Cui, Lili
2024-04-30 9:22 ` Jan Beulich
2024-04-24 7:23 ` [PATCH 3/3] x86: Drop using extension_opcode to encode vvvv register Cui, Lili
2024-04-24 8:19 ` Jan Beulich
2024-04-24 8:27 ` 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=SJ0PR11MB560045EC9F0BD5C396BCBEE69E172@SJ0PR11MB5600.namprd11.prod.outlook.com \
--to=lili.cui@intel.com \
--cc=JBeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.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).