From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: Lili Cui <lili.cui@intel.com>, "H.J. Lu" <hjl.tools@gmail.com>
Subject: [PATCH] x86: simplify VexVVVV_SRC2 handling for the XOP case
Date: Fri, 17 May 2024 14:57:34 +0200 [thread overview]
Message-ID: <00d90388-e947-4f26-9933-68415b44667a@suse.com> (raw)
As already suggested during review, rather than having an extra
conditional in build_modrm_byte() (a code path used for quite a few
more insns, including even certain GPR ones), adjust the attribute in
the installed template to properly describe things with operands
swapped.
---
I think we could even omit the conditional in match_template(), as all
other insns where XOP.W / VEX.W controls operand order are Src1VVVV
anyway. Opinions?
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9255,6 +9255,10 @@ match_template (char mnem_suffix)
flipping VEX.W. */
i.tm.opcode_modifier.vexw ^= VEXW0 ^ VEXW1;
+ /* In 3-operand insns XOP.W changes which operand goes into XOP.vvvv. */
+ if (i.tm.opcode_modifier.vexvvvv == VexVVVV_SRC2)
+ i.tm.opcode_modifier.vexvvvv = VexVVVV_SRC1;
+
swap_first_2:
j = i.tm.operand_types[0].bitfield.imm8;
i.tm.operand_types[j] = operand_types[j + 1];
@@ -10441,15 +10445,8 @@ build_modrm_byte (void)
{
/* VEX.vvvv encodes the last source register operand. */
case VexVVVV_SRC2:
- if (source != op)
- {
- v = source++;
- break;
- }
- /* For vprot*, vpshl*, and vpsha*, XOP.W controls the swapping of src1
- and src2, and it requires fall through when the operands are swapped.
- */
- /* Fall through. */
+ v = source++;
+ break;
/* VEX.vvvv encodes the first source register operand. */
case VexVVVV_SRC1:
v = dest - 1;
next reply other threads:[~2024-05-17 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 12:57 Jan Beulich [this message]
2024-05-20 7:58 ` Cui, Lili
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=00d90388-e947-4f26-9933-68415b44667a@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).