mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
x86: minor improvements to optimize_disp() (part II)
- Don't kind-of-open-code fits_in_unsigned_{word,long}(). - Fold two if()s both using fits_in_unsigned_long().
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2021-06-08 Jan Beulich <jbeulich@suse.com>
|
||||||
|
|
||||||
|
* config/tc-i386.c (optimize_disp): Use fits_in_unsigned_word
|
||||||
|
and fits_in_unsigned_long. Combine if()s.
|
||||||
|
|
||||||
2021-06-08 Jan Beulich <jbeulich@suse.com>
|
2021-06-08 Jan Beulich <jbeulich@suse.com>
|
||||||
|
|
||||||
* config/tc-i386.c (optimize_disp): Write back updated value.
|
* config/tc-i386.c (optimize_disp): Write back updated value.
|
||||||
|
@ -5893,7 +5893,7 @@ optimize_disp (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i.types[op].bitfield.disp16
|
if (i.types[op].bitfield.disp16
|
||||||
&& (op_disp & ~(offsetT) 0xffff) == 0)
|
&& fits_in_unsigned_word (op_disp))
|
||||||
{
|
{
|
||||||
/* If this operand is at most 16 bits, convert
|
/* If this operand is at most 16 bits, convert
|
||||||
to a signed 16 bit number and don't use 64bit
|
to a signed 16 bit number and don't use 64bit
|
||||||
@ -5905,19 +5905,17 @@ optimize_disp (void)
|
|||||||
#ifdef BFD64
|
#ifdef BFD64
|
||||||
if (flag_code == CODE_64BIT)
|
if (flag_code == CODE_64BIT)
|
||||||
{
|
{
|
||||||
if (want_disp32 (current_templates->start)
|
|
||||||
&& fits_in_unsigned_long (op_disp))
|
|
||||||
i.types[op].bitfield.disp32 = 1;
|
|
||||||
|
|
||||||
/* Optimize 64-bit displacement to 32-bit for 64-bit BFD. */
|
/* Optimize 64-bit displacement to 32-bit for 64-bit BFD. */
|
||||||
if (i.types[op].bitfield.disp32
|
if ((i.types[op].bitfield.disp32
|
||||||
&& (op_disp & ~(((offsetT) 2 << 31) - 1)) == 0)
|
|| want_disp32 (current_templates->start))
|
||||||
|
&& fits_in_unsigned_long (op_disp))
|
||||||
{
|
{
|
||||||
/* If this operand is at most 32 bits, convert
|
/* If this operand is at most 32 bits, convert
|
||||||
to a signed 32 bit number and don't use 64bit
|
to a signed 32 bit number and don't use 64bit
|
||||||
displacement. */
|
displacement. */
|
||||||
op_disp = (op_disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
|
op_disp = (op_disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
|
||||||
i.types[op].bitfield.disp64 = 0;
|
i.types[op].bitfield.disp64 = 0;
|
||||||
|
i.types[op].bitfield.disp32 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fits_in_signed_long (op_disp))
|
if (fits_in_signed_long (op_disp))
|
||||||
|
Reference in New Issue
Block a user