x86: consistently convert to byte registers for TEST w/ imm optimization

Commit ac0ab1842d ("i386: Also check R12-R15 registers when optimizing
testq to testb") didn't go quite far enough: In order to avoid confusing
other code registers would better be converted to byte ones uniformly.
This commit is contained in:
Jan Beulich
2020-01-09 11:38:59 +01:00
parent d835a58baa
commit 7697afb662
2 changed files with 15 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2020-01-09 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (optimize_encoding): Generalize register
transformation for TEST optimization.
2020-01-09 Jan Beulich <jbeulich@suse.com> 2020-01-09 Jan Beulich <jbeulich@suse.com>
* testsuite/gas/i386/x86-64-sysenter-amd.s, * testsuite/gas/i386/x86-64-sysenter-amd.s,

View File

@ -4009,17 +4009,16 @@ optimize_encoding (void)
i.types[1].bitfield.byte = 1; i.types[1].bitfield.byte = 1;
/* Ignore the suffix. */ /* Ignore the suffix. */
i.suffix = 0; i.suffix = 0;
if (base_regnum >= 4) /* Convert to byte registers. */
{ if (i.types[1].bitfield.word)
/* Handle SP, BP, SI, DI and R12-R15 registers. */ j = 16;
if (i.types[1].bitfield.word) else if (i.types[1].bitfield.dword)
j = 16; j = 32;
else if (i.types[1].bitfield.dword) else
j = 32; j = 48;
else if (!(i.op[1].regs->reg_flags & RegRex) && base_regnum < 4)
j = 48; j += 8;
i.op[1].regs -= j; i.op[1].regs -= j;
}
} }
} }
else if (flag_code == CODE_64BIT else if (flag_code == CODE_64BIT