[binutils-gdb] x86: minor improvements to optimize_imm() (part II)
Jan Beulich
jbeulich@sourceware.org
Tue Jun 8 12:58:15 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7e96fb68712d07f3a2c0d3e1b0b1a4faaa240f39
commit 7e96fb68712d07f3a2c0d3e1b0b1a4faaa240f39
Author: Jan Beulich <jbeulich@suse.com>
Date: Tue Jun 8 14:57:18 2021 +0200
x86: minor improvements to optimize_imm() (part II)
Don't kind-of-open-code fits_in_unsigned_{word,long}().
Diff:
---
gas/ChangeLog | 5 +++++
gas/config/tc-i386.c | 5 ++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5f19f8590cf..935efaa24d2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-08 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (optimize_imm): Use fits_in_unsigned_word
+ and fits_in_unsigned_long.
+
2021-06-08 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (optimize_disp): Use fits_in_unsigned_word
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 17398ee987d..80b70986fa5 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5793,7 +5793,7 @@ optimize_imm (void)
This allows a 16-bit operand such as $0xffe0 to
be recognised as within Imm8S range. */
if ((i.types[op].bitfield.imm16)
- && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0)
+ && fits_in_unsigned_word (i.op[op].imms->X_add_number))
{
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
^ 0x8000) - 0x8000);
@@ -5801,8 +5801,7 @@ optimize_imm (void)
#ifdef BFD64
/* Store 32-bit immediate in 64-bit for 64-bit BFD. */
if ((i.types[op].bitfield.imm32)
- && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
- == 0))
+ && fits_in_unsigned_long (i.op[op].imms->X_add_number))
{
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
^ ((offsetT) 1 << 31))
More information about the Binutils-cvs
mailing list