public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: binutils@sourceware.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Subject: [PATCH, V5 10/16] opcodes: gas: i386: define and use Rex2 as attribute not constraint
Date: Wed, 10 Jan 2024 23:48:14 -0800	[thread overview]
Message-ID: <20240111074820.2677826-11-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20240111074820.2677826-1-indu.bhagat@oracle.com>

[New in V5]

Rex2 is currently an operand constraint.  For the upcoming SCFI
implementation in GAS, we need to identify operations which implicitly
update the stack pointer.  An operand constraint enumerator for implicit
stack op seems more appropriate than an attribute.  However, two opcodes
currently necessitate both Rex2 and an implicit stack op marker; this
prompts revisiting the current representations a bit.

Make Rex2 a standalone attribute, so that later a new operand constraint
may be added for IMPLICIT_STACK_OP.

PS: Removed the opcodes/i386-tbl.h diffs to keep the message size within
limits.

ChangeLog:
	* gas/config/tc-i386.c (is_apx_rex2_encoding): Update the check.
	* opcodes/i386-gen.c: Add a new BITFIELD for Rex2.
	* opcodes/i386-opc.h (REX2_REQUIRED): Remove.
	* opcodes/i386-opc.tbl: Remove Rex2 operand constraint.
	* opcodes/i386-tbl.h: Regenerated.
---
 gas/config/tc-i386.c |     2 +-
 opcodes/i386-gen.c   |     1 +
 opcodes/i386-opc.h   |     6 +-
 opcodes/i386-opc.tbl |     1 -
 opcodes/i386-tbl.h   | 11659 +++++++++++++++++++++++++++--------------
 5 files changed, 7778 insertions(+), 3891 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index d599306b12c..8bbed03bd9a 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3955,7 +3955,7 @@ static INLINE bool
 is_apx_rex2_encoding (void)
 {
   return i.rex2 || i.rex2_encoding
-	|| i.tm.opcode_modifier.operandconstraint == REX2_REQUIRED;
+	|| i.tm.opcode_modifier.rex2;
 }
 
 static unsigned int
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index e8b92e32f45..21331216486 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -490,6 +490,7 @@ static bitfield opcode_modifiers[] =
   BITFIELD (ISA64),
   BITFIELD (NoEgpr),
   BITFIELD (NF),
+  BITFIELD (Rex2),
 };
 
 #define CLASS(n) #n, n
diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h
index 38661ffe70c..eaebfaa9ba8 100644
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -579,8 +579,6 @@ enum
   /* Instrucion requires that destination must be distinct from source
      registers.  */
 #define DISTINCT_DEST 9
-  /* Instrucion requires REX2 prefix.  */
-#define REX2_REQUIRED 10
   OperandConstraint,
   /* instruction ignores operand size prefix and in Intel mode ignores
      mnemonic size suffix check.  */
@@ -750,6 +748,9 @@ enum
   /* No CSPAZO flags update indication.  */
   NF,
 
+  /* Instrucion requires REX2 prefix.  */
+  Rex2,
+
   /* The last bitfield in i386_opcode_modifier.  */
   Opcode_Modifier_Num
 };
@@ -796,6 +797,7 @@ typedef struct i386_opcode_modifier
   unsigned int isa64:2;
   unsigned int noegpr:1;
   unsigned int nf:1;
+  unsigned int rex2:1;
 } i386_opcode_modifier;
 
 /* Operand classes.  */
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index aceac97dbaa..b9c2f1ce57e 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -85,7 +85,6 @@
 #define RegKludge         OperandConstraint=REG_KLUDGE
 #define SwapSources       OperandConstraint=SWAP_SOURCES
 #define Ugh               OperandConstraint=UGH
-#define Rex2              OperandConstraint=REX2_REQUIRED
 
 #define ATTSyntax         Dialect=ATT_SYNTAX
 #define ATTMnemonic       Dialect=ATT_MNEMONIC
-- 
2.41.0


  parent reply	other threads:[~2024-01-11  7:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  7:48 [PATCH, V5 00/16] Experimental support for synthesizing CFI for hand-written asm Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 01/16] gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 02/16] gas: dw2gencfi: use all_cfi_sections instead of cfi_sections Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 03/16] gas: dw2gencfi: expose a new cfi_set_last_fde API Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 04/16] gas: dw2gencfi: move some tc_* defines to the header file Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 05/16] gas: dw2gencfi: expose dot_cfi_sections for scfidw2gen Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 06/16] gas: dw2gencfi: externalize the all_cfi_sections Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 07/16] gas: add new command line option --scfi=experimental Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 08/16] gas: scfidw2gen: new functionality to prepare for SCFI Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 09/16] opcodes: i386: fix dw2_regnum data type in reg_entry Indu Bhagat
2024-01-11  7:48 ` Indu Bhagat [this message]
2024-01-11  7:48 ` [PATCH, V5 11/16] opcodes: i386: new marker for insns that implicitly update stack pointer Indu Bhagat
2024-01-11  7:57   ` Jan Beulich
2024-01-11  7:48 ` [PATCH, V5 12/16] gas: synthesize CFI for hand-written asm Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 13/16] gas: doc: update documentation for the new listing option Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 14/16] opcodes: i386-reg.tbl: Add a comment to reflect dependency on ordering Indu Bhagat
2024-01-11  7:59   ` Jan Beulich
2024-01-11  7:48 ` [PATCH, V5 15/16] gas: testsuite: add an x86_64 testsuite for SCFI Indu Bhagat
2024-01-11  7:48 ` [PATCH, V5 16/16] gas/NEWS: announce the new SCFI command line option Indu Bhagat

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=20240111074820.2677826-11-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    /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).