aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2020-01-09 11:39:33 +0100
committerJan Beulich <jbeulich@suse.com>2020-01-09 11:39:33 +0100
commit3f93af61413b6f6e4381ac286cb510d897971e3f (patch)
tree0265348806c1c74b594554437b25f43edb6024fb
parent7697afb662b2ffd67d044209d6d807a8e21dfed9 (diff)
downloadgdb-3f93af61413b6f6e4381ac286cb510d897971e3f.zip
gdb-3f93af61413b6f6e4381ac286cb510d897971e3f.tar.gz
gdb-3f93af61413b6f6e4381ac286cb510d897971e3f.tar.bz2
x86-64: assert sane internal state for REX conversions
For the comments about "hi" registers to be really applicable, RegRex may not be set on the respective registers. Assert this is the case.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-i386.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c3045c1..26a0075 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2020-01-09 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.c (md_assemble): Check RegRex is clear during
+ REX transformations. Correct comment indentation.
+
+2020-01-09 Jan Beulich <jbeulich@suse.com>
+
* config/tc-i386.c (optimize_encoding): Generalize register
transformation for TEST optimization.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index efa4365..645fd38 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4574,6 +4574,7 @@ md_assemble (char *line)
if (i.types[x].bitfield.class == Reg && i.types[x].bitfield.byte
&& (i.op[x].regs->reg_flags & RegRex64) == 0)
{
+ gas_assert (!(i.op[x].regs->reg_flags & RegRex));
/* In case it is "hi" register, give up. */
if (i.op[x].regs->reg_num > 3)
as_bad (_("can't encode register '%s%s' in an "
@@ -4592,7 +4593,7 @@ md_assemble (char *line)
if (i.rex == 0 && i.rex_encoding)
{
/* Check if we can add a REX_OPCODE byte. Look for 8 bit operand
- that uses legacy register. If it is "hi" register, don't add
+ that uses legacy register. If it is "hi" register, don't add
the REX_OPCODE byte. */
int x;
for (x = 0; x < 2; x++)
@@ -4601,6 +4602,7 @@ md_assemble (char *line)
&& (i.op[x].regs->reg_flags & RegRex64) == 0
&& i.op[x].regs->reg_num > 3)
{
+ gas_assert (!(i.op[x].regs->reg_flags & RegRex));
i.rex_encoding = FALSE;
break;
}